]> git.proxmox.com Git - pve-storage.git/log
pve-storage.git
6 months agofix #254: iscsi: add support for multipath targets
Yuri Konotopov via pve-devel [Mon, 23 Oct 2023 17:45:08 +0000 (21:45 +0400)]
fix #254: iscsi: add support for multipath targets

With this patch Proxmox now tries to login to all discovered portals
in case some of them are not logged yet.
In case of multipath configuration when initially configured portal is
missing for some reason Proxmox don't lose iSCSI storage now and can
successfully restore iSCSI connection between reboots.

Signed-off-by: Yuri Konotopov <ykonotopov@gnome.org>
Reviewed-By: Dominik Csapak <d.csapak@proxmox.com>
Tested-By: Dominik Csapak <d.csapak@proxmox.com>
8 months agooffline migration: use telling variable for capture group
Thomas Lamprecht [Thu, 31 Aug 2023 13:21:30 +0000 (15:21 +0200)]
offline migration: use telling variable for capture group

With that the if/else branches are pretty clear, so drop the rather
noisy comments that describe what one can get from the code already
anyway.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
8 months agofix #3004: show progress of offline migration in task log
Leo Nunner [Thu, 31 Aug 2023 10:41:59 +0000 (12:41 +0200)]
fix #3004: show progress of offline migration in task log

dd supports a 'status' flag, which enables it to show the copied bytes,
duration, and the transfer rate, which then get printed to stderr.

Signed-off-by: Leo Nunner <l.nunner@proxmox.com>
8 months agocifs: bubble up NT_STATUS_INVALID_PARAMETER during connection check
Fiona Ebner [Tue, 27 Jun 2023 07:48:49 +0000 (09:48 +0200)]
cifs: bubble up NT_STATUS_INVALID_PARAMETER during connection check

instead of claiming that the storage is not online.

Would've made the issue fixed by b27da68 ("cifs: fix check connection
call") more obvious, because (the UI passes along an empty string for
domain if not set and) the smbclient call returns that status with
> -W ''
in Bookworm.

Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
8 months agobump version to 8.0.3
Wolfgang Bumiller [Fri, 18 Aug 2023 08:40:16 +0000 (10:40 +0200)]
bump version to 8.0.3

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
8 months agowhitespace and formatting fixup
Wolfgang Bumiller [Fri, 18 Aug 2023 08:10:27 +0000 (10:10 +0200)]
whitespace and formatting fixup

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
8 months agoremove unneeded comment
Wolfgang Bumiller [Fri, 18 Aug 2023 08:06:06 +0000 (10:06 +0200)]
remove unneeded comment

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
8 months agofix #4849: download-url: allow download and decompression of compressed ISOs
Philipp Hufnagl [Mon, 14 Aug 2023 14:42:17 +0000 (16:42 +0200)]
fix #4849: download-url: allow download and decompression of compressed ISOs

adds information for how to decompress isos.

generates the compressor regex from a list of comression formats (to
avoid redundancy)
extends the download_url wtih the functionality to handley compression
for images

Signed-off-by: Philipp Hufnagl <p.hufnagl@proxmox.com>
9 months agofix whitespace
Philipp Hufnagl [Tue, 1 Aug 2023 14:46:00 +0000 (16:46 +0200)]
fix whitespace

Signed-off-by: Philipp Hufnagl <p.hufnagl@proxmox.com>
FG: dropped non-indentation parts

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
9 months agoclean: fix whitspaces and minor code issues
Philipp Hufnagl [Tue, 25 Jul 2023 14:37:19 +0000 (16:37 +0200)]
clean: fix whitspaces and minor code issues

removed Data::Dumper and a newline

Signed-off-by: Philipp Hufnagl <p.hufnagl@proxmox.com>
re-added the newline, but fixed up the indentation at that line..

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
10 months agobump version to 8.0.2
Thomas Lamprecht [Wed, 28 Jun 2023 07:32:00 +0000 (09:32 +0200)]
bump version to 8.0.2

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
10 months agocifs: fix check connection call
Fiona Ebner [Mon, 26 Jun 2023 10:58:31 +0000 (12:58 +0200)]
cifs: fix check connection call

by not having -W eat the next argument when $scfg->{domain} is defined
but empty.

As reported in the community forum [0], this could lead to issues
adding a storage in the UI.

[0]: https://forum.proxmox.com/threads/44983/post-566842

Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
11 months agobump version to 8.0.1
Thomas Lamprecht [Sat, 17 Jun 2023 13:34:04 +0000 (15:34 +0200)]
bump version to 8.0.1

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
11 months agodisk api: only ask for Datastore.Allocate if adding to storage config
Thomas Lamprecht [Sat, 17 Jun 2023 12:53:05 +0000 (14:53 +0200)]
disk api: only ask for Datastore.Allocate if adding to storage config

The Proxmox VE storage systems doesn't cares at all if the
Datastore.Allocate privilege is present if no Proxmox VE storage will
be allocated.

Note, if we want to restrict this further as Sys.Modify on /, which
is already quite a powerful permission, we should probably add a new
one under the Sys. space, e.g., Sys.Disk.Use or the like.

This is a step in splitting the disk manage code out of the
pve-storage package, and maybe even repository

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
11 months agodisk api: avoid using unrelated Datastore.Audit priv for disk management
Thomas Lamprecht [Sat, 17 Jun 2023 12:22:28 +0000 (14:22 +0200)]
disk api: avoid using unrelated Datastore.Audit priv for disk management

Local disk and storage creation and listing is something rather
different than the Proxmox VE storage client ABI that provides an
abstract access to a variety of storage types, specifically targeted
to virtual guests images, templates and backups.

The Datastore.* privilege group is specifically made for auditing the
abstract configuration, here the name must be interpreted in context
and not just assumed that due to "datastore" sounding like it could
have to do something with disks or creation of local storage it just
must be a good fit.

Luckily, Sys.Audit was already used too, which is the correct one
here, this is for node specific (HW) details, not some config for
accessing datastore in a restricted way.

This is a step in splitting the disk manage code out of the
pve-storage package, and maybe even repository.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
11 months agodisk management api: comment how storages are added and cleanup style
Thomas Lamprecht [Sat, 17 Jun 2023 12:51:20 +0000 (14:51 +0200)]
disk management api: comment how storages are added and cleanup style

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
11 months agofix #4785: avoid overly noisy mkdir deprecation warning for now
Thomas Lamprecht [Sat, 17 Jun 2023 10:41:46 +0000 (12:41 +0200)]
fix #4785: avoid overly noisy mkdir deprecation warning for now

Move the warning over to creating and updating storage configs, which
is much less noisy as the constantly called activate storage (e.g.,
pvestatd).

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
11 months agocontent-dirs check: silently skip paths that cannot be resolved
Friedrich Weber [Thu, 15 Jun 2023 11:36:58 +0000 (13:36 +0200)]
content-dirs check: silently skip paths that cannot be resolved

Since commit 8e623a2930f7aee4b3309b1f297613a250ee4698, the inequality
check for content-dirs prints a warning if a content directory path
could not be resolved, i.e., if `abs_path` returns undef. Among other
things, `abs_path` returns undef if the path has an inner (= any but
last) component that does not exist. This can happen for a storage
with content type `iso,vztmpl` and `create-subdirs` set to 0, in case
`template/` does not exist. In this case, the warnings printed by
pvestatd are quite noisy.

As missing content directories are not a problem per se, remove the
warning and just ignore the directory during the inequality check.

Signed-off-by: Friedrich Weber <f.weber@proxmox.com>
11 months agoapi: config: add/update storage: check for type mismatch first
Fiona Ebner [Mon, 12 Jun 2023 14:27:33 +0000 (16:27 +0200)]
api: config: add/update storage: check for type mismatch first

This avoids confusing errors about other properties when the storage
type doesn't match. By highlighting that the type doesn't match, users
should know right away what the issue is.

Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
11 months agobump version to 8.0.0
Thomas Lamprecht [Fri, 9 Jun 2023 11:59:25 +0000 (13:59 +0200)]
bump version to 8.0.0

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
11 months agocontent dirs: skip creation if either mkdir or create-subdirs is false
Thomas Lamprecht [Fri, 9 Jun 2023 11:57:14 +0000 (13:57 +0200)]
content dirs: skip creation if either mkdir or create-subdirs is false

This is slightly confusing due to both options, the legacy convoluted
one and the new targeted one, exist, but before the rework we skip if
either of those sub-expressions was true, so doing it needs both to
be true.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
11 months agoactivate storage: ensure content directories are created before checking them
Thomas Lamprecht [Fri, 9 Jun 2023 11:26:06 +0000 (13:26 +0200)]
activate storage: ensure content directories are created before checking them

checking the content dirs for clashes via abs_path must be done after
the logic for creating them ran, as abs_path is working on actual
filesystem level, so it will return undf if the directory does not
exist, in which case we then set a hash entry for "undef", and the
next for loop round then resolved again to "undef", resulting in a
false-positive of the check.

Avoid the dangerous "return if" stanzas and reverse them to an actual
if block, which is much safer to adapt. Then move the check for
duplicate content-dir usage after that.

best viewed with white space change ignored: git show -w

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
11 months agobump version to 8.0.0~2
Thomas Lamprecht [Wed, 7 Jun 2023 17:10:47 +0000 (19:10 +0200)]
bump version to 8.0.0~2

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
11 months agofix #2920: cifs: add options parameter
Stefan Hrdlicka [Wed, 1 Mar 2023 12:13:25 +0000 (13:13 +0100)]
fix #2920: cifs: add options parameter

This makes it possible to add all mount options offered by mount.cifs.
NFS & CIFS now share the options parameter since they use it for the
same purpose.

Signed-off-by: Stefan Hrdlicka <s.hrdlicka@proxmox.com>
 [FE: rebase + style fixes]
Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
Tested-by: Friedrich Weber <f.weber@proxmox.com>
 [T: fix merge conflict ]
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
11 months agochanged regex to allow @ in directory storage paths
Markus Frank [Thu, 27 Apr 2023 12:04:45 +0000 (14:04 +0200)]
changed regex to allow @ in directory storage paths

@ is often used to signify btrfs subvolumes.

Signed-off-by: Markus Frank <m.frank@proxmox.com>
11 months agorbd: volume resize: wrap ceil in int, just to be sure
Thomas Lamprecht [Tue, 6 Jun 2023 17:40:04 +0000 (19:40 +0200)]
rbd: volume resize: wrap ceil in int, just to be sure

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
11 months agorbd: volume resize: avoid passing floating point value to rbd
Fiona Ebner [Fri, 28 Apr 2023 12:32:09 +0000 (14:32 +0200)]
rbd: volume resize: avoid passing floating point value to rbd

which causes an error "the argument for option '--size' is invalid".
Just round up to the nearest integer to have at least the requested
size. This is similar to what is done for ZFS with d3e3e5d ("When
resizing a ZFS volume, align size to 1M") and makes commands like 'qm
resize 102 scsi1 +0.01G' work.

Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
11 months agorbd: don't specify allow-shrink flag
Fiona Ebner [Fri, 28 Apr 2023 12:32:08 +0000 (14:32 +0200)]
rbd: don't specify allow-shrink flag

It was introduced by commit 4b7dd9d ("allow --allow-shrink on RBD
resize"), but doesn't give a rationale. A mail gives more[0],
indicating that the user also uses the function to shrink images.
However, the volume_resize function is only reachable via the resize
API endpoints for VMs and containers, which have an explicit check to
disallow shrinkage. If somebody really wants to shrink the image, just
let them use the storage's tools directly. Calling into Proxmox VE's
perl functions directly is not supported.

[0]: https://lists.proxmox.com/pipermail/pve-devel/2016-November/024077.html

Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
11 months agovolume export: explicitly state unit of bandwidth limit
Stefan Hanreich [Wed, 29 Mar 2023 12:34:35 +0000 (14:34 +0200)]
volume export: explicitly state unit of bandwidth limit

Other places like replication explicitly state whether byte or bit
are used as a unit rather than only the abbreviation.

Signed-off-by: Stefan Hanreich <s.hanreich@proxmox.com>
11 months agocontent-dirs: check that all content dirs are pairwise inequal
Friedrich Weber [Tue, 21 Mar 2023 17:03:25 +0000 (18:03 +0100)]
content-dirs: check that all content dirs are pairwise inequal

This prevents strange interactions in case the same content directory
is used for multiple content types.

Signed-off-by: Friedrich Weber <f.weber@proxmox.com>
11 months agobump version to 8.0.0~1
Wolfgang Bumiller [Mon, 5 Jun 2023 12:46:22 +0000 (14:46 +0200)]
bump version to 8.0.0~1

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
11 months agoplugin: simplify and fix create-base-path vs mkdir logic
Wolfgang Bumiller [Mon, 5 Jun 2023 09:17:27 +0000 (11:17 +0200)]
plugin: simplify and fix create-base-path vs mkdir logic

In the previous code, if `create-base-path` was explicitly
set to false, it would be treated the same as if it was
undef, falling through to whatever 'mkdir' was.

Instead, the new options should always be preferred, and the
logic can be simplified to a single line.

Here's the table showing the difference, 'u' being 'undef':

config: mkdir:  u 0 1 u 0 1 u 0 1
        create: u u u 0 0 0 1 1 1
        =========================
mkpath: old:    1 0 1 0 0 1 1 1 1
        new:    1 0 1 0 0 0 1 1 1

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
11 months agodeprecate mkdir option for create-base-path and create-subdirs
Aaron Lauterer [Wed, 31 May 2023 12:46:09 +0000 (14:46 +0200)]
deprecate mkdir option for create-base-path and create-subdirs

The `mkdir` option has two meanings[0][1] which are split up in `create-path`
and `create-sub-dirs`.

The `create-base-path` option decides if the path to the storage is
automatically created or not.
The `create-subdirs` options decides if the default directory
structure (dump, images, ...) at the storage location is created.

The `mkdir` option is still working but will trigger a warning in the
logs.

As a side effect, this also fixes #3214 because the `create-base-path` option
is now run after the `is_mountpoint` check in the `activate_storage`
method in DirPlugin.pm.

The 'mkpath' command has been moved into a new helper function that
first determines if the conditions to create the path is true, called
'config_aware_base_mkdir'.

[0] https://lists.proxmox.com/pipermail/pve-devel/2020-December/046575.html
[1] https://lists.proxmox.com/pipermail/pve-devel/2020-December/046576.html

Signed-off-by: Aaron Lauterer <a.lauterer@proxmox.com>
Reviewed-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
11 months agobuildsys: derive upload dist automatically
Thomas Lamprecht [Wed, 24 May 2023 15:21:02 +0000 (17:21 +0200)]
buildsys: derive upload dist automatically

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
11 months agobump version to 7.99.0
Thomas Lamprecht [Wed, 24 May 2023 14:23:08 +0000 (16:23 +0200)]
bump version to 7.99.0

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
11 months agod/control: raise standards version compliance to 4.6.2
Thomas Lamprecht [Wed, 24 May 2023 14:22:36 +0000 (16:22 +0200)]
d/control: raise standards version compliance to 4.6.2

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
11 months agod/control: define compat level via build-depends and raise to 13
Thomas Lamprecht [Wed, 24 May 2023 14:22:28 +0000 (16:22 +0200)]
d/control: define compat level via build-depends and raise to 13

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
11 months agod/control: add missing ${misc:Depends} stable-7
Thomas Lamprecht [Wed, 24 May 2023 14:22:18 +0000 (16:22 +0200)]
d/control: add missing ${misc:Depends}

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
11 months agobuildsys: add sbuild convenience target
Thomas Lamprecht [Wed, 24 May 2023 14:22:06 +0000 (16:22 +0200)]
buildsys: add sbuild convenience target

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
11 months agobuildsys: add DSC target
Thomas Lamprecht [Wed, 24 May 2023 14:21:53 +0000 (16:21 +0200)]
buildsys: add DSC target

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
11 months agobuildsys: make build-dir generation atomic
Thomas Lamprecht [Wed, 24 May 2023 14:21:07 +0000 (16:21 +0200)]
buildsys: make build-dir generation atomic

and factor it out to own target

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
11 months agoseparate packaging and source build system
Thomas Lamprecht [Wed, 24 May 2023 14:20:27 +0000 (16:20 +0200)]
separate packaging and source build system

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
11 months agomakefile: convert to use simple parenthesis
Thomas Lamprecht [Wed, 24 May 2023 11:56:17 +0000 (13:56 +0200)]
makefile: convert to use simple parenthesis

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
11 months agobuildsys: rework doc-gen cleanup and makefile inclusion
Thomas Lamprecht [Wed, 24 May 2023 11:53:18 +0000 (13:53 +0200)]
buildsys: rework doc-gen cleanup and makefile inclusion

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
11 months agobump version to 7.4-3
Thomas Lamprecht [Tue, 23 May 2023 06:46:02 +0000 (08:46 +0200)]
bump version to 7.4-3

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
11 months agoapi: upload: add pattern to tmpfilename parameter
Friedrich Weber [Thu, 4 May 2023 09:13:34 +0000 (11:13 +0200)]
api: upload: add pattern to tmpfilename parameter

The `tmpfilename` is generated by pve-http-server and always adheres
to this pattern, so make this explicit to prevent confusion and have
a more complete JSON API schema, useful for e.g., the API viewer.

Signed-off-by: Friedrich Weber <f.weber@proxmox.com>
 [ T: slightly extended commit message ]
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
13 months agofix various perlcritic lints
Thomas Lamprecht [Tue, 11 Apr 2023 15:16:19 +0000 (17:16 +0200)]
fix various perlcritic lints

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
13 months agocephfs: fix variable declared in conditional statement
Thomas Lamprecht [Tue, 11 Apr 2023 15:15:41 +0000 (17:15 +0200)]
cephfs: fix variable declared in conditional statement

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
13 months agorbd: fix variable declared in conditional statement
Thomas Lamprecht [Tue, 11 Apr 2023 15:14:53 +0000 (17:14 +0200)]
rbd: fix variable declared in conditional statement

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
13 months agobump version to 7.4-2
Thomas Lamprecht [Tue, 21 Mar 2023 15:49:31 +0000 (16:49 +0100)]
bump version to 7.4-2

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
13 months agofeature: enable 'content-dirs' property for cephfs
Leo Nunner [Tue, 21 Mar 2023 12:59:18 +0000 (13:59 +0100)]
feature: enable 'content-dirs' property for cephfs

Signed-off-by: Leo Nunner <l.nunner@proxmox.com>
13 months agocifs: use empty string instead of / as default directory
Stoiko Ivanov [Tue, 21 Mar 2023 11:12:40 +0000 (12:12 +0100)]
cifs: use empty string instead of / as default directory

this keeps the mount sources consistent with previous versions
without this patch there is a small regression, which leads to the
storage not being recognized as being mounted on upgrade:
* pvestatd in older version mount the storage with out trailing /
```
//cifsstore/ISO on /mnt/pve/cifsstore type cifs...
```
* the cifs_is_mounted helper does not recognize it as being mounted
(as the source now has a / in the end)
* attempting to mount leads to
```
mount error(16): Device or resource busy
```

noticed after upgrading and having a cifs storage mounted

Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
13 months agobump version to 7.4-1
Thomas Lamprecht [Mon, 20 Mar 2023 16:04:59 +0000 (17:04 +0100)]
bump version to 7.4-1

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
13 months agoapi: fix get content call response type for RBD/ZFS/iSCSI volumes
Christian Ebner [Thu, 9 Mar 2023 09:41:23 +0000 (10:41 +0100)]
api: fix get content call response type for RBD/ZFS/iSCSI volumes

`pvesh get /nodes/{node}/storage/{storage}/content/{volume}` failed for
several storage types, because the respective storage plugins returned
only the volumes `size` on `volume_size_info` calls, while also the format
is required.

This patch fixes the issue by returning also `format` and where possible `used`.

The issue was reported in the forum:
https://forum.proxmox.com/threads/pvesh-get-nodes-node-storage-storage-content-volume-returns-error.123747/

Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
 [ T: fixup white space error ]
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
13 months agocontent path overrides: allow single dots and enforce max-lengths
Thomas Lamprecht [Mon, 20 Mar 2023 14:11:40 +0000 (15:11 +0100)]
content path overrides: allow single dots and enforce max-lengths

Allow a dot as long as its not followed by another dot and enforce
max component and (a reduced) max path length checking already at
schema level.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
13 months agoconfig: use relative paths for content overrides
Leo Nunner [Tue, 14 Mar 2023 13:14:54 +0000 (14:14 +0100)]
config: use relative paths for content overrides

Remove the requirement for paths to start with a /, as it might be
confusing to users.

Signed-off-by: Leo Nunner <l.nunner@proxmox.com>
14 months agodirectory: fix verify-dir code style
Thomas Lamprecht [Thu, 16 Mar 2023 16:16:04 +0000 (17:16 +0100)]
directory: fix verify-dir code style

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
15 months agocifs: small line bloat reduction
Thomas Lamprecht [Tue, 7 Feb 2023 14:55:55 +0000 (15:55 +0100)]
cifs: small line bloat reduction

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
15 months agofix #2641: allow mounting of CIFS subdirectories
Leo Nunner [Thu, 1 Dec 2022 11:32:55 +0000 (12:32 +0100)]
fix #2641: allow mounting of CIFS subdirectories

CIFS/SMB supports directly mounting subdirectories, so it makes sense to
also allow the --subdir parameter for these storages. The subdir
parameter was moved from CephFSPlugin.pm to Plugin.pm, because it isn't
specific to CephFS anymore.

Signed-off-by: Leo Nunner <l.nunner@proxmox.com>
15 months agonfs: check connection: support NFSv4-only servers without rpcbind
Fiona Ebner [Mon, 23 Jan 2023 09:14:50 +0000 (10:14 +0100)]
nfs: check connection: support NFSv4-only servers without rpcbind

by simply doing a ping with the expected port as a fallback when the
rpcinfo command fails.

The timeout was chosen to be 2 seconds, because that's what the
existing callers of tcp_ping() in the iSCSI and GlusterFS plugins use.

Alternatively, the existing check could be replaced, but that would
1. Dumb down the check.
2. Risk breakage in some corner case that's yet to be discovered.
3. It would still be necessary to use rpcinfo (or dumb the check down
even further) in case port=0; from 'man 5 nfs' about the NFSv4 'port'
option:
> If the specified port value is 0, then the NFS client uses the NFS
> service port number advertised by the server's rpcbind service.

Reported in the community forum:
https://forum.proxmox.com/threads/118466/post-524449
https://forum.proxmox.com/threads/120774/

Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
16 months agosnapshot delete: add reminder to drop $running parameter with PVE 8.x
Fiona Ebner [Thu, 12 Jan 2023 07:27:37 +0000 (08:27 +0100)]
snapshot delete: add reminder to drop $running parameter with PVE 8.x

For the rationale, see:
https://lists.proxmox.com/pipermail/pve-devel/2022-December/055273.html

Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
16 months agobump version to 7.3-2
Thomas Lamprecht [Wed, 11 Jan 2023 15:47:33 +0000 (16:47 +0100)]
bump version to 7.3-2

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
16 months agofix #4390: rbd: snapshot delete: avoid early return to fix handling TPM drive
Fiona Ebner [Fri, 9 Dec 2022 10:30:41 +0000 (11:30 +0100)]
fix #4390: rbd: snapshot delete: avoid early return to fix handling TPM drive

The only caller where $running can even be truthy is QemuServer.pm's
qemu_volume_snapshot_delete(). But there, a check if snapshots should
be done with QEMU is already made and the storage function is only
called if snapshots should not be done with QEMU (like for TPM drives
which are not attached directly). So rely on the caller and do not
return early to fix removing snapshots in such cases.

Even if a stray call ends up here (can happen already by changing the
krbd setting while a VM is running to flip the above-mentioned check
and the early return check removed by this patch), it might not even
be problematic. At least a quick test worked fine:
1. take snapshot via a monitor command in QEMU
2. remove snapshot via the storage layer
3. create a new file in the VM
4. take a snapshot with the same name via monitor command in QEMU
5. roll back to the snapshot
6. check that the file in the VM is as expected
Using the storage layer to take the snapshots and QEMU to remove the
snapshot also worked doing the same test. Even if it were problematic,
the check in qemu-server should rather be improved then.

(Trying to issue a snapshot mon command for a krbd-mapped image fails
with an error on the other hand, but that is also not too bad and not
relevant to the storage code. Again, it rather would be necessary to
improve the check in qemu-server).

The fact that the pve-container code didn't even pass $running is the
reason removing snapshots worked for containers on a storage with krbd
disabled (the pve-container code calls map_volume() explicitly, so
containers can work regardless of the krbd setting in the storage
configuration; see commit 841fba6 ("call map_volume before using
volumes.") in pve-container).

For volume_snapshot(), the early return with $running was already
removed (or rather the relevant logic moved to QemuServer.pm) in 2015
by commit f5640e7 ("remove running from Storage and check it in
QemuServer"), even before krbd support was added in RBDPlugin.pm.

Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
Reviewed-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
16 months agozfs: list zvol: limit recursion depth to 1
Fiona Ebner [Tue, 10 Jan 2023 12:52:43 +0000 (13:52 +0100)]
zfs: list zvol: limit recursion depth to 1

To be correct in all cases, it's still necessary to filter by "pool"
in zfs_parse_zvol_list(), because $scfg->{pool} could be e.g.
'foo/vm-123-disk-0' which looks like an image name and would pass the
other "should skip"-checks in zfs_parse_zvol_list().

No change in the result of zfs_list_zvol() is intended.

Suggested-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
16 months agozfs: list zvol: skip different pools during parsing already
Fiona Ebner [Tue, 10 Jan 2023 12:52:42 +0000 (13:52 +0100)]
zfs: list zvol: skip different pools during parsing already

The 'pool' property in the result of zfs_parse_zvol_list() was not
used for anything else.

No functional change is intended.

Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
16 months agozfs: list zvol: return empty hash rather than undef
Fiona Ebner [Tue, 10 Jan 2023 12:52:41 +0000 (13:52 +0100)]
zfs: list zvol: return empty hash rather than undef

Avoids the need for the fallback for the (only existing) caller.

Note that the old my $list = (); is a rather intransparent way of
assigning undef.

Suggested-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
16 months agoplugin: change name, separator and error message for dir overrides
Leo Nunner [Thu, 5 Jan 2023 16:16:57 +0000 (17:16 +0100)]
plugin: change name, separator and error message for dir overrides

Rename the "dirs" parameter to "content-dirs". Switch from a "vtype:/dir"
format to "vtype=/dir", and remove the misleading error message talking
about "absolute" paths. One might expect these to be absolute over the
whole system, while in reality they are relative to the mountpoint of
the storage.

Signed-off-by: Leo Nunner <l.nunner@proxmox.com>
16 months agoconfig: add overrides for default directory locations
Leo Nunner [Mon, 2 Jan 2023 16:04:37 +0000 (17:04 +0100)]
config: add overrides for default directory locations

Allowing overrides for the default directory locations seems to
integrate rather well into the existing system. Custom locations
are specified using the "dirs" parameter as a comma-separated list
of "vtype:/location" values.

For now, the option has been enabled for the Directory, CIFS and NFS
backends.

Signed-off-by: Leo Nunner <l.nunner@proxmox.com>
16 months agozfs: list images: code cleanup
Fiona Ebner [Tue, 20 Dec 2022 13:16:38 +0000 (14:16 +0100)]
zfs: list images: code cleanup

Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
16 months agozfs: list images: don't use cache
Fiona Ebner [Tue, 20 Dec 2022 13:16:37 +0000 (14:16 +0100)]
zfs: list images: don't use cache

There is no caller using $cache and the same $storeid multiple times,
so there is no need to keep the cache.

Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
16 months agozfs: list: only cache and list images for requested storage/pool
Fiona Ebner [Tue, 20 Dec 2022 13:16:36 +0000 (14:16 +0100)]
zfs: list: only cache and list images for requested storage/pool

The plugin for remote ZFS storages currently also uses the same
list_images() as the plugin for local ZFS storages. There is only
one cache which does not remember the target host where the
information originated.

This is problematic for rescan in qemu-server:
1. Via list_images() and zfs_list_zvol(), ZFSPlugin.pm's zfs_request()
   is executed for a remote ZFS.
2. $cache->{zfs} is set to the result of scanning the images there.
3. Another list_images() for a local ZFS storage happens and uses the
   cache with the wrong information.

The only two operations using the cache currently are
1. Disk rescan in qemu-server which is affected by the issue. It is
   done as part of (or as a) long-running operations.
2. prepare_local_job for pvesr, but the non-local ZFS plugin doesn't
   support replication, so it cannot trigger there. The cache only
   helps if there is a replicated guest with volumes on different
   ZFS storages, but otherwise it will be less efficient than no
   cache or querying every storage by itself.

Fix the issue by making the cache $storeid-specific, which effectively
makes the cache superfluous, because there is no caller using the same
$storeid multiple times. As argued above, this should not really hurt
the callers described above much and actually improves performance for
all other callers.

Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
17 months agodisk manage: pass full NVMe device path to smartctl
Fiona Ebner [Mon, 12 Dec 2022 12:33:09 +0000 (13:33 +0100)]
disk manage: pass full NVMe device path to smartctl

This essentially reverts commit c9bd3d2 ("fix #1123: modify NVME
device path for SMART support").

The man page for smartctl states
> Use the forms "/dev/nvme[0-9]" (broadcast namespace) or
> "/dev/nvme[0-9]n[1-9]" (specific  namespace 1-9) for NVMe devices.
so it should be fine to pass the path with the specific namespace to
smartctl.

But that text was already present in the man page of version 6.5,
which is the version the commit c9bd3d2 talks about. It might be that
it was necessary to drop the specific namespace for the version
backported from Stretch to Jessie (the bug report mentions that that
version was used[0]), but it's not quite clear.

With current versions, passing in the path with the specific namespace
did work as expected[1], even on a device with multiple namespaces set
up tested locally. In PBS, the path queried via
udev::Device::from_syspath("/sys/block/{name}") is passed to smartctl
and that also included the specific namespace on the systems I tested
with a short script.

So pass the full path to make things a little bit simpler and to avoid
potential future issues like bug #2020[2].

[0]: https://bugzilla.proxmox.com/show_bug.cgi?id=1123#c3
[1]: https://forum.proxmox.com/threads/113962/post-493185
[2]: https://bugzilla.proxmox.com/show_bug.cgi?id=2020

Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
17 months agoRevert "Fix #2020: use /sys to map nvmeXnY to nvmeX"
Fiona Ebner [Mon, 28 Nov 2022 11:29:49 +0000 (12:29 +0100)]
Revert "Fix #2020: use /sys to map nvmeXnY to nvmeX"

This reverts commit c3442aa5546b029a524928d10c7ecabe0024c137.

Nowadays, relying on 'readlink /sys/block/nvmeXnY/device' won't always
lead to the correct device, as reported in the community forum[0],
where it results in '../../nvme-subsys0' and there's no matching entry
under '/dev/'.

Since Linux kernel 5.4, in particular commit 733e4b69d508 ("nvme:
Assign subsys instance from first ctrl"), the problematic situation
from bug #2020 shouldn't happen anymore.

Stated more clearly by the commit's author here[1]:
> Indeed, that commit will make the naming a bit more sane and will
> definitely prevent mistaken identity. It is still possible to
> observe controllers with instances that don't match their
> namespaces, but it is impossible to get a namespace instance that
> matches a non-owning controller.

The only other user of get_sysdir_info() doesn't use the 'device'
entry, so reverting that part is fine too.

[0] https://forum.proxmox.com/threads/113962/
[1] https://github.com/linux-nvme/nvme-cli/issues/510#issuecomment-552508647

Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
Tested-by: Stefan Hrdlicka <s.hrdlicka@proxmox.com>

17 months agobump version to 7.3-1
Thomas Lamprecht [Thu, 24 Nov 2022 07:26:55 +0000 (08:26 +0100)]
bump version to 7.3-1

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
17 months agoget bandwidth limit: improve detecting if storages are involved
Fiona Ebner [Wed, 23 Nov 2022 11:40:25 +0000 (12:40 +0100)]
get bandwidth limit: improve detecting if storages are involved

Previously, calling with e.g. $storage_list = [undef] would lead to an
early return of $override and not consider the limit from
datacenter.cfg.

Refactoring the bandwidth limit handling for migration introduced
calls such as described above, which broke applying the limit from
datacenter.cfg for VM RAM/state migration.

Reported in the community forum:
https://forum.proxmox.com/threads/37920/post-513005

Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
17 months agotest: bwlimit: fix test description
Fiona Ebner [Wed, 23 Nov 2022 11:40:24 +0000 (12:40 +0100)]
test: bwlimit: fix test description

Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
17 months agobump version to 7.2-12
Thomas Lamprecht [Thu, 17 Nov 2022 18:12:38 +0000 (19:12 +0100)]
bump version to 7.2-12

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
17 months agodisk manage: fix dereferencing draid config
Thomas Lamprecht [Thu, 17 Nov 2022 18:08:50 +0000 (19:08 +0100)]
disk manage: fix dereferencing draid config

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
17 months agobump version to 7.2-11
Thomas Lamprecht [Thu, 17 Nov 2022 16:51:13 +0000 (17:51 +0100)]
bump version to 7.2-11

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
18 months agoapi: FileRestore: make use of file-restores and guis timeout mechanism
Dominik Csapak [Thu, 10 Nov 2022 10:36:33 +0000 (11:36 +0100)]
api: FileRestore: make use of file-restores and guis timeout mechanism

file-restore has a 'timeout' parameter and if that is exceeded, returns
an error with the http code 503 Service Unavailable

When the web ui encounters such an error, it retries the listing a few
times before giving up.

To make use of these, add the 'timeout' parameter to the new
'extraParams' of 'file_restore_list'.

25 seconds are chosen because it's under pveproxy 30s limit, with a bit
of overhead to spare for the rest of the api call, like json decoding,
forking, access control checks, etc.

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
18 months agoapi: FileRestore: decode and return proper error of file-restore listing
Dominik Csapak [Thu, 10 Nov 2022 10:36:32 +0000 (11:36 +0100)]
api: FileRestore: decode and return proper error of file-restore listing

since commit
ba690c40 ("file-restore: remove 'json-error' parameter from list_files")

in proxmox-backup, the file-restore binary will return the error as json
when called with '--output-format json' (which we do in PVE::PBSClient)

here, we assume that 'file-restore' will fail in that case, and we try
to use the return value as an array ref which fails, and the user never
sees the real error message.

To fix that, check the ref type of the return value and act accordingly

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
18 months agoapi: storage: fix indentation in free volume
Thomas Lamprecht [Fri, 11 Nov 2022 12:49:08 +0000 (13:49 +0100)]
api: storage: fix indentation in free volume

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
18 months agodisk manage: draid: style clean ups
Thomas Lamprecht [Fri, 11 Nov 2022 08:23:49 +0000 (09:23 +0100)]
disk manage: draid: style clean ups

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
18 months agodisk manage: move "draid-config set only on draid level" assertion
Thomas Lamprecht [Fri, 11 Nov 2022 08:22:19 +0000 (09:22 +0100)]
disk manage: move "draid-config set only on draid level" assertion

so that there is a better code locality and also we avoid forgetting
to adapt the check for each specific draid-config parameter if a new
one gets added or an existing one changed.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
18 months agofix #3967: enable ZFS dRAID creation via API
Stefan Hrdlicka [Thu, 10 Nov 2022 13:24:48 +0000 (14:24 +0100)]
fix #3967: enable ZFS dRAID creation via API

It is possible to set the number of spares and the size of
data stripes via draidspares & dreaddata parameters.

Signed-off-by: Stefan Hrdlicka <s.hrdlicka@proxmox.com>
Tested-by: Lukas Wagner <l.wagner@proxmox.com>

18 months agozfs diskmanage: code/indentation cleanup in get_pool_data
Thomas Lamprecht [Fri, 11 Nov 2022 07:01:14 +0000 (08:01 +0100)]
zfs diskmanage: code/indentation cleanup in get_pool_data

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
18 months agopbs: prune: avoid getting all snapshots for group assembly if fixed anyway
Thomas Lamprecht [Mon, 7 Nov 2022 14:55:37 +0000 (15:55 +0100)]
pbs: prune: avoid getting all snapshots for group assembly if fixed anyway

If both type and vmid is defined we don't need to list the current
snapshots, we simply can derive the single backup group from that and
let the PBS client handle the rest.

Should be a not so small speedup for most setups using PBS backup and
pruning configured on PVE side, as vzdump calls this separately for
every vmid on backup jobs with multiple guests included.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
18 months agopbs: wrap getting list volumes for pruning for error context
Thomas Lamprecht [Mon, 7 Nov 2022 14:22:08 +0000 (15:22 +0100)]
pbs: wrap getting list volumes for pruning for error context

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
18 months agoapi: pbs: file restore: don't use namespaced parameters
Fabian Ebner [Wed, 20 Jul 2022 10:59:48 +0000 (12:59 +0200)]
api: pbs: file restore: don't use namespaced parameters

Instead, rely on PBSClient to set namespace according to the initial
configuration.

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
18 months agobump common dependency to 7.2-4
Wolfgang Bumiller [Fri, 4 Nov 2022 13:13:58 +0000 (14:13 +0100)]
bump common dependency to 7.2-4

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
19 months agobump version to 7.2-10
Thomas Lamprecht [Thu, 29 Sep 2022 12:33:18 +0000 (14:33 +0200)]
bump version to 7.2-10

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
19 months ago(remote) export: check and untaint format
Fabian Grünbichler [Wed, 28 Sep 2022 12:50:59 +0000 (14:50 +0200)]
(remote) export: check and untaint format

this format comes from the remote cluster, so it might not be supported
on the source side - checking whether it's known (as additional
safeguard) and untainting (to avoid open3 failure) is required.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
 [ T: squashed in canonical perl array ref access ]
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
19 months agoapi: disk SMART: fix details for depreacated return value comment
Thomas Lamprecht [Fri, 23 Sep 2022 09:59:33 +0000 (11:59 +0200)]
api: disk SMART: fix details for depreacated return value comment

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
19 months agodisk manage: module wide code/style cleanup
Thomas Lamprecht [Fri, 23 Sep 2022 09:54:41 +0000 (11:54 +0200)]
disk manage: module wide code/style cleanup

fixing some issues reported by perlcritic along the way.

cutting down 70 lines, often with even improving readability.
Tried to recheck and be conservative, so there shouldn't be any
regression, but it's still perl after all...

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
19 months agofix #4165: disk: SMART: add normalized field
Matthias Heiserer [Thu, 21 Jul 2022 10:45:58 +0000 (12:45 +0200)]
fix #4165: disk: SMART: add normalized field

This makes it consistent with the naming scheme in PBS/GUI.
Keep value for API stability reasons and remove it in the next major version.

Signed-off-by: Matthias Heiserer <m.heiserer@proxmox.com>
Reviewed-by: Dominik Csapak <d.csapak@proxmox.com>
Tested-by: Dominik Csapak <d.cspak@proxmox.com>
19 months agoapi: remove duplicate variable
Fabian Grünbichler [Tue, 20 Sep 2022 08:50:12 +0000 (10:50 +0200)]
api: remove duplicate variable

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
19 months agobump version to 7.2-9
Fabian Grünbichler [Tue, 20 Sep 2022 07:20:14 +0000 (09:20 +0200)]
bump version to 7.2-9

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
20 months agodisks: allow add_storage for already configured local storage
Aaron Lauterer [Fri, 19 Aug 2022 15:01:21 +0000 (17:01 +0200)]
disks: allow add_storage for already configured local storage

One of the smaller annoyances, especially for less experienced users, is
the fact, that when creating a local storage (ZFS, LVM (thin), dir) in a
cluster, one can only leave the "Add Storage" option enabled the first
time.

On any following node, this option needed to be disabled and the new
node manually added to the list of nodes for that storage.

This patch changes the behavior. If a storage of the same name already
exists, it will verify that necessary parameters match the already
existing one.
Then, if the 'nodes' parameter is set, it adds the current node and
updates the storage config.
In case there is no nodes list, nothing else needs to be done, and the
GUI will stop showing the question mark for the configured, but until
then, not existing local storage.

Signed-off-by: Aaron Lauterer <a.lauterer@proxmox.com>
Reviewed-by: Dominik Csapak <d.csapak@proxmox.com>
Tested-by: Dominik Csapak <d.csapak@proxmox.com>
20 months agodisks: die if storage name is already in use
Aaron Lauterer [Fri, 19 Aug 2022 15:01:20 +0000 (17:01 +0200)]
disks: die if storage name is already in use

If a storage of that type and name already exists (LVM, zpool, ...) but
we do not have a Proxmox VE Storage config for it, it is possible that
the creation will fail midway due to checks done by the underlying
storage layer itself. This in turn can lead to disks that are already
partitioned. Users would need to clean this up themselves.

By adding checks early on, not only checking against the PVE storage
config, but against the actual storage type itself, we can die early
enough, before we touch any disk.

For ZFS, the logic to gather pool data is moved into its own function to
be called from the index API endpoint and the check in the create
endpoint.

Signed-off-by: Aaron Lauterer <a.lauterer@proxmox.com>
Reviewed-by: Dominik Csapak <d.csapak@proxmox.com>
Tested-by: Dominik Csapak <d.csapak@proxmox.com>
20 months agodiskmanage: add mounted_paths
Aaron Lauterer [Fri, 19 Aug 2022 15:01:19 +0000 (17:01 +0200)]
diskmanage: add mounted_paths

returns a list of mounted paths with the backing devices

Signed-off-by: Aaron Lauterer <a.lauterer@proxmox.com>
Reviewed-by: Dominik Csapak <d.csapak@proxmox.com>
Tested-by: Dominik Csapak <d.csapak@proxmox.com>