]> git.proxmox.com Git - pve-storage.git/log
pve-storage.git
2 years agostatus: add download_url method
Lorenz Stechauner [Tue, 22 Jun 2021 09:19:22 +0000 (11:19 +0200)]
status: add download_url method

uses common function PVE::Tools::download_file_from_url to download
iso files.

Only users with permissions `Sys.Audit` and `Sys.Modify` on `/` are
permitted to perform this action. This restriction is due to the
fact, that the download function is able to download files from
internal networks (which are not visible/accessible from outside).
Users with these permissions anyway have the means to alter node
(network) config, so this does not create any further security risk.

Signed-off-by: Lorenz Stechauner <l.stechauner@proxmox.com>
2 years agostatus: factoring out normalize_content_filename
Lorenz Stechauner [Tue, 22 Jun 2021 09:19:21 +0000 (11:19 +0200)]
status: factoring out normalize_content_filename

Signed-off-by: Lorenz Stechauner <l.stechauner@proxmox.com>
2 years agoapi: content: correctly handle warnings status for delayed task
Fabian Ebner [Wed, 12 May 2021 12:32:55 +0000 (14:32 +0200)]
api: content: correctly handle warnings status for delayed task

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agobtrfs: drop qcow2 and vmdk for now
Thomas Lamprecht [Wed, 23 Jun 2021 18:22:50 +0000 (20:22 +0200)]
btrfs: drop qcow2 and vmdk for now

the web-interface always prefers qcow2 once that is in the list,
itself a bug on it's own as the preferred one from the backend should
be preferred too, but still, vmdk support should not be extended we
can only cope with that in a limited way anyway, and both can always
get enabled later easily, if there's actual user-request for it.
Disabling is never that easy, at least if one cares about backward
compat.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agobtrfs: make NOCOW optional
Wolfgang Bumiller [Tue, 22 Jun 2021 12:18:23 +0000 (14:18 +0200)]
btrfs: make NOCOW optional

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2 years agobtrfs: add 'btrfs' import/export format
Wolfgang Bumiller [Tue, 22 Jun 2021 12:18:22 +0000 (14:18 +0200)]
btrfs: add 'btrfs' import/export format

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2 years agobump storage API: update import/export methods
Wolfgang Bumiller [Tue, 22 Jun 2021 12:18:21 +0000 (14:18 +0200)]
bump storage API: update import/export methods

Bumps APIVER to 9 and resets APIAGE to zero.

The import methods (volume_import, volume_import_formats):

These additionally get the '$snapshot' parameter which is
already present on the export side as an informational piece
to know which of the snapshots is the *current* one.
This parameter is inserted *in the middle* of the current
parameters, so the import & export format methods now have
the same signatures.
The current "disk" state will be set to this snapshot.
This, too, is required for our btrfs implementation.
  `volume_import_formats` can obviously not make much
*use* of this parameter, but it'll still be useful to know
that the information is actually available in the import
call, so its presence will be checked in the btrfs
implementation.

Currently this is intended to be used for btrfs send/recv
support, which in theory could also get additional metadata
similar to how we do the "tar+size" format, however, we
currently only really use this within this repository in
storage_migrate() which has this information readily
available anyway.

On the export side (volume_export, volume_export_formats):

The `$with_snapshots` option is now "defined" to be an
ordered array of snapshots to include, as a hint for
storages which need this. (As of the next commit this is
only btrfs, and only when also specifying a base snapshot,
which is a case we can currently not run into except on the
command line interface.)
  The current providers of the `with_snapshot` option will
still treat it as a boolean (since eg. for ZFS you cannot
really "skip" snapshots AFAIK).
  This is mainly intended for storages which do not have a
strong association between snapshots and the originals, or
an ordering (eg. btrfs and lvm-thin allow creating
arbitrary snapshot trees, and with btrfs you can even
create a "circular" connection between subvolumes, also we
could consider reflink based copies snapshots on xfs in
the future maybe?)

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2 years agoadd BTRFS storage plugin
Wolfgang Bumiller [Tue, 22 Jun 2021 12:18:20 +0000 (14:18 +0200)]
add BTRFS storage plugin

This is mostly the same as a directory storage, with 2 major
differences:

* 'subvol' volumes are actual btrfs subvolumes and therefore
  allow snapshots
* 'raw' files are placed *into* a subvolume and therefore
  also allow snapshots, the raw file for volume
  `btrstore:100/vm-100-disk-1.raw` can be found under
  `$path/images/100/vm-100-disk-1/disk.raw`
* in both cases, snapshots add an '@name' suffix to the
  subvolume's directory name, so snapshot 'foo' of the above
  would be found under
  `$path/images/100/vm-100-disk-1@foo/disk.raw`
  or for format "subvol":
  `$path/images/100/subvol-100-disk-1.subvol@foo`

Note that qgroups aren't included in btrfs-send streams,
therefore for now we will only be using *unsized* subvolumes
for containers and place a regular raw+ext4 file for sized
containers.
We could extend the import/export stream format to include
the information at the front (similar to how we do the
"tar+size" format, but we need to include the size of all
the contained snapshots as well, since they can technically
change). (But before enabling quotas we should do some
performance testing on bigger file systems with multiple
snapshots as there are quite a few reports of the fs slowing
down considerably in such scenarios).

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2 years agofactoring out regex for vztmpl
Lorenz Stechauner [Wed, 23 Jun 2021 13:10:15 +0000 (15:10 +0200)]
factoring out regex for vztmpl

stores the regex definition in PVE::Storage.

One test had to be adapted because it tested obsolete code. Namely:
it expects vztmpl to only end with .tar.gz, but the new regex also
includes .tar.xz, there is nothing against allowing .tar.xz files as
vztmpl files.

Signed-off-by: Lorenz Stechauner <l.stechauner@proxmox.com>
2 years agofile size info: return early if we cannot parse json
Thomas Lamprecht [Wed, 23 Jun 2021 06:25:20 +0000 (08:25 +0200)]
file size info: return early if we cannot parse json

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agofile/volume size info: add actual errors to untaint messages
Thomas Lamprecht [Wed, 23 Jun 2021 06:24:58 +0000 (08:24 +0200)]
file/volume size info: add actual errors to untaint messages

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agoplugins: untaint volume_size_info retuns
Stoiko Ivanov [Tue, 22 Jun 2021 16:39:54 +0000 (18:39 +0200)]
plugins: untaint volume_size_info retuns

the size returned by volume_size_info is used for creating the new
destination image in PVE::QemuServer::clone_disk (and probably
elsewhere). In certain cases the return values are tainted - they are
obtained by a run_command call and depending on the format and length
of the parsed output can still have their tainted attribute.

One example of a tainted return has been reported in our
community-forum:
https://forum.proxmox.com/threads/cannot-clone-vm-or-move-disk-with-more-than-13-snapshots.89628/

A qcow2 image with 13 snapshots generates a output > 4k in length from
`qemu-img info --output=json`, which in turn causes the output to be
considered tainted.

This patch untaints the returns where applicable. The other
storage-plugins are not affected:
* LVMPlugin returns a single number and a newline (thus gets untainted
  by run_command)
* RBDPlugin untaints the complete json before decoding
* ZFSPoolplugin and ISCSIDirectPlugin explicitly untaint their
  returns.

Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
2 years agotree-wide: fix typos with codespell
Thomas Lamprecht [Wed, 23 Jun 2021 06:07:20 +0000 (08:07 +0200)]
tree-wide: fix typos with codespell

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agopbs: fix typo
Fabian Grünbichler [Tue, 22 Jun 2021 11:44:06 +0000 (13:44 +0200)]
pbs: fix typo

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2 years agobump version to 7.0-3
Thomas Lamprecht [Mon, 21 Jun 2021 09:30:10 +0000 (11:30 +0200)]
bump version to 7.0-3

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agoconfig: prevent empty content list when content type 'none' is not supported
Fabian Ebner [Fri, 18 Jun 2021 10:59:36 +0000 (12:59 +0200)]
config: prevent empty content list when content type 'none' is not supported

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
2 years agovdisk_list: only scan storages with the correct content type(s)
Fabian Ebner [Fri, 18 Jun 2021 10:59:35 +0000 (12:59 +0200)]
vdisk_list: only scan storages with the correct content type(s)

The enabled check in the lower loop is now redundant and can be removed.

If storeid is provided, initialize the result hash accordingly, mainly for
backwards compatibility (needed by a caller in pve-manager's Ceph/Pools.pm and
the migration code in pve-container and qemu-server), but it also is less
surprising in general.

Remaining vdisk_list users that do not specify a content type are:
    1. pve-manager's Pool/Ceph.pm, but the content type for RBD can only be
       rootdir and images, so the storage is scanned (if enabled, same as
       before).
    2. pve-container migration
    3. qemu-server migration
For the latter two, it's planned to enforce content type, so the change is fine
too.

This also means that for iscsi(direct) plugins with content type 'none', i.e.
"use LUNs directly" does not return the list of images anymore, but that was
rather a bug anyways as they're not virtual disks then:
    0.0.0.scsi-36001405b8f2772e13a04b8e9390db13d
All of the remaining callers not using content types (see above) are fine with
that change too.

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
2 years agolvm: volume import: handle worker returned by free_image
Fabian Ebner [Tue, 4 May 2021 09:52:54 +0000 (11:52 +0200)]
lvm: volume import: handle worker returned by free_image

only affects LVM storages with 'saferemove 1' where the import fails at a rather
advanced stage. Previously in such cases, the renamed (by free_image) volume
del-vm-XYZ-disk-N would be left over.

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
2 years agopbs: free image: explicitly return undef
Fabian Ebner [Tue, 4 May 2021 09:52:53 +0000 (11:52 +0200)]
pbs: free image: explicitly return undef

Storage.pm's vdisk_free interprets truthy return values as worker subs, so be
explicit about returning undef here. Not an issue at the moment, because
run_client_command already returns undef, but better be safe than sorry.

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
2 years agoapi: status: sort index and add missing "file-restore"
Thomas Lamprecht [Mon, 21 Jun 2021 07:31:17 +0000 (09:31 +0200)]
api: status: sort index and add missing "file-restore"

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agoplugin loader: text-width cleanup
Thomas Lamprecht [Fri, 18 Jun 2021 16:33:20 +0000 (18:33 +0200)]
plugin loader: text-width cleanup

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agopostinst: remove old file if new one is identical
Fabian Ebner [Thu, 17 Jun 2021 08:58:26 +0000 (10:58 +0200)]
postinst: remove old file if new one is identical

Suggested-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
2 years agopostinst: avoid spawning subshell
Fabian Ebner [Thu, 17 Jun 2021 08:58:25 +0000 (10:58 +0200)]
postinst: avoid spawning subshell

which makes the continue not behave as intended.

Reported by shellcheck: SC2106: This [i.e. continue] only exits the subshell
caused by the (..) group

Also factor out long message for readability.

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
2 years agoapi: content/delete: die with newline to avoid addign file-context
Thomas Lamprecht [Wed, 16 Jun 2021 17:24:24 +0000 (19:24 +0200)]
api: content/delete: die with newline to avoid addign file-context

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agocephfs: update reminder for systemd_netmount removal
Fabian Ebner [Wed, 16 Jun 2021 07:27:00 +0000 (09:27 +0200)]
cephfs: update reminder for systemd_netmount removal

Commit d9ece228fbbbf0eb575c8a067a70ed7023078f84 introduced the workaround with
using systemd units and 25e222ca0d96a0da0d491e749b437d2822215e9e re-used the
functionality for fuse-mounts too.

The latter commit suggests to switch to using mount.fuse.ceph for the '_netdev'
option, but it doesn't seem to work:

 root@pve701 / # mount -t fuse.ceph 10.10.10.11,10.10.10.12,10.10.10.13:/ /mnttest/fuse -o 'ceph.id=admin,ceph.keyfile=/etc/pve/priv/ceph/cephfs.secret,ceph.conf=/etc/pve/ceph.conf,_netdev'
 ceph-fuse[20729]: starting ceph client
 2021-06-15T14:22:00.631+0200 7f995f878080 -1 init, newargv = 0x55e09fc11a40 newargc=11
 ceph-fuse[20729]: starting fuse
 root@pve701 / # mount -t ceph 10.10.10.11,10.10.10.12,10.10.10.13:/ /mnttest/normal -o 'name=admin,secretfile=/etc/pve/priv/ceph/cephfs.secret,conf=/etc/pve/ceph.conf,_netdev'
 root@pve701 / # mount | grep mnttest
 ceph-fuse on /mnttest/fuse type fuse.ceph-fuse (rw,nosuid,nodev,relatime,user_id=0,group_id=0,allow_other)
 10.10.10.11,10.10.10.12,10.10.10.13:/ on /mnttest/normal type ceph (rw,relatime,name=admin,secret=<hidden>,acl,_netdev)

Also, the return value is not propagated by mount.fuse.ceph, meaning the output
would need to be parsed...

 root@pve701 ~ # mount -t fuse.ceph 10.10.10.11,10.10.10.12,10.10.10.13:/ /mnttest/fuse -o 'ceph.id=admin,ceph.keyfile=/etc/pve/priv/ceph/cephfs.secret,ceph.conf=/etc/pve/ceph.conf,_netdev'
 2021-06-15T14:42:56.326+0200 7f634edae080 -1 init, newargv = 0x560cdb5e0a40 newargc=11
 ceph-fuse[34480]: starting ceph client
 fuse: mountpoint is not empty
 fuse: if you are sure this is safe, use the 'nonempty' mount option
 ceph-fuse[34480]: fuse failed to start
 2021-06-15T14:42:56.338+0200 7f634edae080 -1
 fuse_mount(mountpoint=/mnttest/fuse) failed.
 Mount failed with status code: 5
 root@pve701 ~ # echo $?
 0

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
2 years agocephfs: revert safe-guard check for Luminous
Fabian Ebner [Wed, 16 Jun 2021 07:26:59 +0000 (09:26 +0200)]
cephfs: revert safe-guard check for Luminous

It's necessary to be on Nautilus before upgrading to 7.x, so the check is no
longer needed. See commit e54c3e334760491954bc42f3585a8b5b136d4b1d. It didn't
cleanly revert, because there were cleanups made afterwards.

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
2 years agoconfig: add backup content type to default local storage
Fabian Ebner [Wed, 16 Jun 2021 07:26:58 +0000 (09:26 +0200)]
config: add backup content type to default local storage

which is used if there is no ('dir'-type) 'local' entry. Storage configurations
made by the installer also support backups for the 'local' storage, and the
'prune-backups' parameter is not really useful otherwise.

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
2 years agoconfig: mention that maxfiles is deprecated
Fabian Ebner [Wed, 16 Jun 2021 07:26:57 +0000 (09:26 +0200)]
config: mention that maxfiles is deprecated

Don't add an explicit deprecation warning on parsing (yet), this already done in
the pve6to7 script. Also, automatic conversion to 'prune-backups' happens when
the section config is read, so over time fewer users should be affected.
Postpone explicit warning/dropping the parameter to a future major release.

Also switch the setting for the default 'local' storage to 'prune-backups'.

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
2 years agopostinst: move cifs credential files into subdirectory upon update
Fabian Ebner [Wed, 16 Jun 2021 07:26:56 +0000 (09:26 +0200)]
postinst: move cifs credential files into subdirectory upon update

and drop the compat code.

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
2 years agofix find_free_disk_name invocations
Wolfgang Bumiller [Wed, 9 Jun 2021 13:18:46 +0000 (15:18 +0200)]
fix find_free_disk_name invocations

The interface takes the storeid now, not the image dir.

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2 years agoprune backups: activate storage
Fabian Ebner [Fri, 16 Apr 2021 08:51:27 +0000 (10:51 +0200)]
prune backups: activate storage

which also checks whether the storage is even enabled. VZDump jobs already
activate the storage, but more direct calls via API/CLI didn't do so yet.

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
2 years agodiskmanage: fix determining array length
Fabian Ebner [Mon, 14 Jun 2021 11:40:40 +0000 (13:40 +0200)]
diskmanage: fix determining array length

$#* is the last index, not the length.

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
2 years agoapi: get rid of moved 'usb' call
Fabian Ebner [Fri, 4 Jun 2021 13:49:33 +0000 (15:49 +0200)]
api: get rid of moved 'usb' call

pve-manger commit bd328734deb1dcea296858bb38d085e392adb99e changed the frontend
to use the new call.

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
2 years agobump version to 7.0-2
Thomas Lamprecht [Wed, 2 Jun 2021 14:32:23 +0000 (16:32 +0200)]
bump version to 7.0-2

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agodisks: fixup join usage
Thomas Lamprecht [Wed, 2 Jun 2021 12:19:53 +0000 (14:19 +0200)]
disks: fixup join usage

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agodisks: wipe blockdev: pass all child partitions to wipefs
Thomas Lamprecht [Wed, 2 Jun 2021 11:13:26 +0000 (13:13 +0200)]
disks: wipe blockdev: pass all child partitions to wipefs

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agodisks: wipe blockdev: improve variable locality/readability
Thomas Lamprecht [Wed, 2 Jun 2021 11:11:55 +0000 (13:11 +0200)]
disks: wipe blockdev: improve variable locality/readability

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agodisks: factor out stripping of /dev and cleanup vicinity
Thomas Lamprecht [Wed, 2 Jun 2021 11:10:10 +0000 (13:10 +0200)]
disks: factor out stripping of /dev and cleanup vicinity

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agoapi: add wipedisk call
Fabian Ebner [Fri, 23 Apr 2021 10:14:55 +0000 (12:14 +0200)]
api: add wipedisk call

Try to detect active mounts and holders early, because it's cheap. The wipefs
command in the worker will detect even more situations where wiping alone is
not enough for the device to show up as unused, or could otherwise be
problematic.

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
2 years agodiskmanage: add has_holder method
Fabian Ebner [Fri, 23 Apr 2021 10:14:54 +0000 (12:14 +0200)]
diskmanage: add has_holder method

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
2 years agodiskmanage: add is_mounted method
Fabian Ebner [Fri, 23 Apr 2021 10:14:53 +0000 (12:14 +0200)]
diskmanage: add is_mounted method

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
2 years agodiskmanage: factor out mounted_blockdevs helper
Fabian Ebner [Fri, 23 Apr 2021 10:14:52 +0000 (12:14 +0200)]
diskmanage: factor out mounted_blockdevs helper

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
2 years agodiskmanage: add wipe_blockdev method
Fabian Ebner [Fri, 23 Apr 2021 10:14:51 +0000 (12:14 +0200)]
diskmanage: add wipe_blockdev method

based on the wipe_disks method from pve-manager's Ceph/Tools.pm with the
following main differences:
    * use wipefs to wipe labels first (to avoid sgdisk complaining about the
      backed up GPT structure on a subsequent GPT initialization)
    * only take one device as an argument
    * do not use an absolute path for 'dd'
    * die if one of the command fails

The wipefs command makes checks and complains about e.g. mounted or active
devices. One could supply --force to wipefs, but in many such situations it
does not work as expected, because the device would still be detected as in-use
afterwards, and further manaual steps would be needed.

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
2 years agobump version to 7.0-1
Thomas Lamprecht [Wed, 12 May 2021 11:14:32 +0000 (13:14 +0200)]
bump version to 7.0-1

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agoremove some more DRBD references
Thomas Lamprecht [Wed, 12 May 2021 11:14:14 +0000 (13:14 +0200)]
remove some more DRBD references

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agobump version to 7.0-1
Thomas Lamprecht [Wed, 12 May 2021 11:01:45 +0000 (13:01 +0200)]
bump version to 7.0-1

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agod/control: bump standards version
Thomas Lamprecht [Mon, 10 May 2021 07:11:14 +0000 (09:11 +0200)]
d/control: bump standards version

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agod/control: increase compat level to 12
Thomas Lamprecht [Mon, 10 May 2021 07:10:57 +0000 (09:10 +0200)]
d/control: increase compat level to 12

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agod/control: update dependencies
Thomas Lamprecht [Mon, 10 May 2021 07:10:38 +0000 (09:10 +0200)]
d/control: update dependencies

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agoremove internal, unmaintained, DRBD plugin
Thomas Lamprecht [Mon, 10 May 2021 07:08:19 +0000 (09:08 +0200)]
remove internal, unmaintained, DRBD plugin

This was never marked stable and the recommended one is the external
version, which is maintained by linbit themselves.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agoiscsi: code cleanup
Thomas Lamprecht [Tue, 4 May 2021 10:02:47 +0000 (12:02 +0200)]
iscsi: code cleanup

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agoclone image: specify base format option with qemu-img
Fabian Ebner [Thu, 4 Feb 2021 10:26:06 +0000 (11:26 +0100)]
clone image: specify base format option with qemu-img

and avoid a warning. It is deprecated to auto-detect the format of the base
volume. See commit d9f059aa6cfccefaffa3532556e966df4a99ece2 in qemu for more
information.

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
3 years agobump version to 6.4-1
Thomas Lamprecht [Fri, 23 Apr 2021 14:18:47 +0000 (16:18 +0200)]
bump version to 6.4-1

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agod/control: depend on proxmox-backup-file-restore
Thomas Lamprecht [Fri, 23 Apr 2021 13:34:27 +0000 (15:34 +0200)]
d/control: depend on proxmox-backup-file-restore

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agod/control: bump versioned dependency for libpve-common-perl
Thomas Lamprecht [Fri, 23 Apr 2021 13:15:54 +0000 (15:15 +0200)]
d/control: bump versioned dependency for libpve-common-perl

for the new file-restore helpers in PBSClient which we use in the API
here.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agofile-restore: pass in volume ID or name
Fabian Grünbichler [Fri, 23 Apr 2021 10:34:26 +0000 (12:34 +0200)]
file-restore: pass in volume ID or name

instead of just the snapshot for consistency with other API endpoints,
and possible future extension to VMA backups (where 'snapshot' would be
a rather strange terminology).

add some additional checks (pbs storage type, backup volume type),
completion and magic (allow passing in either a full volume ID with
correct storage, or just the volume name, or just the snapshot for
easier API/CLI usage/convenience).

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
3 years agofile-restore: return perl-y booleans
Fabian Grünbichler [Fri, 23 Apr 2021 10:34:25 +0000 (12:34 +0200)]
file-restore: return perl-y booleans

like we do in most of our API.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
3 years agoadd FileRestore API for PBS
Stefan Reiter [Thu, 22 Apr 2021 15:34:54 +0000 (17:34 +0200)]
add FileRestore API for PBS

Includes list and restore calls.

Requires VM.Backup and Datastore.Audit permissions, for the accessed
VM/CT and containing datastore respectively.

Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
3 years agoapi: fix typo in error message
Fabian Grünbichler [Fri, 23 Apr 2021 10:23:18 +0000 (12:23 +0200)]
api: fix typo in error message

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
3 years agopbs: allow setting up a master key
Fabian Grünbichler [Mon, 8 Feb 2021 13:08:34 +0000 (14:08 +0100)]
pbs: allow setting up a master key

similar to the existing encryption key handling, but without
auto-generation since we only have the public part here.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
3 years agorbd: fix typo in error message
Fabian Ebner [Tue, 20 Apr 2021 08:14:01 +0000 (10:14 +0200)]
rbd: fix typo in error message

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
3 years agodiskmanage: get_partnum: fix check
Fabian Ebner [Tue, 20 Apr 2021 12:07:50 +0000 (14:07 +0200)]
diskmanage: get_partnum: fix check

Not replacing it with return, because the current behavior is dying:
    Can't "next" outside a loop block
and the single existing caller in pve-manager's API2/Ceph/OSD.pm does not check
the return value.

Also check for $st, which can be undefined in case a non-existing path was
provided. This also led to dying previously:
    Can't call method "mode" on an undefined value

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
3 years agodiskmanage: improve setting usage for whole disk with include-partitions
Fabian Ebner [Fri, 16 Apr 2021 10:34:50 +0000 (12:34 +0200)]
diskmanage: improve setting usage for whole disk with include-partitions

in case a disk with partitions also has an fstype set, which happens for our ZFS
boot disks. Do not change the behavior without include-partitons, as we
prefer(red) to be more specific than simply 'partitions' then.

Reported in the enterprise support channel.

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
3 years agoimport: allow import from UNIX socket
Fabian Grünbichler [Tue, 13 Apr 2021 12:16:33 +0000 (14:16 +0200)]
import: allow import from UNIX socket

this allows forwarding over websockets without requiring a (free) port.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
3 years agobump version to 6.3-9
Thomas Lamprecht [Mon, 12 Apr 2021 14:14:36 +0000 (16:14 +0200)]
bump version to 6.3-9

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agotest: rbd: improve usage output
Thomas Lamprecht [Mon, 12 Apr 2021 13:43:42 +0000 (15:43 +0200)]
test: rbd: improve usage output

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agotest: rbd: typo fix
Thomas Lamprecht [Mon, 12 Apr 2021 13:27:14 +0000 (15:27 +0200)]
test: rbd: typo fix

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agotest: rbd: indendation cleanup, allow -d short-opt for debug
Thomas Lamprecht [Mon, 12 Apr 2021 13:26:59 +0000 (15:26 +0200)]
test: rbd: indendation cleanup, allow -d short-opt for debug

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agotest: rbd: actually use debug helper
Thomas Lamprecht [Mon, 12 Apr 2021 13:26:34 +0000 (15:26 +0200)]
test: rbd: actually use debug helper

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agovolume export/import: allow uppercase letters
Fabian Ebner [Mon, 12 Apr 2021 11:37:15 +0000 (13:37 +0200)]
volume export/import: allow uppercase letters

Bug reported in the community forum[0].

Currently, it's possible to break replication by:
1. have an existing snapshot whose name contains an uppercase letter
2. set up a replication job and run it
3. rollback to the existing snapshot
4. replicate again -> fails

The failure occurs, because after step 3, the most recent common snapshot is the
previously existing one and currently no uppercase letters are allowed for
export/import.

The pve-snapshot-name option uses the CONFIGID_RE
    qr/[a-z][a-z0-9_-]+/i
so it cannot be used here, because it would not allow for e.g. '__migrate__'.
Simply allow uppercase letters, to be backwards compatible and allow all
possible pve-snapshot-name values.

There is still an issue if there also was state volume, but that's a different
bug[1].

[0]: https://forum.proxmox.com/threads/solved-migration-error-base-value-does-not-match-the-regex-pattern.85946/
[1]: https://bugzilla.proxmox.com/show_bug.cgi?id=3111

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
3 years agotests: rbd ns: exit cleanly on help, and allow short-opt -h
Thomas Lamprecht [Mon, 12 Apr 2021 12:46:12 +0000 (14:46 +0200)]
tests: rbd ns: exit cleanly on help, and allow short-opt -h

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agotests: rbd ns: avoid underscore in CLI param name
Thomas Lamprecht [Mon, 12 Apr 2021 12:42:38 +0000 (14:42 +0200)]
tests: rbd ns: avoid underscore in CLI param name

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agofix #3345: zfs: restore container volume to ZFS with size 0
Aaron Lauterer [Fri, 9 Apr 2021 15:10:25 +0000 (17:10 +0200)]
fix #3345: zfs: restore container volume to ZFS with size 0

A restore to ZFS for a container which has a volume (rootfs / mount
point) of size 0 failed because the refquota property does not accept
'0k' but wants 'none' in that situation.

Signed-off-by: Aaron Lauterer <a.lauterer@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agorbd: make volume param for get_rbd_path to allow further use
Thomas Lamprecht [Fri, 9 Apr 2021 12:19:48 +0000 (14:19 +0200)]
rbd: make volume param for get_rbd_path to allow further use

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agorbd: list images: early return to avoid indentation
Thomas Lamprecht [Fri, 9 Apr 2021 11:51:15 +0000 (13:51 +0200)]
rbd: list images: early return to avoid indentation

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agorbd: list images: sort by keys when pushing on result array
Thomas Lamprecht [Fri, 9 Apr 2021 11:49:56 +0000 (13:49 +0200)]
rbd: list images: sort by keys when pushing on result array

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agorbd: indentation and whitespace cleanups
Thomas Lamprecht [Fri, 9 Apr 2021 11:48:27 +0000 (13:48 +0200)]
rbd: indentation and whitespace cleanups

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agorbd: get kernel device sub returns a path, not a name
Thomas Lamprecht [Fri, 9 Apr 2021 11:45:17 +0000 (13:45 +0200)]
rbd: get kernel device sub returns a path, not a name

also transform to private sub instead of local variable closure.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agorbd: consistent closure call style
Thomas Lamprecht [Fri, 9 Apr 2021 11:42:23 +0000 (13:42 +0200)]
rbd: consistent closure call style

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agorbd: build cmd: allow "falsy" namespace value also here
Thomas Lamprecht [Fri, 9 Apr 2021 11:40:13 +0000 (13:40 +0200)]
rbd: build cmd: allow "falsy" namespace value also here

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agorbd: use private sub for get_rbd_path
Thomas Lamprecht [Fri, 9 Apr 2021 11:39:32 +0000 (13:39 +0200)]
rbd: use private sub for get_rbd_path

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agorbd: add integration test for namespace handling
Aaron Lauterer [Wed, 7 Apr 2021 14:22:18 +0000 (16:22 +0200)]
rbd: add integration test for namespace handling

This test is intended to be run on a hyperconverged PVE cluster to test
the most common operations of VMs using a namespaced Ceph RBD pool.

Signed-off-by: Aaron Lauterer <a.lauterer@proxmox.com>
3 years agorbd: fix #3286 add namespace support
Aaron Lauterer [Wed, 7 Apr 2021 14:22:17 +0000 (16:22 +0200)]
rbd: fix #3286 add namespace support

This patch introduces support for Cephs RBD namespaces.

A new storage config parameter 'namespace' defines the namespace to be
used for the RBD storage.

The namespace must already exist in the Ceph cluster as it is not
automatically created.

The main intention is to use this for external Ceph clusters. With
namespaces, each PVE cluster can get its own namespace and will not
conflict with other PVE clusters.

Signed-off-by: Aaron Lauterer <a.lauterer@proxmox.com>
3 years agorbd: centralize rbd path concatenation
Aaron Lauterer [Wed, 7 Apr 2021 14:22:16 +0000 (16:22 +0200)]
rbd: centralize rbd path concatenation

The <pool>/<image> paths are needed in quite a lot of places. Having one
single place where they are created helps to reduce duplicate code and
makes it easier to introduce new features.

The 'add_pool_to_disk' sub was already doing that but the name was not
really fitting. This commit renames it to the more general
'get_rbd_path' and changes the second parameter to the more widely used
$volume instead of $disk.

Furthermore, all occurences where "$pool/$volume" has been concatenated
have been replaced with a call to get_rbd_path.

Plus some minor code style cleanups for long function calls that were
touched.

Signed-off-by: Aaron Lauterer <a.lauterer@proxmox.com>
3 years agoprune backups: improve internal errors messages slightly
Thomas Lamprecht [Fri, 9 Apr 2021 10:49:55 +0000 (12:49 +0200)]
prune backups: improve internal errors messages slightly

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agoplugin: get_subdir_files: add comment
Thomas Lamprecht [Fri, 9 Apr 2021 10:46:46 +0000 (12:46 +0200)]
plugin: get_subdir_files: add comment

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agoprune backups: make vmid filtering more robust
Fabian Ebner [Wed, 7 Apr 2021 10:25:37 +0000 (12:25 +0200)]
prune backups: make vmid filtering more robust

by relying on archive_info's vmid first. archive_info is already used to
determine if it's a standard name, and in that case the vmid is certainly set.

Also add asserts to make sure we got what we expected.

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
3 years agoplugin: subdir files: backup: don't match for vmid against the full path
Fabian Ebner [Wed, 7 Apr 2021 10:25:36 +0000 (12:25 +0200)]
plugin: subdir files: backup: don't match for vmid against the full path

Only match against the file name to avoid false positives with
directory names containing "-$vmid-".

Found while trying to debug/reproduce a forum thread[0], but the path
there should not be affected by this...

[0]: https://forum.proxmox.com/threads/vzdump-removing-too-many-backups.87072/

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
3 years agobump version to 6.3-8
Thomas Lamprecht [Thu, 1 Apr 2021 13:04:16 +0000 (15:04 +0200)]
bump version to 6.3-8

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agoOptionally allow blockdev in abs_filesystem_path
Dominic Jäger [Fri, 26 Mar 2021 12:32:25 +0000 (13:32 +0100)]
Optionally allow blockdev in abs_filesystem_path

This is required to import from LVM storages, for example

Signed-off-by: Dominic Jäger <d.jaeger@proxmox.com>
3 years agofix #3348: NFS: select correct transport to check for service
Fabian Ebner [Wed, 17 Mar 2021 12:49:42 +0000 (13:49 +0100)]
fix #3348: NFS: select correct transport to check for service

Suggested-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
3 years agofix #3363: avoid undef-warning for PBS crypt-mode
Fabian Grünbichler [Wed, 24 Mar 2021 12:24:41 +0000 (13:24 +0100)]
fix #3363: avoid undef-warning for PBS crypt-mode

it is optional after all, and missing (/None) for files stored in the
snapshot dir but not referenced in the manifest for whatever reason.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
3 years agovdisk list: allow specifying content type
Fabian Ebner [Mon, 22 Mar 2021 14:32:41 +0000 (15:32 +0100)]
vdisk list: allow specifying content type

and only scan storages that support it if specified.

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
3 years agoRevert "vdisk list: only collect images from storages with an appropriate content...
Fabian Ebner [Mon, 22 Mar 2021 14:32:40 +0000 (15:32 +0100)]
Revert "vdisk list: only collect images from storages with an appropriate content type"

This reverts commit a44c18925d223a971296801a0985db34707ada4d and adds a reminder
comment.

The mentioned commit is actually a backwards-incompatible change that leads to
slightly different behavior when migrating a VM with volumes on a misconfigured
storage. For example, unreferenced volumes on a misconfigured storage won't be
picked up, even though they were before. And for referenced volumes on a
misconfigured storage, the disk size would not be updated on migration anymore.

We should wait until the next major release for this change and then also
re-evaluate the migration behavior with misconfigured disks.

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
3 years agofix #3354: support notes on ceph backups
Dylan Whyte [Fri, 19 Mar 2021 13:58:15 +0000 (14:58 +0100)]
fix #3354: support notes on ceph backups

use DirPlugin's get/update_volume_notes implementation (which all the
other supported file systems use)

Signed-off-by: Dylan Whyte <d.whyte@proxmox.com>
3 years agotests: zfs: complain when a first sub-test dies
Fabian Ebner [Fri, 12 Mar 2021 09:50:27 +0000 (10:50 +0100)]
tests: zfs: complain when a first sub-test dies

Previously, $count was not increased and no test failure was reported.

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
3 years agovdisk list: only collect images from storages with an appropriate content type
Fabian Ebner [Fri, 12 Mar 2021 09:50:26 +0000 (10:50 +0100)]
vdisk list: only collect images from storages with an appropriate content type

Only these storages are activated in the first place, and it's bad behavior to
list images when no appropriate content type is not set.

For example, on VM destruction, this avoids unreferenced images to be deleted
from a storage with only 'backup' content type set, which is supposedly what
happened in this[0] forum thread.

(Some) callers expect all keys to be present and valid array references in the
result, so initialization is needed.

Now, the enabled check is already done by the preceding code for every element
that is iterated over, and thus isn't needed in the main loop anymore.

[0]: https://forum.proxmox.com/threads/erasing-all-vm-disks-after-a-failed-vm-migration-task.85068

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
3 years agoapi: disk list: allow if an audit permission for the node is present
Fabian Ebner [Wed, 10 Mar 2021 09:26:27 +0000 (10:26 +0100)]
api: disk list: allow if an audit permission for the node is present

as that seems to be the more natural permission path for listing a nodes local
disks. For backwards compatibility, the old permission check has to be kept
(relevant with propagate=0).

This API call was originally part of the Ceph API and got copied here later,
which might explain the current permission check.

In the UI, the Disk panel is visible with a node audit permission, but the API
call itself failed without the '/' audit permission.

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
3 years agod/control: record pve-qemu-kvm | qemu-utils build depenency for tests
Thomas Lamprecht [Tue, 2 Mar 2021 16:20:57 +0000 (17:20 +0100)]
d/control: record pve-qemu-kvm | qemu-utils build depenency for tests

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agodisks: zfs: scan is only returned optionally
Stoiko Ivanov [Thu, 25 Feb 2021 21:23:04 +0000 (22:23 +0100)]
disks: zfs: scan is only returned optionally

the line is not present if a zpool has never been scrubbed before
(e.g. if it's freshly setup)

Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>