]> git.proxmox.com Git - pve-storage.git/log
pve-storage.git
5 days agobump version to 8.1.5 master
Fabian Grünbichler [Thu, 11 Apr 2024 12:33:56 +0000 (14:33 +0200)]
bump version to 8.1.5

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
5 days agocephconfig: align our parser with Ceph's parser
Max Carrara [Tue, 2 Apr 2024 14:55:20 +0000 (16:55 +0200)]
cephconfig: align our parser with Ceph's parser

This commit rewrites the entire parser for ceph.conf, aligning its
behaviour as closely as possible with Ceph's parser grammar [0].

The most notable improvements are as follows:

  1. The characters '#' and ';' now both mark comments, instead of
     just the '#' character.

  2. Any character, including comment literals ('#' and ';'), may now
     be escaped.

  3. Quoted values (single and double) are now supported.

  4. Line continuations are now supported (lines ending with '\').

  5. Repeated whitespace characters in keys are now treated as a
     single space character.

  6. Dashes '-' are not treated the same as spaces and underscores
     anymore, as Ceph's grammar doesn't treat them that way.
     * Paired with 5., this means that repeated whitespace is now
       equivalent to a single underscore.

  7. Escaped comment literals are now un-escaped.

  8. Although not too crucial, the parser now also supports empty
     sections and will just initialize them with an empty hash.

Furthermore, the original grammar's more quirky behaviours are also
respected where sanely possible.

[0]: https://git.proxmox.com/?p=ceph.git;a=blob;f=ceph/src/common/ConfUtils.cc;h=2f78fd02bf9e27467275752e6f3bca0c5e3946ce;hb=e9fe820e7fffd1b7cde143a9f77653b73fcec748#l144

Signed-off-by: Max Carrara <m.carrara@proxmox.com>
Tested-by: Friedrich Weber <f.weber@proxmox.com>
5 days agocephconfig: escape un-escaped comment literals on write
Max Carrara [Tue, 2 Apr 2024 14:55:19 +0000 (16:55 +0200)]
cephconfig: escape un-escaped comment literals on write

in order to prevent configuration errors or the configuration being
misinterpreted.

Signed-off-by: Max Carrara <m.carrara@proxmox.com>
Tested-by: Friedrich Weber <f.weber@proxmox.com>
5 days agocephconfig: align written key-value pairs by tab
Max Carrara [Tue, 2 Apr 2024 14:55:18 +0000 (16:55 +0200)]
cephconfig: align written key-value pairs by tab

instead of tab + space.

Signed-off-by: Max Carrara <m.carrara@proxmox.com>
Tested-by: Friedrich Weber <f.weber@proxmox.com>
5 days agocephconfig: change order of written sections
Max Carrara [Tue, 2 Apr 2024 14:55:17 +0000 (16:55 +0200)]
cephconfig: change order of written sections

in order to group related sections together.

Additionally, sections that are associated with the client, for
example '[client.foo]', are written directly after the '[client]'
section.

Signed-off-by: Max Carrara <m.carrara@proxmox.com>
Tested-by: Friedrich Weber <f.weber@proxmox.com>
5 days agocephconfig: allow writing arbitrary sections
Max Carrara [Tue, 2 Apr 2024 14:55:16 +0000 (16:55 +0200)]
cephconfig: allow writing arbitrary sections

This adds support for writing arbitrary sections to 'ceph.conf' while
ensuring that already written sections are not duplicated.

Signed-off-by: Max Carrara <m.carrara@proxmox.com>
Tested-by: Friedrich Weber <f.weber@proxmox.com>
5 days agotest: add tests for 'ceph.conf' parser and writer
Max Carrara [Tue, 2 Apr 2024 14:55:14 +0000 (16:55 +0200)]
test: add tests for 'ceph.conf' parser and writer

These tests attempt to cover most of Ceph's config parser's grammar,
including all of its syntax quirks [0].

Each case is tested against two testing subroutines:

  1. The parser's output is compared with the expected output.

  2. The writer's output is parsed again ant then compared with the
     expected output.

[0]: https://git.proxmox.com/?p=ceph.git;a=blob;f=ceph/src/common/ConfUtils.cc;h=2f78fd02bf9e27467275752e6f3bca0c5e3946ce;hb=e9fe820e7fffd1b7cde143a9f77653b73fcec748#l144

Signed-off-by: Max Carrara <m.carrara@proxmox.com>
Tested-by: Friedrich Weber <f.weber@proxmox.com>
5 days agocephconfig: change code style inside config writer
Max Carrara [Tue, 2 Apr 2024 14:55:13 +0000 (16:55 +0200)]
cephconfig: change code style inside config writer

This commit changes the code style of subroutine `write_ceph_config`
to match our style guide [0] more.

Furthermore, the repeated calls to the inner subroutine are replaced
with a loop, while the regular expressions used by the inner `sub` are
now quoted with `qr` to prevent any accidental mis-quotings in the
future.

[0]: https://pve.proxmox.com/wiki/Perl_Style_Guide

Signed-off-by: Max Carrara <m.carrara@proxmox.com>
Tested-by: Friedrich Weber <f.weber@proxmox.com>
6 days agoesxi: guest types: use quotes for all hash-map keys
Thomas Lamprecht [Tue, 9 Apr 2024 11:18:50 +0000 (13:18 +0200)]
esxi: guest types: use quotes for all hash-map keys

A small coding style patch to make the list of guest-types mapping to
Windows easier to read.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
7 days agoesxi: add mapping for windows server 2016/2019
Stefan Sterz [Tue, 9 Apr 2024 10:56:11 +0000 (12:56 +0200)]
esxi: add mapping for windows server 2016/2019

previously these were mapped to the linux 2.6 default

Signed-off-by: Stefan Sterz <s.sterz@proxmox.com>
11 days agouse stderr from qemu-img invocation as error
Wolfgang Bumiller [Thu, 4 Apr 2024 10:55:40 +0000 (12:55 +0200)]
use stderr from qemu-img invocation as error

Instead of just using it as a warning and then trying to parse an
empty string as json.

For example, trying to parse unsupported vmdks, previously we'd see
something like this:

  qemu-img: Could not open
  '/run/pve/import/esxi/foo/mnt/ha-datacenter/vsanDatastore/asdf/asdf-000001.vmdk':
  Unsupported image type 'vsanSparse'
  could not parse qemu-img info command output for
  '/run/pve/import/esxi/foo/mnt/ha-datacenter/vsanDatastore/asdf/asdf-000001.vmdk'
  - malformed JSON string, neither tag, array, object, number, string
  or atom, at character offset 0 (before "(end of string)") at
  src/PVE/Storage/Plugin.pm line 962, <DATA> line 960.

Now it simply shows:

  qemu-img: Could not open
  '/run/pve/import/esxi/foo/mnt/ha-datacenter/vsanDatastore/asdf/asdf-000001.vmdk':
  Unsupported image type 'vsanSparse'

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2 weeks agoesxi: status: mark as active if its mounted
Thomas Lamprecht [Thu, 28 Mar 2024 18:12:06 +0000 (19:12 +0100)]
esxi: status: mark as active if its mounted

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 weeks agoesxi: drop unused variable and commented out code
Thomas Lamprecht [Thu, 28 Mar 2024 18:11:33 +0000 (19:11 +0100)]
esxi: drop unused variable and commented out code

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 weeks agobump version to 8.1.4
Thomas Lamprecht [Thu, 28 Mar 2024 16:37:32 +0000 (17:37 +0100)]
bump version to 8.1.4

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 weeks agod/control: bump versioned dependency for esxi-import-tool
Thomas Lamprecht [Thu, 28 Mar 2024 16:37:26 +0000 (17:37 +0100)]
d/control: bump versioned dependency for esxi-import-tool

to ensure new port-related CLI options are available

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 weeks agoesxi: add 'port' config parameter
Wolfgang Bumiller [Thu, 28 Mar 2024 13:18:34 +0000 (14:18 +0100)]
esxi: add 'port' config parameter

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2 weeks agobump version to 8.1.3
Thomas Lamprecht [Wed, 27 Mar 2024 11:38:59 +0000 (12:38 +0100)]
bump version to 8.1.3

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 weeks agoesxi: reduce cache invalidation time to 30s
Thomas Lamprecht [Wed, 27 Mar 2024 12:11:22 +0000 (13:11 +0100)]
esxi: reduce cache invalidation time to 30s

Reduce the time the cache stays valid from 60s to 30s, while this
could double the amount of requests in the worst case, it's still not
that frequent and also halves the maximal time a user has to wait to
see changes on the ESXi side to appear here.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 weeks agoesxi: use mac address when static, generated and vpx
Aaron Lauterer [Tue, 26 Mar 2024 12:04:38 +0000 (13:04 +0100)]
esxi: use mac address when static, generated and vpx

static -> defined manually
generated -> by ESXi
vpx -> generated by vCenter

Signed-off-by: Aaron Lauterer <a.lauterer@proxmox.com>
3 weeks agobump version to 8.1.2
Thomas Lamprecht [Fri, 22 Mar 2024 15:39:30 +0000 (16:39 +0100)]
bump version to 8.1.2

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 weeks agod/control: bump versioned dependency for esxi-import-tool
Thomas Lamprecht [Fri, 22 Mar 2024 15:39:10 +0000 (16:39 +0100)]
d/control: bump versioned dependency for esxi-import-tool

to ensure new CLI options for dropping privileges are available

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 weeks agoesxi: have the fuse process drop its privileges
Wolfgang Bumiller [Fri, 22 Mar 2024 12:24:13 +0000 (13:24 +0100)]
esxi: have the fuse process drop its privileges

once it's mounted it only needs to make http requests and talk to the
open fuse fd

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
3 weeks agoesxi: use listvms.py's stderr as error message
Wolfgang Bumiller [Fri, 22 Mar 2024 10:06:56 +0000 (11:06 +0100)]
esxi: use listvms.py's stderr as error message

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
3 weeks agoesxi: detect correct os type in 'other' family
Gabriel Goller [Thu, 21 Mar 2024 09:07:52 +0000 (10:07 +0100)]
esxi: detect correct os type in 'other' family

This patch introduces the conversion table for all possible OS Types
that are in the VMWare 'other' family and sets the pve counterpart.
Our default OS Type is 'linux', so including mappings to 'other' makes
sense.

Signed-off-by: Gabriel Goller <g.goller@proxmox.com>
3 weeks agoesxi: only add scsihw if it's defined
Dominik Csapak [Tue, 19 Mar 2024 13:00:28 +0000 (14:00 +0100)]
esxi: only add scsihw if it's defined

otherwise we get `scsihw: null` from the api, which is not a valid
value, so just omit it.

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 weeks agoesxi: add warning for losing efi state
Dominik Csapak [Tue, 19 Mar 2024 13:00:27 +0000 (14:00 +0100)]
esxi: add warning for losing efi state

we cannot import the state of the efivars (e.g. boot order)
so add a warning for that

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
 [ TL: add new warning to return schema ]
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
4 weeks agobump version to 8.1.1
Thomas Lamprecht [Wed, 13 Mar 2024 14:29:52 +0000 (15:29 +0100)]
bump version to 8.1.1

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
4 weeks agoesxi: deactivate storage if config gets updated
Thomas Lamprecht [Tue, 12 Mar 2024 17:34:33 +0000 (18:34 +0100)]
esxi: deactivate storage if config gets updated

to ensure that the next access actually uses the updated config for
accessing the remote ESXi, for both manifest API and FUSE mount.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
4 weeks agoesxi: clean-up state-dir in deactivate storage
Thomas Lamprecht [Tue, 12 Mar 2024 17:33:15 +0000 (18:33 +0100)]
esxi: clean-up state-dir in deactivate storage

to ensure we always query a new one on quick add-delete-add cycles.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
4 weeks agoesxi: deactivate storage on deletion from config
Thomas Lamprecht [Tue, 12 Mar 2024 17:34:04 +0000 (18:34 +0100)]
esxi: deactivate storage on deletion from config

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
4 weeks agoesxi: add 'skip-cert-verification' option
Wolfgang Bumiller [Tue, 12 Mar 2024 12:54:49 +0000 (13:54 +0100)]
esxi: add 'skip-cert-verification' option

following pve-esxi-import-tools's commits:
3ee5c3b ("esxi-folder-fuse: add --insecure option")
c292c67 ("listvms.py: add --insecure parameter, verify cert by
          default")
34c87be ("rename --insecure option to --skip-cert-verification")

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
 [ TL: rename 'insecure' to 'skip-cert-verification' to better convey
   what it means ]
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
4 weeks agoimport: rework plugin api to not need a blessed object
Dominik Csapak [Tue, 12 Mar 2024 11:51:26 +0000 (12:51 +0100)]
import: rework plugin api to not need a blessed object

does not really make sense, and if the plugin wants that, it can still
be done, like we do here for the ESXiPlugin

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
4 weeks 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>
4 weeks 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>
4 weeks 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>
4 weeks 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>
4 weeks 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>
4 weeks 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>
4 weeks 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>
4 weeks 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>
4 weeks 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>
4 weeks 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>
4 weeks 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>
4 weeks 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>
4 weeks 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>
4 weeks 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>
4 weeks 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>
4 weeks 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>
4 weeks 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>
4 weeks 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>
4 weeks 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>
4 weeks 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>
5 weeks 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>
6 weeks 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>
6 weeks 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>
6 weeks 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>
6 weeks 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>
2 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>
2 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>
2 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>
4 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>
4 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>
5 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>
5 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>
5 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>
5 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>
5 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>
5 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>
5 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
8 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>
8 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>
9 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>
9 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>
9 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>
9 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>
9 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>
9 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>
9 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>