]> git.proxmox.com Git - proxmox-backup.git/log
proxmox-backup.git
2 years agodatastore: move update_manifest into BackupDir impl
Thomas Lamprecht [Wed, 11 May 2022 16:55:57 +0000 (18:55 +0200)]
datastore: move update_manifest into BackupDir impl

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agosync: pull snapshot: use template variables for bloat reduction
Thomas Lamprecht [Wed, 11 May 2022 16:40:19 +0000 (18:40 +0200)]
sync: pull snapshot: use template variables for bloat reduction

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agodatastore: move cleanup_unreferenced_files to BackupDir impl and fix NS awareness
Thomas Lamprecht [Wed, 11 May 2022 16:39:05 +0000 (18:39 +0200)]
datastore: move cleanup_unreferenced_files to BackupDir impl and fix NS awareness

sync failed on cleanup due to always trying to do so in the root NS

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agoui: remote target selectors: code cleanups
Thomas Lamprecht [Wed, 11 May 2022 16:00:15 +0000 (18:00 +0200)]
ui: remote target selectors: code cleanups

just a small start...

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agoui: sync job: use namespace selector for localNS
Thomas Lamprecht [Wed, 11 May 2022 15:44:58 +0000 (17:44 +0200)]
ui: sync job: use namespace selector for localNS

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agoui: move remote target datastore/ns selectors to own file
Thomas Lamprecht [Wed, 11 May 2022 15:34:34 +0000 (17:34 +0200)]
ui: move remote target datastore/ns selectors to own file

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agoui: add namespace fields to sync
Fabian Grünbichler [Tue, 10 May 2022 13:02:23 +0000 (15:02 +0200)]
ui: add namespace fields to sync

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agosync/pull: make namespace aware
Fabian Grünbichler [Fri, 29 Apr 2022 11:46:14 +0000 (13:46 +0200)]
sync/pull: make namespace aware

Allow pulling all groups from a certain source namespace, and
possibly sub namespaces until max-depth, into a target namespace.

If any sub-namespaces get pulled, they will be mapped relatively from
the source parent namespace to the target parent namespace.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agoui: verify job: fix add-job on datastore-agnostic level
Thomas Lamprecht [Wed, 11 May 2022 15:20:29 +0000 (17:20 +0200)]
ui: verify job: fix add-job on datastore-agnostic level

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agoui: namespace selector: allow to set datastore dynamically
Thomas Lamprecht [Wed, 11 May 2022 15:19:26 +0000 (17:19 +0200)]
ui: namespace selector: allow to set datastore dynamically

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agoapi-types: rework BackupNamespace::map_prefix
Wolfgang Bumiller [Wed, 11 May 2022 10:26:25 +0000 (12:26 +0200)]
api-types: rework BackupNamespace::map_prefix

to use slice::strip_prefix() from std

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agodatastore: minor cleanup
Wolfgang Bumiller [Wed, 11 May 2022 10:19:49 +0000 (12:19 +0200)]
datastore: minor cleanup

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agodatastore: relative path fixup
Wolfgang Bumiller [Wed, 11 May 2022 10:17:45 +0000 (12:17 +0200)]
datastore: relative path fixup

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agoui: datastore content: make verify-all more flexible
Thomas Lamprecht [Wed, 11 May 2022 12:28:33 +0000 (14:28 +0200)]
ui: datastore content: make verify-all more flexible

allow to specify the namespace, max_depth and also the re-verify/skip
behavior.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agoui: fix group backup comment NS awareness
Thomas Lamprecht [Wed, 11 May 2022 10:01:36 +0000 (12:01 +0200)]
ui: fix group backup comment NS awareness

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agoui: verify job: make namespace and max-depth aware
Thomas Lamprecht [Wed, 11 May 2022 07:42:49 +0000 (09:42 +0200)]
ui: verify job: make namespace and max-depth aware

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agoui: add verifyOutdatedAfter component
Thomas Lamprecht [Wed, 11 May 2022 12:17:26 +0000 (14:17 +0200)]
ui: add verifyOutdatedAfter component

mainly as separate component for the trigger

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agoverify job: support max-depth config
Thomas Lamprecht [Wed, 11 May 2022 07:43:10 +0000 (09:43 +0200)]
verify job: support max-depth config

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agoapi: verify: support namespaces
Thomas Lamprecht [Tue, 10 May 2022 17:04:17 +0000 (19:04 +0200)]
api: verify: support namespaces

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agoadd ns-recursive and acl/authid aware backup group iter
Thomas Lamprecht [Tue, 10 May 2022 17:03:01 +0000 (19:03 +0200)]
add ns-recursive and acl/authid aware backup group iter

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agoremote scan/completion: add namespace support
Fabian Grünbichler [Thu, 5 May 2022 13:02:41 +0000 (15:02 +0200)]
remote scan/completion: add namespace support

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agoapi: add DatastoreWithNamespace helper struct
Fabian Grünbichler [Thu, 5 May 2022 08:58:26 +0000 (10:58 +0200)]
api: add DatastoreWithNamespace helper struct

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agoui: fix wrong call to htmlEncode
Fabian Grünbichler [Tue, 10 May 2022 13:02:42 +0000 (15:02 +0200)]
ui: fix wrong call to htmlEncode

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agoui: add namespace renderer
Fabian Grünbichler [Tue, 10 May 2022 13:01:48 +0000 (15:01 +0200)]
ui: add namespace renderer

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agoclient: add basic namespace commands
Wolfgang Bumiller [Tue, 10 May 2022 13:55:14 +0000 (15:55 +0200)]
client: add basic namespace commands

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agoapi: ns management: fix permission checks
Thomas Lamprecht [Tue, 10 May 2022 13:21:05 +0000 (15:21 +0200)]
api: ns management: fix permission checks

we do not have normal GET variables available in the checks provided
by the rest server from the api macro, so do it manually.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agoui: datastore: more NS awareness
Thomas Lamprecht [Tue, 10 May 2022 13:16:28 +0000 (15:16 +0200)]
ui: datastore: more NS awareness

verify is actually not yet ready in the backend

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agoui: datastore content: show root node for better UX with NS
Thomas Lamprecht [Tue, 10 May 2022 13:15:29 +0000 (15:15 +0200)]
ui: datastore content: show root node for better UX with NS

that way it's easier to see on which NS one currently operates and
allows better distinguishing of root NS and some sub ns named "Root"

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agoapi-types: allow empty namespace
Wolfgang Bumiller [Tue, 10 May 2022 12:40:34 +0000 (14:40 +0200)]
api-types: allow empty namespace

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agoclient: don't pass empty backup-ns
Wolfgang Bumiller [Tue, 10 May 2022 12:35:06 +0000 (14:35 +0200)]
client: don't pass empty backup-ns

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agoui: content view: improve empty text
Thomas Lamprecht [Tue, 10 May 2022 10:24:25 +0000 (12:24 +0200)]
ui: content view: improve empty text

reference NS so that users get a hint where they are currently
hierarchy-wise, and clarify that we found no *accessible* snapshots,
on this level, i.e., there can be some that we just cannot see due to
only having access on lover level NS or being different owners.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agoapi: namespace: return popped component
Fabian Grünbichler [Thu, 5 May 2022 11:47:26 +0000 (13:47 +0200)]
api: namespace: return popped component

helpful for places where namespaces need to be (re)created

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agoapi: datastore: further unify check helpers
Fabian Grünbichler [Tue, 10 May 2022 08:06:55 +0000 (10:06 +0200)]
api: datastore: further unify check helpers

this is the most common sequence of checks we have in this file, so
let's have a single place where we implement it.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agoapi: datastore: load datastore & check owner helper
Fabian Grünbichler [Mon, 9 May 2022 16:03:05 +0000 (18:03 +0200)]
api: datastore: load datastore & check owner helper

these happen together very often.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agoapi: datastore: lookup after checking privs
Fabian Grünbichler [Mon, 9 May 2022 16:03:32 +0000 (18:03 +0200)]
api: datastore: lookup after checking privs

else this could leak existence of datastore.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agoapi: datastore: refactor priv checks
Fabian Grünbichler [Mon, 9 May 2022 15:41:57 +0000 (17:41 +0200)]
api: datastore: refactor priv checks

the helper now takes both high-privilege and lesser-privilege privs, so
the resulting bool can be used to quickly check whether additional
checks like group ownership are needed or not.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agoapi: datastore: unify access checks
Fabian Grünbichler [Mon, 9 May 2022 15:14:32 +0000 (17:14 +0200)]
api: datastore: unify access checks

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agosplit the namespace out of BackupGroup/Dir api types
Wolfgang Bumiller [Mon, 9 May 2022 13:39:29 +0000 (15:39 +0200)]
split the namespace out of BackupGroup/Dir api types

We decided to go this route because it'll most likely be
safer in the API as we need to explicitly add namespaces
support to the various API endpoints this way.

For example, 'pull' should have 2 namespaces: local and
remote, and the GroupFilter (which would otherwise contain
exactly *one* namespace parameter) needs to be applied for
both sides (to decide what to pull from the remote, and what
to *remove* locally as cleanup).

The *datastore* types still contain the namespace and have a
`.backup_ns()` getter.

Note that the datastore's `Display` implementations are no
longer safe to use as a deserializable string.

Additionally, some datastore based methods now have been
exposed via the BackupGroup/BackupDir types to avoid a
"round trip" in code.

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agoui: datastore prune: support passing namespace
Thomas Lamprecht [Fri, 6 May 2022 09:35:14 +0000 (11:35 +0200)]
ui: datastore prune: support passing namespace

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agoprune: allow passing namespace
Thomas Lamprecht [Fri, 6 May 2022 09:27:15 +0000 (11:27 +0200)]
prune: allow passing namespace

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agoui: datastore content: allow to create new namespace
Thomas Lamprecht [Fri, 6 May 2022 09:02:59 +0000 (11:02 +0200)]
ui: datastore content: allow to create new namespace

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agoui: utils: also provided me.SAFE_ID_RE
Thomas Lamprecht [Fri, 6 May 2022 09:02:16 +0000 (11:02 +0200)]
ui: utils: also provided me.SAFE_ID_RE

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agoui: datastore content: allow to select namespace to show
Thomas Lamprecht [Fri, 6 May 2022 07:27:11 +0000 (09:27 +0200)]
ui: datastore content: allow to select namespace to show

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agoui: add namespace selector combobox
Thomas Lamprecht [Fri, 6 May 2022 07:26:47 +0000 (09:26 +0200)]
ui: add namespace selector combobox

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agoapi: backup create: enforce that namespace exists
Thomas Lamprecht [Thu, 5 May 2022 17:26:20 +0000 (19:26 +0200)]
api: backup create: enforce that namespace exists

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agoapi: backup create: make permission check namespace aware
Thomas Lamprecht [Thu, 5 May 2022 17:26:04 +0000 (19:26 +0200)]
api: backup create: make permission check namespace aware

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agoapi: datastore: make permission checks namespace aware
Thomas Lamprecht [Thu, 5 May 2022 17:07:28 +0000 (19:07 +0200)]
api: datastore: make permission checks namespace aware

We probably can combine the base permission + owner check, but for
now add explicit ones to upfront so that the change is simpler as
only one thing is done.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agoapi: namespace management endpoints
Thomas Lamprecht [Sun, 24 Apr 2022 18:24:42 +0000 (20:24 +0200)]
api: namespace management endpoints

allow to list any namespace with privileges on it and allow to create
and delete namespaces if the user has modify permissions on the parent
namespace.

Creation is only allowed if the parent NS already exists.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agodatastore: add max-depth to recursive namespace iter
Thomas Lamprecht [Thu, 5 May 2022 15:17:02 +0000 (17:17 +0200)]
datastore: add max-depth to recursive namespace iter

on depth == 0 we only yield the anchor ns, this simplifies usage in
the API as for, e.g. list-snapthos the depth == 0 means only the
snapshots from the passed namespace, nothing below.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agoapi: add NS_MAX_DEPTH_SCHEMA
Fabian Grünbichler [Fri, 29 Apr 2022 11:48:54 +0000 (13:48 +0200)]
api: add NS_MAX_DEPTH_SCHEMA

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
 [ T: renamed from NAMESPACE_RECURSION_DEPTH_SCHEMA & moved to from
   jobs to datastore ]
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agoapi: add prefix-mapping helper to BackupNamespace
Fabian Grünbichler [Fri, 29 Apr 2022 11:43:58 +0000 (13:43 +0200)]
api: add prefix-mapping helper to BackupNamespace

given a namespace, a source prefix and a target prefix this helper
strips the source prefix and replaces it with the target one (erroring
out if the prefix doesn't match).

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agoapi: derive UpdaterType for BackupNamespace
Fabian Grünbichler [Fri, 29 Apr 2022 11:42:58 +0000 (13:42 +0200)]
api: derive UpdaterType for BackupNamespace

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agoconfig: acl tree: allow path components to be paths too
Thomas Lamprecht [Wed, 4 May 2022 16:11:43 +0000 (18:11 +0200)]
config: acl tree: allow path components to be paths too

will be used for namespaces

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agodatastore: add create_namespace
Thomas Lamprecht [Tue, 26 Apr 2022 17:00:19 +0000 (19:00 +0200)]
datastore: add create_namespace

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agoBackupNamespace: fix deserialize of root NS
Fabian Grünbichler [Fri, 29 Apr 2022 11:25:13 +0000 (13:25 +0200)]
BackupNamespace: fix deserialize of root NS

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agoapi-types: fixup backup-ns being optional
Wolfgang Bumiller [Fri, 29 Apr 2022 10:11:32 +0000 (12:11 +0200)]
api-types: fixup backup-ns being optional

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agopbs-client: don't include empty backup-ns in requests
Wolfgang Bumiller [Wed, 27 Apr 2022 12:55:58 +0000 (14:55 +0200)]
pbs-client: don't include empty backup-ns in requests

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agoclient: add --ns parameter to snapshot list
Wolfgang Bumiller [Wed, 27 Apr 2022 12:35:36 +0000 (14:35 +0200)]
client: add --ns parameter to snapshot list

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agoapi types: BackupNamespace add pop & parent helpers
Thomas Lamprecht [Thu, 28 Apr 2022 07:37:10 +0000 (09:37 +0200)]
api types: BackupNamespace add pop & parent helpers

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agoapi-types: more regex fixups
Wolfgang Bumiller [Mon, 25 Apr 2022 09:52:12 +0000 (11:52 +0200)]
api-types: more regex fixups

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agoapi-types: add missing slash in optional ns path regex
Wolfgang Bumiller [Mon, 25 Apr 2022 09:33:12 +0000 (11:33 +0200)]
api-types: add missing slash in optional ns path regex

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agoclient: more backup namespace support
Wolfgang Bumiller [Mon, 25 Apr 2022 09:23:15 +0000 (11:23 +0200)]
client: more backup namespace support

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agodatastore: include namespace in full_path
Wolfgang Bumiller [Mon, 25 Apr 2022 08:58:46 +0000 (10:58 +0200)]
datastore: include namespace in full_path

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agoapi: add remaining missing backup-ns parameters
Wolfgang Bumiller [Mon, 25 Apr 2022 08:34:53 +0000 (10:34 +0200)]
api: add remaining missing backup-ns parameters

these are the ones for non-#[api] methods, also fill in the
namespace in prune operations

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agodatastore: add helpers to destroy whole namespaces
Thomas Lamprecht [Mon, 25 Apr 2022 09:37:57 +0000 (11:37 +0200)]
datastore: add helpers to destroy whole namespaces

The behavior on "any snapshot was protected" isn't yet ideal, as we
then do not cleanup any (sub) namespace, even if some of them where
cleaned from groups & snapshots completely. But that isn't easy to do
with our current depth-first pre-order iterator behavior, and it's
also not completely wrong either, the user can re-do the removal on
the sub-namespaces, so leave that for later.

Should get moved to a datastore::BackupNamespace type once/if we get
one

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agodatastore: add single-level and recursive namespace iterators
Thomas Lamprecht [Sun, 24 Apr 2022 18:23:30 +0000 (20:23 +0200)]
datastore: add single-level and recursive namespace iterators

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agoapi types: namespace: add from_parent_ns helper
Thomas Lamprecht [Sun, 24 Apr 2022 18:21:57 +0000 (20:21 +0200)]
api types: namespace: add from_parent_ns helper

will be used in the (recursive) namespace iterator

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agoapi types: namespace: include problematic component in error
Thomas Lamprecht [Sun, 24 Apr 2022 18:21:45 +0000 (20:21 +0200)]
api types: namespace: include problematic component in error

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agodatastore: add backup_ns accessor
Wolfgang Bumiller [Mon, 25 Apr 2022 08:42:23 +0000 (10:42 +0200)]
datastore: add backup_ns accessor

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agoapi-types: add namespace to BackupGroup
Wolfgang Bumiller [Thu, 21 Apr 2022 13:04:59 +0000 (15:04 +0200)]
api-types: add namespace to BackupGroup

Make it easier by adding an helper accepting either group or
directory

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agons: max depth: set constant to upper inclusive boundary
Thomas Lamprecht [Thu, 5 May 2022 15:15:31 +0000 (17:15 +0200)]
ns: max depth: set constant to upper inclusive boundary

makes usage a bit simpler, e.g., the api maximum can use that 1:1
then.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agoapi-types: add BackupNamespace type
Thomas Lamprecht [Wed, 7 Apr 2021 10:28:50 +0000 (12:28 +0200)]
api-types: add BackupNamespace type

The idea is to have namespaces in a datastore to allow grouping and
namespacing backups from different (but similar trusted) sources,
e.g., different PVE clusters, geo sites, use-cases or company
service-branches, without separating the underlying
deduplication domain and thus blowing up data and (GC/verify)
resource usage.

To avoid namespace ID clashes with anything existing or future
usecases use a intermediate `ns` level on *each* depth.

The current implementation treats that as internal and thus hides
that fact from the API, iow., the namespace path the users passes
along or gets returned won't include the `ns` level, they do not
matter there at all.

The max-depth of 8 is chosen with the following in mind:
- assume that end-users already are in a deeper level of a hierarchy,
  most often they'll start at level one or two, as the higher ones
  are used by the seller/admin to namespace different users/groups,
  so lower than four would be very limiting for a lot of target use
  cases

- all the more, a PBS could be used as huge second level archive in a
  big company, so one could imagine a namespace structure like:
  /<state>/<intra-state-location>/<datacenter>/<company-branch>/<workload-type>/<service-type>/
  e.g.: /us/east-coast/dc12345/financial/report-storage/cassandra/
  that's six levels that one can imagine for a reasonable use-case,
  leave some room for the ones harder to imagine ;-)

- on the other hand, we do not want to allow unlimited levels as we
  have request parameter limits and deep nesting can create other
  issues as well (e.g., stack exhaustion), so doubling the minimum
  level of 4 (1st point) we got room to breath even for the
  more odd (or huge) use cases (2nd point)

- a per-level length of 32 (-1 due to separator) is enough to use
  telling names, making lives of users and admin simpler, but not
  blowing up parameter total length with the max depth of 8

- 8 * 32 = 256 which is nice buffer size

Much thanks for Wolfgang for all the great work on the type
implementation and assisting greatly with the design.

Co-authored-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
Co-authored-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agoapi types: BackupType: add iter for enum
Thomas Lamprecht [Tue, 3 May 2022 10:39:47 +0000 (12:39 +0200)]
api types: BackupType: add iter for enum

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agocompletion: fix 'group-filter' parameter name
Fabian Grünbichler [Fri, 6 May 2022 08:27:00 +0000 (10:27 +0200)]
completion: fix 'group-filter' parameter name

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2 years agoproxmox-backup-manager: add limit to pull
Fabian Grünbichler [Fri, 6 May 2022 08:25:31 +0000 (10:25 +0200)]
proxmox-backup-manager: add limit to pull

seems to have been forgotten initially.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2 years agodatastore: chunk store: leverage new format str variable reference
Thomas Lamprecht [Tue, 10 May 2022 07:39:17 +0000 (09:39 +0200)]
datastore: chunk store: leverage new format str variable reference

makes it often compact enough for rustfmt to move it into a single
line

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agochunk_store: insert_chunk: write chunk again if it is empty on disk
Dominik Csapak [Mon, 9 May 2022 14:09:06 +0000 (16:09 +0200)]
chunk_store: insert_chunk: write chunk again if it is empty on disk

and issue a warning. We can do this, because we know an empty chunk
cannot be valid, and we (assumedly) have a valid chunk in memory.

Having empty chunks on disk is currently possible when PBS crashes,
but the rename of the chunk was flushed to disk, when the actual data
was not.

If it's not empty but there is a size mismatch, return an error.

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2 years agoapi: tape/restore: skip snapshot if owner check failed
Dominik Csapak [Mon, 9 May 2022 10:41:19 +0000 (12:41 +0200)]
api: tape/restore: skip snapshot if owner check failed

instead of aborting the whole restore

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2 years agoapi: tape/restore: fix wrong datastore locking
Dominik Csapak [Mon, 9 May 2022 10:41:18 +0000 (12:41 +0200)]
api: tape/restore: fix wrong datastore locking

used_datastores returned the 'target', but in the full_restore_worker,
we interpreted it as the source and searched for a mapping
(which we then locked)

since we cannot return a HashSet of Arc<T> (missing Hash trait on DataStore),
we have now a map of source -> target

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2 years agodrop mut on some http client usages
Thomas Lamprecht [Thu, 5 May 2022 08:49:03 +0000 (10:49 +0200)]
drop mut on some http client usages

thanks to commit 70142e607dda43fc778f39d52dc7bb3bba088cd3 from
proxmox repos's proxmox-http crate

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agoupdate proxmox-http b-d to 0.6.1
Thomas Lamprecht [Thu, 5 May 2022 08:50:23 +0000 (10:50 +0200)]
update proxmox-http b-d to 0.6.1

so that we can drop some mut on http client usages

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agorouter change made one level of rpcenv mut superfluous
Thomas Lamprecht [Tue, 3 May 2022 07:43:04 +0000 (09:43 +0200)]
router change made one level of rpcenv mut superfluous

Created via `cargo fix`.  see commit
47acc8dc8f68ed2c5db69b1678b479e05b0a3194 from proxmox-rs

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agoupdate proxmox-router b-d to 1.2.2
Thomas Lamprecht [Thu, 5 May 2022 07:54:18 +0000 (09:54 +0200)]
update proxmox-router b-d to 1.2.2

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agobump version to 2.1.8-1
Thomas Lamprecht [Mon, 2 May 2022 15:36:17 +0000 (17:36 +0200)]
bump version to 2.1.8-1

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agopull: add some comments
Fabian Grünbichler [Fri, 29 Apr 2022 09:17:27 +0000 (11:17 +0200)]
pull: add some comments

and remove already fixed fixmes.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
 [ T: squash in cargo fmt fixup for some trailing ws ]
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agopull: remove unnecessary `pub` visibility
Fabian Grünbichler [Fri, 29 Apr 2022 09:17:26 +0000 (11:17 +0200)]
pull: remove unnecessary `pub` visibility

pull_store is the entrypoint used by other code, the rest does not need
to be visible at all.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2 years agopull: filter local removal candidates by owner
Fabian Grünbichler [Fri, 29 Apr 2022 09:17:25 +0000 (11:17 +0200)]
pull: filter local removal candidates by owner

else this might remove groups which are not part of the pull scope. note
that setting/using remove_vanished already checks the required privs
earlier.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2 years agoproxmox-backup-proxy: stop accept() loop on daemon shutdown
Dominik Csapak [Fri, 29 Apr 2022 10:04:52 +0000 (12:04 +0200)]
proxmox-backup-proxy: stop accept() loop on daemon shutdown

On reload the old process hands over to the new process but needs to
keep running until all its worker tasks are finished to avoid
breaking a in-progress action like a xterm.js web shell or a backup
creation/restore.

During that wait time the receiving channel was already closed, but
the TCP sockt accept listener was still left active by mistake.

That paired with the `SO_REUSEPORT` being set on the underlying
socket, made the kernel choose either the old or new process for new
incoming connections, both still listened for them after all and
reuse-port + multiple processes is often used as load-balancer
mechanism.

As the old proxy accepted connections but didn't process them anymore
one could observer sporadic connection failures on any API call, well
any new connection to the proxy, depending on which process got the
it assigned.

The fix is to stop accepting new connections one we shutdown, so poll
the shutdown_future too during accept and just exit the accept-loop
on shutdown.

Note: This part of the code, nor other parts that could influence it,
wasn't changed at all in recent times, so it's still unresolved for
why it pops up only now.

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
Co-authored-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
 [ T: add more (root cause) info and reword a bit ]
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agoapi: status: return gc-status again
Dominik Csapak [Fri, 29 Apr 2022 10:07:12 +0000 (12:07 +0200)]
api: status: return gc-status again

Returning the GC status was dropped by mistake in commit 762f7d15
("datastore status: factor out api type DataStoreStatusListItem")

As this is considered a breaking change which we also felt, due to
the gc-status being used in the web interface for the datastore
overview list (not the dashboard), re add it.

Fixes: 762f7d15
Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
 [ T: add reference to breaking commit, reword message ]
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agocargo fmt
Thomas Lamprecht [Thu, 28 Apr 2022 08:26:00 +0000 (10:26 +0200)]
cargo fmt

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agobump version to 2.1.7-1
Thomas Lamprecht [Wed, 27 Apr 2022 17:54:27 +0000 (19:54 +0200)]
bump version to 2.1.7-1

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agoui: add tooltip to datastore in maintenance mode
Hannes Laimer [Tue, 26 Apr 2022 06:23:35 +0000 (06:23 +0000)]
ui: add tooltip to datastore in maintenance mode

Signed-off-by: Hannes Laimer <h.laimer@proxmox.com>
2 years agoui: utils: add function for parsing maintenance mode
Hannes Laimer [Tue, 26 Apr 2022 06:23:34 +0000 (06:23 +0000)]
ui: utils: add function for parsing maintenance mode

...since the same code is used is more than one place

Signed-off-by: Hannes Laimer <h.laimer@proxmox.com>
2 years agoui: update datastore list more often
Hannes Laimer [Tue, 26 Apr 2022 06:23:33 +0000 (06:23 +0000)]
ui: update datastore list more often

Signed-off-by: Hannes Laimer <h.laimer@proxmox.com>
2 years agoui: update icon in datastore list when in maintenance mode
Hannes Laimer [Tue, 26 Apr 2022 06:23:32 +0000 (06:23 +0000)]
ui: update icon in datastore list when in maintenance mode

Signed-off-by: Hannes Laimer <h.laimer@proxmox.com>
2 years agoapi2: DataStoreListItem add maintenance info
Hannes Laimer [Tue, 26 Apr 2022 06:23:31 +0000 (06:23 +0000)]
api2: DataStoreListItem add maintenance info

Signed-off-by: Hannes Laimer <h.laimer@proxmox.com>
2 years agoui: add summary mask when in maintenance mode
Hannes Laimer [Tue, 26 Apr 2022 06:23:30 +0000 (06:23 +0000)]
ui: add summary mask when in maintenance mode

Signed-off-by: Hannes Laimer <h.laimer@proxmox.com>
2 years agofile-restore: add 'timeout' and 'json-error' parameter
Dominik Csapak [Tue, 26 Apr 2022 10:13:58 +0000 (12:13 +0200)]
file-restore: add 'timeout' and 'json-error' parameter

timeout limits the code with the given timeout in seconds, and
'json-error' return json to stdout when the call returns an error like
this:

{
    "msg": "error message",
    "error": true,
    "code": <HTTP_STATUS_CODE>, // if it was an http error
}

with both options set, a client can more easily determine if the call
ran into a timeout (since it will return a 503 error), and can poll
it again

both is done behind new parameters, so that we can stay backwards-compatible

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agofile-restore: factor out 'list_files'
Dominik Csapak [Tue, 26 Apr 2022 10:13:57 +0000 (12:13 +0200)]
file-restore: factor out 'list_files'

we'll want to reuse that in a later patch

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agorestore-daemon: avoid auto-mounting zpools
Dominik Csapak [Tue, 26 Apr 2022 10:13:56 +0000 (12:13 +0200)]
restore-daemon: avoid auto-mounting zpools

the duration of mounting zpools not only correspond to the number of disks,
but also to the content (many subvols for example) which we cannot know
beforehand. so avoid mounting them at the start, and mount it only when
the user requests a listing/extraction with the zpool in path

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>