]> git.proxmox.com Git - pve-storage.git/log
pve-storage.git
2 months agoimport: drop target parameter
Wolfgang Bumiller [Tue, 12 Mar 2024 12:58:45 +0000 (13:58 +0100)]
import: drop target parameter

since disks are a separate hash now with no associated storage, we
don't need this anymore

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2 months agoesxi: add disk capacity to import metadata
Wolfgang Bumiller [Mon, 11 Mar 2024 13:02:14 +0000 (14:02 +0100)]
esxi: add disk capacity to import metadata

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2 months agoesxi: warn if the guest was running
Wolfgang Bumiller [Mon, 11 Mar 2024 12:50:16 +0000 (13:50 +0100)]
esxi: warn if the guest was running

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2 months agoesxi: add helper to get vm from manifest for vmx path
Wolfgang Bumiller [Mon, 11 Mar 2024 12:49:58 +0000 (13:49 +0100)]
esxi: add helper to get vm from manifest for vmx path

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2 months agoesxi: let manifest file expire after 60s
Wolfgang Bumiller [Mon, 11 Mar 2024 12:13:19 +0000 (13:13 +0100)]
esxi: let manifest file expire after 60s

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
 [ TL: fix wrong comparison with >= and avoid undef warning if file
   does not yet exist at all ]
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 months agoesxi: drop unused sub methods
Wolfgang Bumiller [Mon, 11 Mar 2024 12:08:22 +0000 (13:08 +0100)]
esxi: drop unused sub methods

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
 [ TL: squash removal of both subs into one commit ]
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 months agoapi: import-metadata: make warnings structured & merge ignored-volumes
Thomas Lamprecht [Sun, 10 Mar 2024 18:25:34 +0000 (19:25 +0100)]
api: import-metadata: make warnings structured & merge ignored-volumes

This allows the frontends to translate them and avoids somewhat
duplicated info by having some warnings explicitly (ignored-volumes)
while others are in the warnings array.

By passing along the key and the value the frontend can also show the
warnings in-line, e.g. by marking a disk-entry in a grid as having
potential problems.

Ideally we'd have a central list of known types used for the API
return schema enum and to check when calling the $warn closure, but as
we only got three warnings keep this as is and only add a comment.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 months agoapi: import-metadata: complete return schema
Thomas Lamprecht [Sun, 10 Mar 2024 17:50:45 +0000 (18:50 +0100)]
api: import-metadata: complete return schema

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 months agoesxi plugin: do not support the images content-type
Thomas Lamprecht [Sun, 10 Mar 2024 17:46:34 +0000 (18:46 +0100)]
esxi plugin: do not support the images content-type

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 months agoesxi plugin: adapt to new libexec path for helpers
Thomas Lamprecht [Sun, 10 Mar 2024 17:45:15 +0000 (18:45 +0100)]
esxi plugin: adapt to new libexec path for helpers

and rename the name of the constant for the FUSE tool, as otherwise it
sounds like this was the mountpoint to be used

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 months agoesxi import: deal with serial devices
Wolfgang Bumiller [Fri, 8 Mar 2024 13:06:47 +0000 (14:06 +0100)]
esxi import: deal with serial devices

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2 months agoadd source field to import-metadata
Wolfgang Bumiller [Fri, 8 Mar 2024 12:34:58 +0000 (13:34 +0100)]
add source field to import-metadata

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2 months agoadd a warnings array to import-metadata
Wolfgang Bumiller [Fri, 8 Mar 2024 12:34:31 +0000 (13:34 +0100)]
add a warnings array to import-metadata

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2 months agoesxi: improve scsihw detection
Wolfgang Bumiller [Fri, 8 Mar 2024 09:52:33 +0000 (10:52 +0100)]
esxi: improve scsihw detection

we should actually keep the scsihw even with eg. linux VMs as they
might not have virtio/... in their initrd and then fail to boot

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2 months agoesxi: separate disks and network
Wolfgang Bumiller [Fri, 8 Mar 2024 09:43:16 +0000 (10:43 +0100)]
esxi: separate disks and network

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2 months agoimport: return skipped/ignored volumes in get_create_args
Wolfgang Bumiller [Wed, 6 Mar 2024 14:14:05 +0000 (15:14 +0100)]
import: return skipped/ignored volumes in get_create_args

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2 months agoapi: add storage/{storage}/import-metadata
Wolfgang Bumiller [Wed, 6 Mar 2024 13:13:54 +0000 (14:13 +0100)]
api: add storage/{storage}/import-metadata

This will be used for returning the base meta information of a
external VM that is about to be imported into Proxmox VE.

A front-end can use this endpoint to show the proposed configs with
potential override switches to the user, so that they can adapt the
most important options to ensure that import can work.

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
 [ TL: add more commit message with some background ]
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 months agoadd ESXi plugin for import and wire-it up to a new get_guest_import plugin fn
Wolfgang Bumiller [Mon, 4 Mar 2024 09:10:47 +0000 (10:10 +0100)]
add ESXi plugin for import and wire-it up to a new get_guest_import plugin fn

The get_guest_import fn is currently a private/internal API and should
not yet be exposed as a public part of the storage API.

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2 months agobump pve-common dep to 8.1.1 for PVE::Systemd::unit_is_active
Wolfgang Bumiller [Wed, 6 Mar 2024 13:49:36 +0000 (14:49 +0100)]
bump pve-common dep to 8.1.1 for PVE::Systemd::unit_is_active

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2 months agostorage plugins: add 'import' content type
Wolfgang Bumiller [Mon, 4 Mar 2024 09:10:33 +0000 (10:10 +0100)]
storage plugins: add 'import' content type

Add a new 'import' content type which will be the corner stone for a
better API and UI integrated way to import virtual guests into Proxmox
VE.

For starters this will be used to implement a ESXi adapter, so that
those VMs can get imported nicely.

Later we want to integrate the OVF/OVA import skeletons we got in
qemu-server to something more usable here.

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
 [ TL: add more commit message with some background ]
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 months agobump version to 8.1.0
Thomas Lamprecht [Wed, 6 Mar 2024 17:26:01 +0000 (18:26 +0100)]
bump version to 8.1.0

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 months agobuildsys: cleanup all docs and shell comnpletion artefacts
Thomas Lamprecht [Tue, 5 Mar 2024 10:26:30 +0000 (11:26 +0100)]
buildsys: cleanup all docs and shell comnpletion artefacts

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 months agod/copyright: update years
Thomas Lamprecht [Fri, 1 Mar 2024 09:13:24 +0000 (10:13 +0100)]
d/copyright: update years

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 months agod/control: add dependency relation on libpve-access-control
Thomas Lamprecht [Wed, 28 Feb 2024 14:51:23 +0000 (15:51 +0100)]
d/control: add dependency relation on libpve-access-control

We actually use it already (partially without perl use statement) and
the use of the new Sys.AccessNetwork privilege should be version
guarded too.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 months agofix #5254: api: allow usage of download-url with Sys.AccessNetwork
Thomas Lamprecht [Mon, 19 Feb 2024 16:13:41 +0000 (17:13 +0100)]
fix #5254: api: allow usage of download-url with Sys.AccessNetwork

The download-url API endpoint has some implications that admins are
unaware of, namely that it basically allow to scan the whole network
via HTTP URLs, and potentially even download some image that the user
should not have access to and adding to a VM that the user controls.

That's why in addition to the Datastore.AllocateTemplate privilege on
the storage, the Sys.Modify on the whole Cluster was required to use
the API call. That design was chosen as we were not fully sure if a
separate privilege is warranted, but user feedback has shown that the
(not so big) cost of adding such a new privilege is justified.

Change the permission check to allow the combination of
Datastore.AllocateTemplate on the storage and either 'Sys.Modify' on
/, for backwards compatibility, or the newer 'Sys.AccessNetwork' on
the node that handles the download.
Using a node-specific ACL path allows admins to e.g. prepare one
specific node's firewall so that pveproxy can access only a safe set
of hosts via outgoing HTTP (not stemming from valid connection
tracking to the PVE API), and thus even further limit the privileges
of users or tools that are trusted to download images to a storage.

Buglink: https://bugzilla.proxmox.com/show_bug.cgi?id=5254
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
Tested-by: Hannes Duerr <h.duerr@proxmox.com>
Reviewed-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
3 months agoplugin schema: improve description of 'shared' property
Fiona Ebner [Tue, 30 Jan 2024 10:28:31 +0000 (11:28 +0100)]
plugin schema: improve description of 'shared' property

It's not clear to users what this property does otherwise. Latest
report from the community forum:

https://forum.proxmox.com/threads/134393

Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
3 months agoplugin schema: improve description of 'nodes' property
Fiona Ebner [Wed, 4 Oct 2023 07:35:41 +0000 (09:35 +0200)]
plugin schema: improve description of 'nodes' property

The default description doesn't make it clear what the property is
used for in the context of storages.

Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
3 months agozfs: fix duplicate word typo in error message
Fiona Ebner [Tue, 30 Jan 2024 09:11:04 +0000 (10:11 +0100)]
zfs: fix duplicate word typo in error message

Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
5 months agobump version to 8.0.5
Thomas Lamprecht [Tue, 21 Nov 2023 20:20:57 +0000 (21:20 +0100)]
bump version to 8.0.5

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
5 months agobtrfs: fix calling parent create_base method in fall-back
Thomas Lamprecht [Sun, 19 Nov 2023 19:05:50 +0000 (20:05 +0100)]
btrfs: fix calling parent create_base method in fall-back

If we want to forward to the create_base of the directory plugin while
making that use our $class for the operations that call might do, we
cannot use the -> notation (which would resolve the next actual
implementation) but rather pass the class directly.
But, DirPlugin reuses the create_base method from the base Plugin
method, so we also need to call that, because on direct call notation
the inheritance fallback to super methods isn't available.

Reported in the forum:
https://forum.proxmox.com/threads/95684/post-606535

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
6 months agobump version to 8.0.4
Thomas Lamprecht [Mon, 13 Nov 2023 17:12:48 +0000 (18:12 +0100)]
bump version to 8.0.4

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
6 months agodisks: get: add osdid-list return parameter
Aaron Lauterer [Tue, 22 Aug 2023 09:04:55 +0000 (11:04 +0200)]
disks: get: add osdid-list return parameter

It is possible to run multiple OSD daemons on one disk. The new
'osdid-list' parameter returns an array of all OSD IDs found on the
disk.

The old 'osdid' parameter is kept for compatibility. We might want to
deprecate / remove it in the future.

Signed-off-by: Aaron Lauterer <a.lauterer@proxmox.com>
6 months agod/control: bump versioned dependency for libpve-common-perl to >= 8.0.10
Thomas Lamprecht [Mon, 13 Nov 2023 15:44:41 +0000 (16:44 +0100)]
d/control: bump versioned dependency for libpve-common-perl to >= 8.0.10

to ensure the new tar parameter for the pbs-client is known

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
6 months agoapi/filerestore: add 'tar' parameter to 'download' api
Dominik Csapak [Thu, 19 Oct 2023 09:13:54 +0000 (11:13 +0200)]
api/filerestore: add 'tar' parameter to 'download' api

to be able to download 'tar.zst' archives

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
6 months agoiscsi: code cleanups
Thomas Lamprecht [Fri, 27 Oct 2023 11:44:05 +0000 (13:44 +0200)]
iscsi: code cleanups

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
6 months agoiscsi: always recheck if iscsiadm binary is available
Thomas Lamprecht [Fri, 27 Oct 2023 11:42:46 +0000 (13:42 +0200)]
iscsi: always recheck if iscsiadm binary is available

this avoids the need for restarting all services that have pve-storage
modules loaded after the admin installed open-iscsi.

while at it make it a bit more clear that this might die by using
assert in the method name.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
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>