]> git.proxmox.com Git - pve-storage.git/log
pve-storage.git
3 years agoExtend archive_info to include filename and logfilename
Fabian Ebner [Tue, 30 Jun 2020 08:24:18 +0000 (10:24 +0200)]
Extend archive_info to include filename and logfilename

Only expect the logfilename if the archive has a standard name.
This also gives a mechanism to get an untainted filename.

archive_info can take either a volume ID or a path as it's
currently implemented. This is useful for vzdump when there
is no storage (i.e. for 'vzdump --dumpdir'). Add a test case for this.

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
3 years agoWhitespace cleanup
Fabian Ebner [Tue, 30 Jun 2020 08:24:22 +0000 (10:24 +0200)]
Whitespace cleanup

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
3 years agoFix 2763: Revert "storage_migrate: check if target storage supports content type"
Fabian Ebner [Mon, 25 May 2020 07:41:58 +0000 (09:41 +0200)]
Fix 2763: Revert "storage_migrate: check if target storage supports content type"

This reverts commit 95015dbbf24b710011965805e689c03923fb830c.

parse_volname always gives 'images' and not 'rootdir'. In most
cases the volume name alone does not contain the needed information,
e.g. vm-123-disk-0 can be both a VM volume or a container volume.

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
3 years agodoc: Clarify that pvesm export is mostly internal
Dominic Jäger [Tue, 2 Jun 2020 09:56:49 +0000 (11:56 +0200)]
doc: Clarify that pvesm export is mostly internal

3 years agobase plugin: fall back to empty hash to avoid checking archive info definedness
Thomas Lamprecht [Sat, 6 Jun 2020 17:40:06 +0000 (19:40 +0200)]
base plugin: fall back to empty hash to avoid checking archive info definedness

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agoExpand archive_info to include ctime, vmid and is_std_name
Fabian Ebner [Thu, 4 Jun 2020 09:08:34 +0000 (11:08 +0200)]
Expand archive_info to include ctime, vmid and is_std_name

where 'is_std_name' shows whether the backup name uses the standard naming
schema and most likely was created by our tools.

Also adds a '^' to the existing filename matching regex, which
should be fine since basename() is used beforehand.

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
3 years agoPBSPlugin: list_volumes: filter by vmid if specified
Fabian Ebner [Thu, 4 Jun 2020 09:08:33 +0000 (11:08 +0200)]
PBSPlugin: list_volumes: filter by vmid if specified

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
3 years agofix #2777 create zpools with stable dev paths
Stoiko Ivanov [Fri, 5 Jun 2020 13:24:56 +0000 (15:24 +0200)]
fix #2777 create zpools with stable dev paths

when compiling the disk list add a property with a stable
/dev/disk/by-id/ path for a block device when available.

This is needed to create zpools with the stable by-id links

The /dev/disk/by-id/ directory can contain multiple links to the same device
(e.g. when it's used as a LVM PV, or one for the wwn/nvme-eui in addition
to the one with vendor and serial). We take the first one which matches
the bus where the disk is attached. For nvme disks we exclude the one
containing the nvme-eui.

The patch assumes that not all disks need to have such a link (e.g.
virtio-block devices as we pass them to guests).

Additionally the tests were adapted to run successfully.

Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
3 years agoPBSPlugin.pm: avoid ascii-art in proxmox-backup-client output
Dietmar Maurer [Wed, 3 Jun 2020 09:07:01 +0000 (11:07 +0200)]
PBSPlugin.pm: avoid ascii-art in proxmox-backup-client output

3 years agoceph: get_local_version: allow optional v prefix for version number
Thomas Lamprecht [Fri, 22 May 2020 16:50:06 +0000 (18:50 +0200)]
ceph: get_local_version: allow optional v prefix for version number

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agobump version to 6.1-8
Thomas Lamprecht [Fri, 15 May 2020 17:41:25 +0000 (19:41 +0200)]
bump version to 6.1-8

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agotests: re-add virt "none" negative test
Thomas Lamprecht [Fri, 15 May 2020 17:32:21 +0000 (19:32 +0200)]
tests: re-add virt "none" negative test

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agoarchive info: keep some basic strictness
Thomas Lamprecht [Fri, 15 May 2020 17:18:22 +0000 (19:18 +0200)]
archive info: keep some basic strictness

we want to enforce at least the strictness that our tools can do
something with a backup archive..

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agoarchive info: include archive name in error message
Thomas Lamprecht [Fri, 15 May 2020 17:13:37 +0000 (19:13 +0200)]
archive info: include archive name in error message

so that we have some context if users report issues with it..

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agotests: archive info: avoid assembling arrays to just de-assemble them directly
Thomas Lamprecht [Fri, 15 May 2020 17:11:48 +0000 (19:11 +0200)]
tests: archive info: avoid assembling arrays to just de-assemble them directly

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agotests: archive info: make deterministic
Thomas Lamprecht [Fri, 15 May 2020 17:10:21 +0000 (19:10 +0200)]
tests: archive info: make deterministic

nothing worse than jumping test results due to not sorting the tests
and thus making discussions harder (which test # failed) and it may
imply another error by mistake.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agotests: archive info: code cleanup
Thomas Lamprecht [Fri, 15 May 2020 16:57:37 +0000 (18:57 +0200)]
tests: archive info: code cleanup

We could also do a hash array slice, like:
> my ($archive, $expected, $description) = $tt->@{'archive', 'expected', 'description'};

But as none are optional lets just access values directly..

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agostorage: archive/extract code cleanup
Thomas Lamprecht [Fri, 15 May 2020 16:46:11 +0000 (18:46 +0200)]
storage: archive/extract code cleanup

* run_command is already imported, use that fact
* avoid useless comments just describing what the code tells one
  anyway
* restructure a few parts to more concise/easier to read
  implementation.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agoFix: backup: relax file name matching regex
Alwin Antreich [Tue, 12 May 2020 15:12:13 +0000 (17:12 +0200)]
Fix: backup: relax file name matching regex

The rework of the backup file detection logic missed the non-standard
file name case. This patch allows to restore backups with different file
names. Though the config extraction fails, since the type is unknown.

Signed-off-by: Alwin Antreich <a.antreich@proxmox.com>
3 years agoFix #2737: Can't call method "mode"
Alwin Antreich [Wed, 13 May 2020 15:18:47 +0000 (17:18 +0200)]
Fix #2737: Can't call method "mode"

on an undefined value at /usr/share/perl5/PVE/Storage/Plugin.pm line 928

This error message crops up when a file is deleted after getting the
file list and before the loop passed the file entry.

Signed-off-by: Alwin Antreich <a.antreich@proxmox.com>
3 years agobump version to 6.1-7
Fabian Grünbichler [Mon, 4 May 2020 12:03:51 +0000 (14:03 +0200)]
bump version to 6.1-7

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
3 years agotest: force ctime to UTC
Fabian Grünbichler [Mon, 4 May 2020 09:10:56 +0000 (11:10 +0200)]
test: force ctime to UTC

otherwise this test fails depending on TZ of the testing system

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
3 years agotest: filesystem_path
Alwin Antreich [Tue, 28 Apr 2020 13:58:25 +0000 (15:58 +0200)]
test: filesystem_path

Signed-off-by: Alwin Antreich <a.antreich@proxmox.com>
3 years agotest: get_subdir
Alwin Antreich [Tue, 28 Apr 2020 13:58:24 +0000 (15:58 +0200)]
test: get_subdir

Co-Authored-by: Dominic Jaeger <d.jaeger@proxmox.com>
Signed-off-by: Alwin Antreich <a.antreich@proxmox.com>
3 years agoFix: #2124 storage: add zstd support
Alwin Antreich [Tue, 28 Apr 2020 13:58:23 +0000 (15:58 +0200)]
Fix: #2124 storage: add zstd support

Signed-off-by: Alwin Antreich <a.antreich@proxmox.com>
3 years agobackup: compact regex for backup file filter
Alwin Antreich [Tue, 28 Apr 2020 13:58:22 +0000 (15:58 +0200)]
backup: compact regex for backup file filter

the more compact form of the regex should allow easier addition of new
file extensions.

Signed-off-by: Alwin Antreich <a.antreich@proxmox.com>
3 years agoFix: add missing snippets subdir
Alwin Antreich [Tue, 28 Apr 2020 13:58:21 +0000 (15:58 +0200)]
Fix: add missing snippets subdir

since it is a valid content type and adapt the path_to_volume_id_test.
Also adds an extra check if all vtype_subdirs are returned.

Signed-off-by: Alwin Antreich <a.antreich@proxmox.com>
3 years agoFix: path_to_volume_id returned wrong content
Alwin Antreich [Tue, 28 Apr 2020 13:58:20 +0000 (15:58 +0200)]
Fix: path_to_volume_id returned wrong content

type for backup files. Patch includes changes of the test as well.

Signed-off-by: Alwin Antreich <a.antreich@proxmox.com>
3 years agotest: path_to_volume_id
Alwin Antreich [Tue, 28 Apr 2020 13:58:19 +0000 (15:58 +0200)]
test: path_to_volume_id

Test to reduce the potential for accidental breakage on regex changes.

Signed-off-by: Alwin Antreich <a.antreich@proxmox.com>
3 years agoFix: backup: ctime was from stat not file name
Alwin Antreich [Tue, 28 Apr 2020 13:58:18 +0000 (15:58 +0200)]
Fix: backup: ctime was from stat not file name

The vzdump file was passed with the full path to the regex. That regex
captures the time from the file name, to calculate the epoch.

As the regex didn't match, the ctime from stat was taken instead. This
resulted in the ctime shown when the file was changed, not when the
backup was made.

Signed-off-by: Alwin Antreich <a.antreich@proxmox.com>
3 years agotest: list_volumes
Alwin Antreich [Tue, 28 Apr 2020 13:58:17 +0000 (15:58 +0200)]
test: list_volumes

Test to reduce the potential for accidental breakage on regex changes.

Co-Authored-by: Dominic Jaeger <d.jaeger@proxmox.com>
Signed-off-by: Alwin Antreich <a.antreich@proxmox.com>
3 years agotest: parse_volname
Alwin Antreich [Tue, 28 Apr 2020 13:58:16 +0000 (15:58 +0200)]
test: parse_volname

Test to reduce the potential for accidental breakage on regex changes.
And to make sure that all vtype_subdirs are parsed.

Signed-off-by: Alwin Antreich <a.antreich@proxmox.com>
3 years agostorage: replace build-in stat occurrences
Alwin Antreich [Tue, 28 Apr 2020 13:58:15 +0000 (15:58 +0200)]
storage: replace build-in stat occurrences

with File::stat::stat to minimize variable declarations. And allow to
mock this method in tests instead of the perl build-in stat.

Signed-off-by: Alwin Antreich <a.antreich@proxmox.com>
3 years agostorage: test: split archive format/compressor
Alwin Antreich [Tue, 28 Apr 2020 13:58:13 +0000 (15:58 +0200)]
storage: test: split archive format/compressor

detection into separate functions so they are reusable and easier
modifiable. This patch also adds the test for archive_info.

Signed-off-by: Alwin Antreich <a.antreich@proxmox.com>
4 years agos/ceph_version/local_ceph_version/ for clarity
Thomas Lamprecht [Sat, 25 Apr 2020 09:37:26 +0000 (11:37 +0200)]
s/ceph_version/local_ceph_version/ for clarity

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
4 years agod/control: bump ceph dependency to 12.2
Thomas Lamprecht [Sat, 25 Apr 2020 09:27:30 +0000 (11:27 +0200)]
d/control: bump ceph dependency to 12.2

A newer than the Luminous version is shipped with buster, and our
ceph repos are on Nautilus (14.2) in PVE 6.

Allows to drop a check for really old ceph versions (< 10, so
Infernalis and older).

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
4 years agofollowup: only parse version if required, fix whitespace error
Thomas Lamprecht [Sat, 25 Apr 2020 09:18:03 +0000 (11:18 +0200)]
followup: only parse version if required, fix whitespace error

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
4 years agoFix #2705: cephfs: mount fails with bad option
Alwin Antreich [Fri, 24 Apr 2020 15:29:47 +0000 (17:29 +0200)]
Fix #2705: cephfs: mount fails with bad option

dmesg: libceph: bad option at 'conf=/etc/pve/ceph.conf'

After the upgrade to PVE 6 with Ceph Luminous, the mount.ceph helper
doesn't understand the conf= option yet. And the CephFS mount with the
kernel client fails. After upgrading to Ceph Nautilus the option exists
in the mount.ceph helper.

Signed-off-by: Alwin Antreich <a.antreich@proxmox.com>
4 years agoconfig: add missing whitespace
Thomas Lamprecht [Sat, 25 Apr 2020 09:12:48 +0000 (11:12 +0200)]
config: add missing whitespace

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
4 years agofix nvme wearout parsing
Dominik Csapak [Tue, 14 Apr 2020 14:17:33 +0000 (16:17 +0200)]
fix nvme wearout parsing

the '.*' was greedy, also consuming all but one digits of the real percentage

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
switch to \s* instead of .*?, to prevent mis-interpreting potential
strings like '< 50%' or '0-50%'

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
4 years agodisk_tests: improve nvme smart test
Dominik Csapak [Tue, 14 Apr 2020 14:17:32 +0000 (16:17 +0200)]
disk_tests: improve nvme smart test

by using an actual percentage for 'Percentage Used' instead of 0%

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
4 years agoAdd comment for volume_has_feature
Fabian Ebner [Wed, 8 Apr 2020 11:40:07 +0000 (13:40 +0200)]
Add comment for volume_has_feature

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
4 years agoZFS: use -p flag where possible
Aaron Lauterer [Tue, 7 Apr 2020 12:25:37 +0000 (14:25 +0200)]
ZFS: use -p flag where possible

Signed-off-by: Aaron Lauterer <a.lauterer@proxmox.com>
4 years agoZFS: use -p flag and remove zfs_parse_size
Aaron Lauterer [Tue, 7 Apr 2020 12:25:36 +0000 (14:25 +0200)]
ZFS: use -p flag and remove zfs_parse_size

ZFS supports the -p flag in the list command since a few years now.
Let us use the real byte values and avoid the error prone calculation
from human readable numbers that can lead to incorrect numbers if the
reported human readable value is a rounded number.

Signed-off-by: Aaron Lauterer <a.lauterer@proxmox.com>
4 years agoZFSPoolPlugin: fix #2662 get volume size correctly
Aaron Lauterer [Tue, 7 Apr 2020 12:25:35 +0000 (14:25 +0200)]
ZFSPoolPlugin: fix #2662 get volume size correctly

Getting the volume sizes as byte values instead of converted to human
readable units helps to avoid rounding errors in the further processing
if the volume size is more on the odd side.

The `zfs list` command supports the -p(arseable) flag since a few years
now.
When returning the size in bytes there is no  calculation performed and
thus we need to explicitly cast the size to an integer before returning
it.

Signed-off-by: Aaron Lauterer <a.lauterer@proxmox.com>
4 years agobump version to 6.1-6
Fabian Grünbichler [Thu, 9 Apr 2020 06:43:17 +0000 (08:43 +0200)]
bump version to 6.1-6

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
4 years agod/control: wrap-and-sort
Fabian Grünbichler [Thu, 9 Apr 2020 06:38:31 +0000 (08:38 +0200)]
d/control: wrap-and-sort

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
4 years agod/control: break consumers of storage_migrate
Fabian Grünbichler [Thu, 9 Apr 2020 06:38:04 +0000 (08:38 +0200)]
d/control: break consumers of storage_migrate

since we changed the signature, and want to ensure smooth upgrades.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
4 years agostorage_migrate: add volname_for_storage helper
Fabian Ebner [Wed, 8 Apr 2020 09:25:14 +0000 (11:25 +0200)]
storage_migrate: add volname_for_storage helper

to guess a valid volname for a targetstorage of a different type.
This makes it possible to migrate raw volumes between 'dir' and 'lvm'
storages.

It is only used when the storage type for the source storage X
and target storage Y differ and should work as long as Y uses
the standard naming scheme (VMID/vm-VMID-name.fmt respectively vm-VMID-name).
If it doesn't, we get an invalid name and fail, which is the old
behavior (except if X and Y have different types but the same
non-standard naming-scheme, where the old behavior did work).

The original name is preserved, except for a possible extension
and it's also checked if the format is valid for the target storage.
Example: mylvm:vm-123-disk-4 <-> mydir:123/vm-123-disk-4.raw

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
4 years agoIntroduce allow_rename parameter for pvesm import and storage_migrate
Fabian Ebner [Wed, 8 Apr 2020 09:25:05 +0000 (11:25 +0200)]
Introduce allow_rename parameter for pvesm import and storage_migrate

and also return the ID of the allocated volume. This option
allows plugins to choose a new name if there is a collision.

In storage_migrate, the API version of the receiving side is checked.

In Storage.pm's volume_import, when a plugin returns 'undef',
it can be assumed that the import with the requested volid was
successful (it should've died otherwise) and so volid is returned.
This is done for backwards compatibility with foreign plugins.

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
4 years agoAdd apiinfo helper to pvesm
Fabian Ebner [Wed, 8 Apr 2020 09:25:04 +0000 (11:25 +0200)]
Add apiinfo helper to pvesm

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
4 years agoCollect optional parameters for storage_migrate into $opts
Fabian Ebner [Wed, 8 Apr 2020 09:24:59 +0000 (11:24 +0200)]
Collect optional parameters for storage_migrate into $opts

Sanitizing $with_snapshots is done on extraction to save a line.

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
4 years agoFix 2647: Add snippet content type for Gluster
Dominic Jäger [Thu, 26 Mar 2020 09:33:28 +0000 (10:33 +0100)]
Fix 2647: Add snippet content type for Gluster

Our wiki mentions snippets as supported content type for GlusterFS storages [0]
and all other directory based storages have it enabled already [1]

[0] https://pve.proxmox.com/wiki/Storage:_GlusterFS
[1] https://git.proxmox.com/?p=pve-storage.git;a=commit;h=d1eb35ea74cf27713625ab7e7c3767a8254a4aee

Signed-off-by: Dominic Jäger <d.jaeger@proxmox.com>
4 years agofix #2474: always show iscsi content
Dominik Csapak [Tue, 7 Apr 2020 07:25:24 +0000 (09:25 +0200)]
fix #2474: always show iscsi content

Instead of relying on list_volumes of Plugin.pm (which filters by
the content types set in the config), use our own to always
show the luns of an iscsi.

This makes sense here, since we need it to show the luns when using
it as base storage for LVM (where we have content type 'none' set).

It does not interfere with the rest of the GUI, since on e.g. disk
creation, we already filter the storages in the dropdown by content
type, iow. an iscsi storage used this way still does not show up
when trying to create a disk.

This also shows the luns now in the 'Content' tab, but this is also
OK, since the user cannot actually do anything there with the luns.
(Besides looking at them)

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
4 years agostorage_migrate: check if target storage supports content type
Fabian Ebner [Thu, 26 Mar 2020 08:09:31 +0000 (09:09 +0100)]
storage_migrate: check if target storage supports content type

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
4 years agoAllow passing options to volume_has_feature
Fabian Ebner [Mon, 23 Mar 2020 11:18:50 +0000 (12:18 +0100)]
Allow passing options to volume_has_feature

With the option valid_target_formats it's possible
to let the caller specify possible formats for the target
of an operation.
[0]: If the option is not set, assume that every format is valid.

In most cases the format of the the target and the format
of the source will agree (and therefore assumption [0] is
not actually assuming very much and ensures backwards
compatability). But when cloning a volume on a storage
using Plugin.pm's implementation (e.g. directory based
storages), the result is always a qcow2 image.

When cloning containers, the new option can be used to detect
that qcow2 is not valid and hence the clone feature is not
available.

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
4 years agobase plugin: get_subdir_files: split stat variables into single lines
Thomas Lamprecht [Fri, 6 Mar 2020 18:27:24 +0000 (19:27 +0100)]
base plugin: get_subdir_files: split stat variables into single lines

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
4 years agoapi: storage/content: fix return schema property descriptions
Thomas Lamprecht [Fri, 6 Mar 2020 18:24:32 +0000 (19:24 +0100)]
api: storage/content: fix return schema property descriptions

a small grammar fix, and we now return ctime of all files, as
remaining storages are planned for the future omit this hint
completely.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
4 years agoPBS plugin: code cleanup
Thomas Lamprecht [Fri, 6 Mar 2020 18:15:53 +0000 (19:15 +0100)]
PBS plugin: code cleanup

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
4 years agoLVM list_images: return creation time
Dietmar Maurer [Wed, 4 Mar 2020 10:46:22 +0000 (11:46 +0100)]
LVM list_images: return creation time

Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
4 years agobase plugin: return ctime for vm images
Dietmar Maurer [Wed, 4 Mar 2020 10:46:21 +0000 (11:46 +0100)]
base plugin: return ctime for vm images

Changed file_size_info() to additionally return ctime to avoid
another stat() call.

Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
4 years agobase plugin: add ctime for all files
Dietmar Maurer [Wed, 4 Mar 2020 10:46:20 +0000 (11:46 +0100)]
base plugin: add ctime for all files

Creation time makes sense for other file types also.

Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
4 years agoPBS Plugin: list_volumes: add ctime
Dietmar Maurer [Wed, 4 Mar 2020 10:46:18 +0000 (11:46 +0100)]
PBS Plugin: list_volumes: add ctime

Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
4 years agobase plugin: add ctime for backup files
Dietmar Maurer [Wed, 4 Mar 2020 10:46:17 +0000 (11:46 +0100)]
base plugin: add ctime for backup files

Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
4 years agoapi: storage/content: add ctime to return schema
Dietmar Maurer [Wed, 4 Mar 2020 10:46:19 +0000 (11:46 +0100)]
api: storage/content: add ctime to return schema

to allow implementation from plugins in future patches

Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
4 years agoiscis: add iscsi_session helper
Thomas Lamprecht [Tue, 3 Mar 2020 09:49:11 +0000 (10:49 +0100)]
iscis: add iscsi_session helper

allows to write some code sligthly nicer

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
4 years agoiscsi: sort and split module usage
Thomas Lamprecht [Tue, 3 Mar 2020 09:43:02 +0000 (10:43 +0100)]
iscsi: sort and split module usage

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
4 years agoISCSI: whitespace cleanup
Aaron Lauterer [Mon, 2 Mar 2020 07:52:06 +0000 (08:52 +0100)]
ISCSI: whitespace cleanup

Signed-off-by: Aaron Lauterer <a.lauterer@proxmox.com>
4 years agofix #2620: storage API: iSCSI: return active field as integer
Aaron Lauterer [Mon, 2 Mar 2020 07:52:05 +0000 (08:52 +0100)]
fix #2620: storage API: iSCSI: return active field as integer

If active, the return value was a string: "1" and not an integer.

Signed-off-by: Aaron Lauterer <a.lauterer@proxmox.com>
4 years agofollowup: fix VMID regex, use same as JSONSchema does
Thomas Lamprecht [Fri, 21 Feb 2020 14:58:06 +0000 (15:58 +0100)]
followup: fix VMID regex, use same as JSONSchema does

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
4 years agolist_volumes: try to return vmid also for backups
Dominik Csapak [Fri, 21 Feb 2020 10:02:09 +0000 (11:02 +0100)]
list_volumes: try to return vmid also for backups

this way the content listing api also returns the vmid on content
listings which, among other things, is useful for the gui for
filtering

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
4 years agobump version to 6.1-5
Thomas Lamprecht [Thu, 20 Feb 2020 12:46:24 +0000 (13:46 +0100)]
bump version to 6.1-5

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
4 years agocifs: followup fix for credential fallback
Thomas Lamprecht [Thu, 20 Feb 2020 12:55:43 +0000 (13:55 +0100)]
cifs: followup fix for credential fallback

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
4 years agocifs: move password credential file to storage subdirectory
Thomas Lamprecht [Thu, 20 Feb 2020 12:07:06 +0000 (13:07 +0100)]
cifs: move password credential file to storage subdirectory

Do not pollute top-level private directory, use "storage" folder but
with backward compatibility.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
4 years agoPBSPlugin.pm: fix password handling using new on_update_hook
Dietmar Maurer [Thu, 20 Feb 2020 11:38:21 +0000 (12:38 +0100)]
PBSPlugin.pm: fix password handling using new on_update_hook

4 years agoCIFSPlugin.pm: fix crediential handling using new on_update_hook
Dietmar Maurer [Thu, 20 Feb 2020 11:33:59 +0000 (12:33 +0100)]
CIFSPlugin.pm: fix crediential handling using new on_update_hook

4 years agoPVE/Storage/Plugin.pm: introduce on_update_hook
Dietmar Maurer [Thu, 20 Feb 2020 11:33:58 +0000 (12:33 +0100)]
PVE/Storage/Plugin.pm: introduce on_update_hook

We need this to correctly update the password file.

4 years agopbs: ensure storage secret file directory exists
Thomas Lamprecht [Thu, 20 Feb 2020 10:12:29 +0000 (11:12 +0100)]
pbs: ensure storage secret file directory exists

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
4 years agoPBSPlugin.pm - extract_vzdump_config: fix call to run_raw_client_cmd
Dietmar Maurer [Thu, 20 Feb 2020 09:45:34 +0000 (10:45 +0100)]
PBSPlugin.pm - extract_vzdump_config: fix call to run_raw_client_cmd

4 years agovolume_resize: align size to 1 KiB
Fabian Ebner [Wed, 19 Feb 2020 10:31:31 +0000 (11:31 +0100)]
volume_resize: align size to 1 KiB

1. Avoids the error
qemu-img: The new size must be a multiple of 512
for qcow2 disks.
2. Because volume_import expects disk sizes to be a multiple of 1 KiB.

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
4 years agonamespace storage specific secret files to 'priv/storage' folder
Thomas Lamprecht [Wed, 19 Feb 2020 13:51:00 +0000 (14:51 +0100)]
namespace storage specific secret files to 'priv/storage' folder

As /etc/pve/priv is already pretty polluted, having a
"<storage-id>.pw" file there smells like it could make problems in
the future.

So let the pbs pw file generator use /etc/pve/priv/storages as base
path.
Other storage should move also to that path in the future, if they
save such secrets anywhere in /etc/pve.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
4 years agocheck if client executable ist installed before running command
Thomas Lamprecht [Wed, 19 Feb 2020 13:50:42 +0000 (14:50 +0100)]
check if client executable ist installed before running command

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
4 years agouse one liner closure for outfunc
Thomas Lamprecht [Wed, 19 Feb 2020 13:50:04 +0000 (14:50 +0100)]
use one liner closure for outfunc

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
4 years agoindentation fixes
Thomas Lamprecht [Wed, 19 Feb 2020 13:49:38 +0000 (14:49 +0100)]
indentation fixes

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
4 years agoimplement extract_vzdump_config for PBSPlugin
Dietmar Maurer [Wed, 19 Feb 2020 12:55:28 +0000 (13:55 +0100)]
implement extract_vzdump_config for PBSPlugin

4 years agoPVE/Storage/PBSPlugin.pm: start new proxmox backup server plugin
Dietmar Maurer [Wed, 19 Feb 2020 12:55:27 +0000 (13:55 +0100)]
PVE/Storage/PBSPlugin.pm: start new proxmox backup server plugin

4 years agoCheck whether 'zfs get mountpoint' returns a valid absolute path
Fabian Ebner [Tue, 18 Feb 2020 10:14:59 +0000 (11:14 +0100)]
Check whether 'zfs get mountpoint' returns a valid absolute path

The command 'zfs get mountpoint' can return 'none' and so 'mountpoint
none' was written to storage.cfg, which would block the fall-back to
using the default mount point when requesting a path, see [0].

[0]: https://forum.proxmox.com/threads/zfs-backup-with-snapshot-mode-fails.61927/#post-284123

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
4 years agosystemd unit name escape helpers moved to common, use them
Thomas Lamprecht [Wed, 5 Feb 2020 16:14:39 +0000 (17:14 +0100)]
systemd unit name escape helpers moved to common, use them

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
4 years agodirectory/cephfs: sort module usage
Thomas Lamprecht [Wed, 5 Feb 2020 16:13:30 +0000 (17:13 +0100)]
directory/cephfs: sort module usage

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
4 years agostorage_migrate: only set errfunc for send stream
Fabian Grünbichler [Wed, 5 Feb 2020 08:37:09 +0000 (09:37 +0100)]
storage_migrate: only set errfunc for send stream

since we redirect the output to our (insecure) socket, logfunc is only
used for STDERR anyway, so we might as well make it explicit on the
caller side.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
4 years agostorage_migrate: also log with an insecure connection if there is a log function
Fabian Ebner [Wed, 29 Jan 2020 13:30:02 +0000 (14:30 +0100)]
storage_migrate: also log with an insecure connection if there is a log function

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
4 years agoRemove unused string
Fabian Ebner [Wed, 29 Jan 2020 13:30:00 +0000 (14:30 +0100)]
Remove unused string

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
4 years agobump version to 6.1-4
Thomas Lamprecht [Wed, 29 Jan 2020 19:04:03 +0000 (20:04 +0100)]
bump version to 6.1-4

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
4 years agocephcfg sort keys in write_ceph_config
Thomas Lamprecht [Wed, 29 Jan 2020 18:59:08 +0000 (19:59 +0100)]
cephcfg sort keys in write_ceph_config

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
4 years agocephfs mount: reload systemd if existing unit gets regenerated
Thomas Lamprecht [Wed, 29 Jan 2020 18:48:49 +0000 (19:48 +0100)]
cephfs mount: reload systemd if existing unit gets regenerated

One the first write bringing the unit file in existence we can just
start it, after that we need to tell systemd that we want to actively
reload it.

While this is slightly shaky due to the fact that we do not check all
paths where such a unit could reside, it is something we can do
because earlier one couldn't have a unit/overwrite anyway (from
procfs mountinfo generated one do not support that) and does adding
such override ones from now on should work.

Also note that we can only get here in the "user does no weird stuff"
case when "cephfs_is_mounted" actively tells that there is no cephfs
mounted at the $mountpoint - at which time we can safely re-write the
potential updated unit file, reload and mount again.

So let's make our life a bit easier here until a user actually
complains about a rational issue for this, maybe we have PVE 7.0 then
and can get rid of that anyway :)

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
4 years agocephfs: mount fuse through systemd with correct order dependencies
Thomas Lamprecht [Wed, 29 Jan 2020 18:41:09 +0000 (19:41 +0100)]
cephfs: mount fuse through systemd with correct order dependencies

This fixes a potential races where fuse get's unmouted to late in the
shutdown process, i.e., at a time where network was down and it could
not talk to any MDS or monitor anymore.

We could fix it the same way we did once with the kernel based mount,
i.e., adding _netdev, but doing so would require to switch over from
"ceph-fuse" to "mount.fuse.ceph" which has better compatibility with
the common mount tool API.

As that helper exists we can reuse the newer systemd_netmount
ephemeral unit generator, only some options differ in name between
fuse and kernel variant.

So besides solving a potential issue we get a more unified handling
of those two cases.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
4 years agofix random hangs on reboot with active CephFS mount ordering cycle
Thomas Lamprecht [Wed, 29 Jan 2020 17:02:13 +0000 (18:02 +0100)]
fix random hangs on reboot with active CephFS mount ordering cycle

commit 54e0b0034bd6654c566cb4ae7d4a5953c48cd1ca introduced the
"_netdev" option, for PVE 5.3. The systemd generator then correctly
resolved that in the following resulting order-dependencies:
> Wants=network-online.target
> Before=umount.target remote-fs.target
> After=remote-fs-pre.target system.slice network.target network-online.target -.mount

This worked well and all were happy. With the current systemd in 6.0
we sometimes get the local-fs ones there generated too. This is a
fallout from a try to better handling nested mount hierachies, where
a .mount unit needs to be mounter or unmounted, before or after,
respectively, the parent mount was processed. It seems that sometime
that glitches and thus a "RequireMountFor=/mnt/pve" gets thrown in
and result sometimes in the local-fs order constraints being added.

The issue now is, that one must not have ordering depends to all,
local-fs, local-fs-pre, remote-fs, remote-fs-pre, as that gets you a
ordering cycle. Systemd tries to solve that cycle by randomly
dropping one constraint and retrying. By luck this is a not so
important unit, and all goes on well. Most of the time one isn't that
lucky and something important gets dropped, for example:

> Jan 24 18:43:05 prod1 systemd[1]: sysinit.target: Found ordering cycle on systemd-timesyncd.service/stop
> Jan 24 18:43:05 prod1 systemd[1]: sysinit.target: Found dependency on systemd-tmpfiles-setup.service/stop
> Jan 24 18:43:05 prod1 systemd[1]: sysinit.target: Found dependency on local-fs.target/stop
> Jan 24 18:43:05 prod1 systemd[1]: sysinit.target: Found dependency on mnt-pve-cephfs.mount/stop
> Jan 24 18:43:05 prod1 systemd[1]: sysinit.target: Found dependency on remote-fs-pre.target/stop
> Jan 24 18:43:05 prod1 systemd[1]: sysinit.target: Found dependency on rbdmap.service/stop
> Jan 24 18:43:05 prod1 systemd[1]: sysinit.target: Found dependency on sysinit.target/stop
> Jan 24 18:43:05 prod1 systemd[1]: sysinit.target: Job remote-fs-pre.target/stop deleted to break ordering cycle starting with sysinit.target/stop

Then, most of the time the host reboot hangs for ~10 minutes, often
showing scapegoat units like the pve-ha-lrm being the cause of the
hang (even if no HA is configure >.<).

This behavior is fixed with newer systemd versions, e.g., the v244
from buster-backports, but that is not a real option for us for now.

So until 7.0 we generate the unit with the correct dependencies
directly in the ephemeral /run/ tmpfs backed systemd/system path and
start it.

While FUSE gets only the local-fs ordering constraint, it seems to cope
very well regarding such symptoms. But it _is_ racy and probably only
works due to systemd stopping it early as it has not much ordering
constraints at all.. It should be moved in the future nonetheless, as
there's a mount.fuse.ceph helper that should be not an issue.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
4 years agoCephFSPlugin: copy over systemd_escape
Thomas Lamprecht [Wed, 29 Jan 2020 17:00:34 +0000 (18:00 +0100)]
CephFSPlugin: copy over systemd_escape

This is but a hack, but we have no general helper/tools module here
and I do not want to do versioned dependencies for this fast-tracked
bugfix to pve-common, so I'll have to live with the shame for now.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
4 years agodon't (accidentally) modify PVE::Cluster::vmlist
Fabian Grünbichler [Tue, 7 Jan 2020 11:24:13 +0000 (12:24 +0100)]
don't (accidentally) modify PVE::Cluster::vmlist

when listing volumes, otherwise an empty hash can be persisted into the
current worker's $vmlist, which could cause issues at various other API
endpoints.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
4 years agocifs-plugin: Add bwlimit storage option
Dominic Jäger [Fri, 20 Dec 2019 09:12:31 +0000 (10:12 +0100)]
cifs-plugin: Add bwlimit storage option

This is already implemented in all other storage plugins.

Signed-off-by: Dominic Jäger <d.jaeger@proxmox.com>