]> git.proxmox.com Git - pve-storage.git/log
pve-storage.git
3 years agoapi: scan cifs: port over NT_STATUS filter from pve-manager
Thomas Lamprecht [Tue, 1 Dec 2020 17:08:58 +0000 (18:08 +0100)]
api: scan cifs: port over NT_STATUS filter from pve-manager

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agofactor out scan CLI definition to real API module
Thomas Lamprecht [Tue, 1 Dec 2020 16:15:35 +0000 (17:15 +0100)]
factor out scan CLI definition to real API module

we have a 1:1 copy of that code in pve-manager's PVE::API2::Scan,
which we can avoid by using a common module form pvesm CLI and the
API.

This is the first basic step of dropping the code duplication in
pve-manager.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agopbs: activate storage: fully validate if storage config works
Thomas Lamprecht [Tue, 1 Dec 2020 18:18:05 +0000 (19:18 +0100)]
pbs: activate storage: fully validate if storage config works

improves UX of on_update and on_add hooks *a lot*.

This is a bit more expensive than the TCP ping, or even just an
unauthenticated ping, but not as bad as a full datastore status - as
this only reads the datastore config file (which is normally in page
cache anyway).

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agopbs: add scan datastore helper
Thomas Lamprecht [Tue, 1 Dec 2020 18:15:49 +0000 (19:15 +0100)]
pbs: add scan datastore helper

for use in both, the scan API and the on_add/on_update hooks

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agopbs: reuse pve apiclient for api connect helper
Thomas Lamprecht [Tue, 1 Dec 2020 08:53:38 +0000 (09:53 +0100)]
pbs: reuse pve apiclient for api connect helper

it is flexible enough to easily do so, and should do well until we
actually have cheap native bindings (e.g., through wolfgangs rust
permlod magic).

Make it a private helper, we do *not* want to expose it directly for
now.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agoplugin: hooks: add explicit returns
Fabian Ebner [Fri, 27 Nov 2020 09:35:44 +0000 (10:35 +0100)]
plugin: hooks: add explicit returns

to avoid returning something unexpected. Finish what
afeda182566292be15413d9b874720876eac14c9 already started for all the other
plugins. At least for ZFS's on_add_hook this is necessary (adding a ZFS storage
currently fails as reported here [0]), but it cannot hurt
in the other places either as the only hooks we expect to return something
currently are PBS's on_add_hook and on_update_hook.

[0]: https://forum.proxmox.com/threads/gui-add-zfs-storage-verification-failed-400-config-type-check-object-failed.79734/

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
3 years agonfs: code cleanup
Thomas Lamprecht [Fri, 27 Nov 2020 09:45:06 +0000 (10:45 +0100)]
nfs: code cleanup

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agobump version to 6.3-1
Thomas Lamprecht [Tue, 24 Nov 2020 22:20:45 +0000 (23:20 +0100)]
bump version to 6.3-1

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agoapi: content: pass encrypted status for PBS backups
Thomas Lamprecht [Tue, 24 Nov 2020 22:17:57 +0000 (23:17 +0100)]
api: content: pass encrypted status for PBS backups

Prefer the fingerprint, fallback to checking the files crypt-mode.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agopbs add/update: save fingerprint in storage config
Thomas Lamprecht [Tue, 24 Nov 2020 21:09:38 +0000 (22:09 +0100)]
pbs add/update: save fingerprint in storage config

fallback to the old truthy "1" if not available

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agopbs add/update: do basic key value validation
Thomas Lamprecht [Tue, 24 Nov 2020 21:09:15 +0000 (22:09 +0100)]
pbs add/update: do basic key value validation

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agopbs: autogen key: rename old one if existing
Thomas Lamprecht [Tue, 24 Nov 2020 21:05:21 +0000 (22:05 +0100)]
pbs: autogen key: rename old one if existing

it could be debated do have some security implications and that
deletion is safer, but key deletion is a pretty hairy thing.

Should be documented, and people just should use delete instead of
autogen if they want to "destroy" a key.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agobump version to 6.2-12
Thomas Lamprecht [Tue, 24 Nov 2020 15:06:03 +0000 (16:06 +0100)]
bump version to 6.2-12

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agoStorage/PBSPlugin: implement get/update_volume_notes for pbs
Dominik Csapak [Tue, 24 Nov 2020 09:09:33 +0000 (10:09 +0100)]
Storage/PBSPlugin: implement get/update_volume_notes for pbs

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
3 years agoStorage/Plugin: add get/update_volume_comment and implement for dir
Dominik Csapak [Tue, 24 Nov 2020 09:09:32 +0000 (10:09 +0100)]
Storage/Plugin: add get/update_volume_comment and implement for dir

and add the appropriate api call to set and get the comment
we need to bump APIVER for this and can bump APIAGE, since
we only use it at this new call that can work with the default
implementation

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
3 years agoapi2/storage/content: change to volume_size_info and add return properties
Dominik Csapak [Tue, 24 Nov 2020 09:09:31 +0000 (10:09 +0100)]
api2/storage/content: change to volume_size_info and add return properties

'file_size_info' only works for directory based storages, while
'volume_size_info' should work for all

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
3 years agorename comment to notes
Dominik Csapak [Tue, 24 Nov 2020 09:09:30 +0000 (10:09 +0100)]
rename comment to notes

so that we are more consistent with pbs

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
3 years agobump version to 6.2-11
Thomas Lamprecht [Mon, 23 Nov 2020 14:58:34 +0000 (15:58 +0100)]
bump version to 6.2-11

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agoconvert maxfiles to prune_backups when reading the storage configuration
Fabian Ebner [Mon, 23 Nov 2020 12:33:09 +0000 (13:33 +0100)]
convert maxfiles to prune_backups when reading the storage configuration

If there are already prune options configured, simply delete the maxfiles
setting. Having set both is invalid from vzdump's perspective anyways, and any
backup job on such a storage failed, meaning a user would've noticed.

If there are no prune options, translate the maxfiles value to keep-last,
except for maxfiles being zero (=unlimited), in which case we use keep-all.

If both are not set, don't set anything, so:
1. Storages don't suddenly have retention options set.
2. People relying on vzdump defaults can still use those.

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
3 years agoprune: introduce keep-all option
Fabian Ebner [Mon, 23 Nov 2020 12:33:08 +0000 (13:33 +0100)]
prune: introduce keep-all option

useful to have an alternative to the old maxfiles = 0. There has to
be a way for vzdump to distinguish between:
1. use the /etc/vzdump.conf default (when no options are configured for the storage)
2. use no limit (when keep-all=1)

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
3 years agoperlcritic: don't modify $_ in list functions, use for
Thomas Lamprecht [Mon, 23 Nov 2020 14:26:14 +0000 (15:26 +0100)]
perlcritic: don't modify $_ in list functions, use for

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agoperlcritic: avoid conditional variable declaration
Thomas Lamprecht [Mon, 23 Nov 2020 14:13:33 +0000 (15:13 +0100)]
perlcritic: avoid conditional variable declaration

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agoplugin: hooks: avoid that method param count gets returned
Thomas Lamprecht [Mon, 23 Nov 2020 14:12:46 +0000 (15:12 +0100)]
plugin: hooks: avoid that method param count gets returned

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agofix volume activation for ZFS subvols
Fabian Ebner [Thu, 19 Nov 2020 10:29:53 +0000 (11:29 +0100)]
fix volume activation for ZFS subvols

When using the path to request properties, and no ZFS file system is mounted
at that path, ZFS will fall back to the parent filesystem:

> # zfs unmount myzpool/subvol-172-disk-0
> # zfs get mounted /myzpool/subvol-172-disk-0
> NAME     PROPERTY  VALUE    SOURCE
> myzpool  mounted   yes      -
> # zfs get mounted myzpool/subvol-172-disk-0
> NAME                       PROPERTY  VALUE    SOURCE
> myzpool/subvol-172-disk-0  mounted   no       -

Thus, we cannot use the path and need to use the dataset directly.

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
3 years agod/control: bump versioned dependency on libpve-common-perl
Thomas Lamprecht [Mon, 16 Nov 2020 17:25:26 +0000 (18:25 +0100)]
d/control: bump versioned dependency on libpve-common-perl

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agolvmthin: Match snapshot remove regex to allowed names
Dominic Jäger [Wed, 28 Oct 2020 10:04:54 +0000 (11:04 +0100)]
lvmthin: Match snapshot remove regex to allowed names

We allow snapshot names that match pve-configid but during qm destroy we have
not removed all snapshots that match pve-configid so far. For example, the name
x-y was allowed but the resulting snap_vm-105-disk-0_x-y was not removed.

Reported-by: Hannes Laimer <h.laimer@proxmox.com>
Signed-off-by: Dominic Jäger <d.jaeger@proxmox.com>
3 years agoprune: allow having all prune options zero/missing
Fabian Ebner [Fri, 13 Nov 2020 13:08:55 +0000 (14:08 +0100)]
prune: allow having all prune options zero/missing

This is basically necessary for the GUI's prune widget, because we want to
pass along all options equal to zero when all the number fields are cleared.
And it's more similar to how it's done in PBS now.

Bumped the APIAGE and APIVER, in case some external plugin needs to adapt to
the now less restrictive schema for 'prune-backups'.

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
3 years agoprune mark: keep all if all prune options are zero/missing
Fabian Ebner [Fri, 13 Nov 2020 13:08:54 +0000 (14:08 +0100)]
prune mark: keep all if all prune options are zero/missing

as an additional safety measure. And add some tests.

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
3 years agodon't pass along keep-options equal to zero to PBS
Fabian Ebner [Fri, 13 Nov 2020 13:08:53 +0000 (14:08 +0100)]
don't pass along keep-options equal to zero to PBS

In PBS, zero is not allowed for these options.

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
3 years agopbs: add/update: return enc. key, if newly set or auto-generated
Thomas Lamprecht [Thu, 12 Nov 2020 17:05:26 +0000 (18:05 +0100)]
pbs: add/update: return enc. key, if newly set or auto-generated

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agoapi: storage create/update: return parts of the configuration
Thomas Lamprecht [Thu, 12 Nov 2020 17:01:41 +0000 (18:01 +0100)]
api: storage create/update: return parts of the configuration

First, doing such things can make client work slightly easier, as the
submitted values do not need to be made available in any callback
handling the response.

But the actual reason for doing this now is, that this is a
preparatory step for allowing the user to download/print/.. an
autogenerated PBS client encryption key.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agoavoid unecessary try for over optimization
Thomas Lamprecht [Thu, 12 Nov 2020 16:31:16 +0000 (17:31 +0100)]
avoid unecessary try for over optimization

That was lots of code and hash map touching for the case where one
avoided a extra stat, which result probably was in the page cache
anyway, for the case that a backup has a comment.

A case which is rather  be unlikely - comments are normally done for
the occasional explicit backup (e.g., before major upgrade, before a
configuration change in that guest, ...), at least not worth some
relatively complicated effort making that sub harder to read and
maintain.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agostorage: get subdirectory files: read .comment files for comments
Dominik Csapak [Thu, 12 Nov 2020 15:26:02 +0000 (16:26 +0100)]
storage: get subdirectory files: read .comment files for comments

we have no way of setting them yet via the API, but we can read them
now

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
3 years agoapi: content listing: add comment and verification fields
Dominik Csapak [Thu, 12 Nov 2020 15:26:01 +0000 (16:26 +0100)]
api: content listing: add comment and verification fields

for now only for PBS, since we do not have such info elsewhere

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
3 years agopbs: autogen encryption key: bubble up error message
Thomas Lamprecht [Thu, 12 Nov 2020 10:49:01 +0000 (11:49 +0100)]
pbs: autogen encryption key: bubble up error message

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agoapi/config: fix indentation
Thomas Lamprecht [Wed, 11 Nov 2020 08:35:53 +0000 (09:35 +0100)]
api/config: fix indentation

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agobump version to 6.2-10
Thomas Lamprecht [Tue, 10 Nov 2020 18:03:07 +0000 (19:03 +0100)]
bump version to 6.2-10

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agofix #3030: always activate volumes in storage_migrate
Fabian Ebner [Fri, 6 Nov 2020 14:30:55 +0000 (15:30 +0100)]
fix #3030: always activate volumes in storage_migrate

AFAICT the snapshot activation is not necessary for our plugins at the moment,
but it doesn't really hurt and might be relevant in the future or for external
plugins.

Deactivating volumes is up to the caller, because for example, for replication
on a running guest, we obviously don't want to deactivate volumes.

Suggested-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
3 years agoadd check for fsfreeze before snapshot
Stoiko Ivanov [Fri, 6 Nov 2020 14:19:40 +0000 (15:19 +0100)]
add check for fsfreeze before snapshot

In order to take a snapshot of a container volume, which can be mounted
read-only with RBD, the volume needs to be frozen (fsfreeze (8)) before taking
the snapshot.

This commit adds helpers to determine if the FIFREEZE ioctl needs to be called
for the volume.

Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
3 years agofix typo in comment
Stoiko Ivanov [Fri, 6 Nov 2020 14:19:39 +0000 (15:19 +0100)]
fix typo in comment

Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
3 years agoDiskmanage: Use S.M.A.R.T. attributes for SSDs wearout lookup
Jan-Jonas Sämann [Fri, 30 Oct 2020 03:57:22 +0000 (04:57 +0100)]
Diskmanage: Use S.M.A.R.T. attributes for SSDs wearout lookup

This replaces a locally maintained hardware map in
get_wear_leveling_info() by commonly used register names of
smartmontool. Smartmontool maintains a labeled register database that
contains a majority of drives (including versions). The current lookup
produces false estimates, this approach hopefully provides more reliable
data.

Signed-off-by: Jan-Jonas Sämann <sprinterfreak@binary-kitchen.de>
3 years agoUpdate disk_tests/ssd_smart/sde data
Jan-Jonas Sämann [Fri, 30 Oct 2020 03:57:21 +0000 (04:57 +0100)]
Update disk_tests/ssd_smart/sde data

Provides recent test data for disk_tests/ssd_smart/sde_smart. The
previous data was created using an older smartmontools version, which
did not yet support the drive and therefore had bogus attribute mapping.

Signed-off-by: Jan-Jonas Sämann <sprinterfreak@binary-kitchen.de>
3 years agofix #1452: also log stderr of remote command with insecure storage migration
Fabian Ebner [Thu, 1 Oct 2020 08:11:36 +0000 (10:11 +0200)]
fix #1452: also log stderr of remote command with insecure storage migration

Commit 8fe00d99449b7c80e81ab3c9826625a4fcd89aa4 already
introduced the necessary logging for the secure code path,
so presumably the bug was already fixed for most people.

Delay the potential die for the send command to be able to log
the ouput+error from the receive command. Like this we also see e.g.
'volume ... already exists' instead of just 'broken pipe'.

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
3 years agoavoid output of zfs get command on volume import
Fabian Ebner [Thu, 1 Oct 2020 08:11:35 +0000 (10:11 +0200)]
avoid output of zfs get command on volume import

quiet takes care of both the error and success case.
Without this, there are lines like:
myzpool/vm-4352-disk-0@__replicate_4352-7_1601538554__ name myzpool/vm-4352-disk-0@__replicate_4352-7_1601538554__ -
in the log if the dataset exists, and this information is
already present in more readable form.

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
3 years agofix #3097: cifs, nfs: increase connection check timeout to 10s
Thomas Lamprecht [Tue, 27 Oct 2020 06:03:17 +0000 (07:03 +0100)]
fix #3097: cifs, nfs: increase connection check timeout to 10s

we already have the ZFS pool plugin as precedent to use 10s, at for
network with remote off-site storage one can get to 200 - 300ms
RTT latency, which means that for a protocol needing multiple rounds of
communication, one can easily get over 2s while not being in a broken
network.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agobump version to 6.2-9
Thomas Lamprecht [Tue, 13 Oct 2020 09:14:10 +0000 (11:14 +0200)]
bump version to 6.2-9

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agoLIO: drop unused statements
Stoiko Ivanov [Mon, 12 Oct 2020 15:34:58 +0000 (17:34 +0200)]
LIO: drop unused statements

minor cleanup of left-over/unused statements.

Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
3 years agoLIO: untaint values read from remote config
Stoiko Ivanov [Mon, 12 Oct 2020 15:34:57 +0000 (17:34 +0200)]
LIO: untaint values read from remote config

The LIO backend for ZFS over iSCSI fetches the json-config periodically from
the target.
This patch reduces the stored config values to those which are actually used
and additonally untaints the values read from the remote host's config-file.

Since the LUN index is used in calls to targetcli on the remote host (via
run_command), untainting prevents the call to crash when run with '-T'.

Tested by creating a zfs over iscsi backed VM, starting it, adding disks,
resizing disks, removing disks, creating snapshots, rolling back to a snapshot.

Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
3 years agoZFSPlugin: untaint lun number
Stoiko Ivanov [Fri, 9 Oct 2020 15:13:44 +0000 (17:13 +0200)]
ZFSPlugin: untaint lun number

ZFS over iSCSI fetches information about the disk-images via ssh, thus
the obtainted data is tainted (perlsec (1)).

Since pvedaemon runs with '-T' enabled trying to start a VM via GUI/API failed,
while it still worked via `qm` or `pvesh`.

The issue surfaced after commit cb9db10c1a9855cf40ff13e81f9dd97d6a9b2698 in
pve-common ('run_command: improve performance for logging and long lines'),
and results from concatenating the original (tainted) buffer to a variable,
instead of a captured subgroup.

Untainting the value in ZFSPlugin should not cause any regressiosn, since the
other 3 target providers already have a match on '\d+' for retrieving the
lun number.

reported via pve-user [0].

reproduced and tested by setting up a LIO-target (on top of a virtual PVE),
adding it as storage and trying to start a guest (with a disk on the
ZFS over iSCSI storage) with `perl -T /usr/sbin/qm start $vmid`

[0] https://lists.proxmox.com/pipermail/pve-user/2020-October/172055.html

Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
3 years agodisk management: set more specific type for nvme
Thomas Lamprecht [Fri, 9 Oct 2020 16:06:33 +0000 (18:06 +0200)]
disk management: set more specific type for nvme

some users are confused, and it's nicer to have the more specific
type presented here.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agocode cleanup
Thomas Lamprecht [Fri, 9 Oct 2020 16:06:07 +0000 (18:06 +0200)]
code cleanup

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agofile_size_info: handle dangling symlinks
Fabian Grünbichler [Fri, 2 Oct 2020 11:55:15 +0000 (13:55 +0200)]
file_size_info: handle dangling symlinks

and other stat failure modes.

this method returns undef if 'qemu-img info ...' fails to return
information, so callers must handle this already.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
3 years agobump version to 6.2-8
Thomas Lamprecht [Fri, 2 Oct 2020 14:09:15 +0000 (16:09 +0200)]
bump version to 6.2-8

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agoPBS: use simple TCP ping for online check for now
Thomas Lamprecht [Fri, 2 Oct 2020 13:55:03 +0000 (15:55 +0200)]
PBS: use simple TCP ping for online check for now

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agoPBS: add support to specify port
Thomas Lamprecht [Fri, 2 Oct 2020 13:49:48 +0000 (15:49 +0200)]
PBS: add support to specify port

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agobump version to 6.2-7
Thomas Lamprecht [Tue, 29 Sep 2020 16:56:04 +0000 (18:56 +0200)]
bump version to 6.2-7

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agocheck for service exsitance before enabling zfs-import service
Thomas Lamprecht [Tue, 29 Sep 2020 15:33:13 +0000 (17:33 +0200)]
check for service exsitance before enabling zfs-import service

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agoDisks: instantiate import unit for created zpool
Stoiko Ivanov [Wed, 16 Sep 2020 12:14:19 +0000 (14:14 +0200)]
Disks: instantiate import unit for created zpool

When creating a new ZFS storage, also instantiate an import-unit for the pool.
This should help mitigate the case where some pools don't get imported during
boot, because they are not listed in an existing zpool.cache file.

This patch needs the corresponding addition of 'zfs-import@.service' in
the zfsonlinux repository.

Suggested-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
3 years agofix regression in zfs volume activation
Stoiko Ivanov [Tue, 29 Sep 2020 16:49:44 +0000 (18:49 +0200)]
fix regression in zfs volume activation

commit 815df2dd08ac4c7295135262e60d64fbb57b8f5c introduced a small issue
when activating linked clone volumes - the volname passed contains
basevol/subvol, which needs to be translated to subvol.

using the path method should be a robust way to get the actual path for
activation.

Found and tested by building the package as root (otherwise the zfs
regressiontests are skipped).

Reported-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
3 years agozfs pool: clean up use statements
Thomas Lamprecht [Tue, 29 Sep 2020 03:08:57 +0000 (05:08 +0200)]
zfs pool: clean up use statements

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agoZFS: mount subvols in activate_volume
Fabian Ebner [Mon, 28 Sep 2020 09:48:37 +0000 (11:48 +0200)]
ZFS: mount subvols in activate_volume

Makes it possible to clone and start a container whose
ZFS subvols are not yet mounted for some reason. If a
subvol cannot be mounted, there's a better error now:
zfs error: cannot mount '/myzpool/subvol-103-disk-0': directory is not empty

Previously, cloning would quietly do an "empty" clone,
and startup would fail with:
mount_autodev: 1074 Permission denied - Failed to create "/dev" directory
lxc_setup: 3238 Failed to mount "/dev"
do_start: 1224 Failed to setup container "103"
__sync_wait: 41 An error occurred in another process (expected sequence number 5)

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
3 years agozfs: rollback: improve error message
Fabian Grünbichler [Tue, 22 Sep 2020 06:56:13 +0000 (08:56 +0200)]
zfs: rollback: improve error message

we don't even know whether $snap exists at all, so the old variant could
be rather misleading..

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
3 years agozfs: handle unexpectedly missing snapshots better
Fabian Grünbichler [Tue, 22 Sep 2020 06:56:12 +0000 (08:56 +0200)]
zfs: handle unexpectedly missing snapshots better

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
3 years agofix indentation of $prune_backups_format
Thomas Lamprecht [Thu, 3 Sep 2020 16:21:09 +0000 (18:21 +0200)]
fix indentation of $prune_backups_format

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agoprune-backups: improve command description
Fabian Ebner [Mon, 31 Aug 2020 08:48:02 +0000 (10:48 +0200)]
prune-backups: improve command description

This is shown in the man page, so it's not important to mention
that this is a wrapper. Also mention the fact that the keep options
from the storage configuration serve as a fallback, which was previously
mentioned in the description of the (now removed) prune-backups parameter.

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
3 years agoprune-backups CLI: use keep-options directly
Fabian Ebner [Mon, 31 Aug 2020 08:48:01 +0000 (10:48 +0200)]
prune-backups CLI: use keep-options directly

Makes the interface cleaner; e.g. --keep-daily=2 instead of
--prune-backups=keep-daily=2

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
3 years agoprune_backups CLI: print different message when there's no backups at all
Fabian Ebner [Thu, 20 Aug 2020 11:50:10 +0000 (13:50 +0200)]
prune_backups CLI: print different message when there's no backups at all

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
3 years agoprune_backups: fix message
Fabian Ebner [Thu, 20 Aug 2020 11:50:09 +0000 (13:50 +0200)]
prune_backups: fix message

For prune selections, it doesn't matter what the current time is,
only the timestamps of the backups matter.

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
3 years agostorage_migrate: log bandwidth limit
Fabian Ebner [Wed, 29 Jul 2020 09:44:18 +0000 (11:44 +0200)]
storage_migrate: log bandwidth limit

and avoid undefined post-if declaration of @cstream.

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
3 years agobump version to 6.2-6
Thomas Lamprecht [Fri, 24 Jul 2020 17:10:06 +0000 (19:10 +0200)]
bump version to 6.2-6

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agopbs: check if encryption key could be deleted
Thomas Lamprecht [Fri, 24 Jul 2020 17:06:01 +0000 (19:06 +0200)]
pbs: check if encryption key could be deleted

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agoconfig: add hint for set encryption key, die on unlink error
Thomas Lamprecht [Fri, 24 Jul 2020 14:47:47 +0000 (16:47 +0200)]
config: add hint for set encryption key, die on unlink error

as else the API cannot easily know if this is set, it cannot check
with -f as the key is in a restricted area and we do not want that a
GET runs as protected.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agoAdd API and pvesm call for prune_backups
Fabian Ebner [Thu, 9 Jul 2020 12:45:43 +0000 (14:45 +0200)]
Add API and pvesm call for prune_backups

For the pvesm call use a wrapper and a --dry-run option to redirect
to the correct API call.

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
3 years agoAdd prune_backups to storage API
Fabian Ebner [Thu, 9 Jul 2020 12:45:42 +0000 (14:45 +0200)]
Add prune_backups to storage API

Implement it for generic storages supporting backups
(i.e. directory-based storages) and add a wrapper for PBS.

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
3 years agoIntroduce prune-backups property for directory-based storages
Fabian Ebner [Thu, 9 Jul 2020 12:45:41 +0000 (14:45 +0200)]
Introduce prune-backups property for directory-based storages

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
3 years agobump version to 6.2-5
Wolfgang Bumiller [Tue, 14 Jul 2020 11:58:44 +0000 (13:58 +0200)]
bump version to 6.2-5

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
3 years agopvesm: pass-through 'autogen' special value for encryption key
Wolfgang Bumiller [Tue, 14 Jul 2020 11:57:55 +0000 (13:57 +0200)]
pvesm: pass-through 'autogen' special value for encryption key

so that the on-update hook can handle its creation

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
3 years agofix another encryption_key vs encryption-key instance
Wolfgang Bumiller [Tue, 14 Jul 2020 11:51:26 +0000 (13:51 +0200)]
fix another encryption_key vs encryption-key instance

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
3 years agobump version to 6.2-4
Wolfgang Bumiller [Tue, 14 Jul 2020 11:45:29 +0000 (13:45 +0200)]
bump version to 6.2-4

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
3 years agoparam mapping fixup
Wolfgang Bumiller [Fri, 10 Jul 2020 08:52:45 +0000 (10:52 +0200)]
param mapping fixup

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
3 years agovdisk_list: skip scanning storages which cannot have images/rootdisks
Thomas Lamprecht [Thu, 9 Jul 2020 14:14:04 +0000 (16:14 +0200)]
vdisk_list: skip scanning storages which cannot have images/rootdisks

Do not try to scan (and thus activate) storages which aren't
configured to support (or cannot support) "vdisks" anyway.

Avoids seemingly strange failures of VM migrations due to a backup storage
not being currently online - even if that storage isn't referenced in
the VM config anywhere..

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agouse ssh -X for upload
Wolfgang Bumiller [Thu, 9 Jul 2020 13:00:38 +0000 (15:00 +0200)]
use ssh -X for upload

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
3 years agobump version to 6.2-3
Wolfgang Bumiller [Thu, 9 Jul 2020 13:00:10 +0000 (15:00 +0200)]
bump version to 6.2-3

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
3 years agoquick fixup for prune command in vzdump
Wolfgang Bumiller [Thu, 9 Jul 2020 12:50:13 +0000 (14:50 +0200)]
quick fixup for prune command in vzdump

This is a hack and we should get rid of `run_client_cmd` and
`run_raw_client_cmd` as an API entry!

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
3 years agobump version to 6.2-2
Thomas Lamprecht [Thu, 9 Jul 2020 12:03:33 +0000 (14:03 +0200)]
bump version to 6.2-2

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agod/control: depend on proxmox-backup-client
Thomas Lamprecht [Thu, 9 Jul 2020 10:34:51 +0000 (12:34 +0200)]
d/control: depend on proxmox-backup-client

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agopbs: activate_storage: query status to ensure we can connect
Thomas Lamprecht [Thu, 9 Jul 2020 09:54:13 +0000 (11:54 +0200)]
pbs: activate_storage: query status to ensure we can connect

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agopbs: allow to autogen an encryption key
Thomas Lamprecht [Thu, 9 Jul 2020 09:53:51 +0000 (11:53 +0200)]
pbs: allow to autogen an encryption key

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agopbs: rename encryption_key param to encryption-key
Thomas Lamprecht [Thu, 9 Jul 2020 09:53:27 +0000 (11:53 +0200)]
pbs: rename encryption_key param to encryption-key

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agopvesm: encryption key parameter should load files
Wolfgang Bumiller [Thu, 9 Jul 2020 08:25:44 +0000 (10:25 +0200)]
pvesm: encryption key parameter should load files

also `pvesm set` and `pvesm add` should behave the same with
respect to how configuration options are treated

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
3 years agorefactor sensitive parameter handling
Wolfgang Bumiller [Thu, 9 Jul 2020 08:25:43 +0000 (10:25 +0200)]
refactor sensitive parameter handling

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
3 years agopbs: encryption support, split "raw client command" API
Wolfgang Bumiller [Thu, 9 Jul 2020 08:25:42 +0000 (10:25 +0200)]
pbs: encryption support, split "raw client command" API

(And deprecate it...)

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
3 years agocifs: use more general name for password description
Thomas Lamprecht [Thu, 9 Jul 2020 08:34:53 +0000 (10:34 +0200)]
cifs: use more general name for password description

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agoarchive_info: relax custom name handling
Fabian Grünbichler [Wed, 8 Jul 2020 10:05:02 +0000 (12:05 +0200)]
archive_info: relax custom name handling

we already differentiate between standard and non-standard names anyway
and don't detect and return the VMID in the latter case anyway. drop it
from the RE as well to allow names like 'vzdump-qemu-template.vma.lzo'
without the need for a fake VMID.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
3 years agoarchive_info: use timelocal correctly
Fabian Ebner [Wed, 8 Jul 2020 08:22:19 +0000 (10:22 +0200)]
archive_info: use timelocal correctly

Because we always have 4-digit years, we can simply pass
the year itself to timelocal instead of subtracting 1900.
Like this it will also work for years not in the range 2000-2999.

See also:
https://perldoc.perl.org/Time/Local.html#Year-Value-Interpretation

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
3 years agobump version to 6.2-1
Thomas Lamprecht [Tue, 7 Jul 2020 17:23:58 +0000 (19:23 +0200)]
bump version to 6.2-1

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agofix #2460: use dm-uuid-mpath- as fallback for multipath
Mira Limbeck [Tue, 7 Jul 2020 14:14:54 +0000 (16:14 +0200)]
fix #2460: use dm-uuid-mpath- as fallback for multipath

With Debian Buster it looks like the 'scsi-' method is no longer
reliable. In addition to that, which is also used for non-multipath
systems, add the 'dm-uuid-mpath-' method as fallback. This is also used
by openstack (see os-brick
https://github.com/openstack/os-brick/blob/39b201160bbff39117fca46b2709ff3f74c53d80/os_brick/initiator/linuxscsi.py#L400)

Also sort the output of readdir so 'scsi-' is always after
'dm-uuid-mpath-' so the output of pvesm list does not change for systems
that worked before.

Signed-off-by: Mira Limbeck <m.limbeck@proxmox.com>
3 years agopbs: run_raw_client_cmd: fix typo, and drop repetive info
Thomas Lamprecht [Tue, 7 Jul 2020 08:14:00 +0000 (10:14 +0200)]
pbs: run_raw_client_cmd: fix typo, and drop repetive info

It would be s/bps/pbs/ but as we already have "proxmox-backup-client"
included in the log through the executable name, so it should be
clear that this is a PBS command - so drop that part entirely.

Now using:
> run: /usr/bin/proxmox-backup-client ...

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agoscan_cifs: fix scanning server with no SMB1 fallback
Thomas Lamprecht [Wed, 1 Jul 2020 13:33:14 +0000 (15:33 +0200)]
scan_cifs: fix scanning server with no SMB1 fallback

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agoscan cifs: fix passing "no pass" parameter
Thomas Lamprecht [Wed, 1 Jul 2020 10:17:02 +0000 (12:17 +0200)]
scan cifs: fix passing "no pass" parameter

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>