Commit Graph

2133 Commits

Author SHA1 Message Date
d97d7ff676 plugin: volume export formats: avoid superfluous file_size_info() call
The result from the file_size_info() call is not used by
volume_export_formats() and most failure scenarios of file_size_info()
lead to an undefined return value rather than a failure. This includes
the case for a non-existent file. The default path() implementation
doesn't do any existence check either.

An interesting scenario where file_size_info() does fail, is when the
volume is corrupted or not in the queried format. But this is a rare
edge case, so an early check doesn't seem worth it. It will be caught
by volume_export() itself, or in case of VM migration, also when
querying the size during scanning of local volumes.

While checking for the definedness of $size could serve as an early
sanity check, it is not currently done and other plugins don't do such
early checks in their implementation of volume_export_formats()
either. Keep the implementation abstract in Plugin.pm too and avoid
doing IO. Callers that want to do early existence checks or similar
can do so themselves explicitly, covering all plugins.

Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
Link: https://lore.proxmox.com/20250303092445.13873-4-f.ebner@proxmox.com
2025-04-06 21:57:58 +02:00
00105c8003 btrfs: fix volume size info for subvolumes in scalar context
Return the same size as in list context. See also commit "plugin: file
size info: be consistent about size of directory subvol".

Fixes cloning containers with unsized subvolumes on BTRFS. Before the
change, this would fail with "mkfs.ext4: Device size reported to be
zero.". That is because with non-zero size, the allocation of the
volume for the clone will be done with 'raw' format by the
alloc_disk() helper in LXC.pm rather than 'subvol'. This change will
make cloning containers with unsized subvol directories possible.

Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
Link: https://lore.proxmox.com/20250303092445.13873-3-f.ebner@proxmox.com
2025-04-06 21:57:58 +02:00
544dc0e893 plugin: file size info: be consistent about size of directory subvol
In list context, the file_size_info() function in Plugin.pm would
return 0 for the size of a subvol directory, but in scalar context 1.
As reported in the community forum [0], the change in commit e50dde0
("volume export: rely on storage plugin's format"), changing the
caller in volume_export() to scalar context exposed the inconsistency
in the return value for the size. This led to breakage of migration
with unsized btrfs subvolumes.

Align the returned values to avoid such surprises. Caller that would
treat 0 as an error should use list context and check if it is a
subvol, if they are able to handle them.

NOTE: it is not possible to attach either a subvol, or a volume with
zero size to a VM.

Existing callers of file_size_info() do not break with this change:
GuestImport/OVF.pm - parse_ovf() +
API/Qemu.pm - create_disks():
  Doesn't support subvol directories, dies if size is 0.
Storage/Plugin.pm - create_base() +
Storage/{BTRFS,}Plugin.pm - list_images():
  Checks for definedness of $size.
Storage/{BTRFS,ESXi,}Plugin.pm - volume_size_info():
  Transitive, see below.
Storage/Plugin.pm - volume_export():
  Regressed by commit e50dde0, this change will restore previous
  behavior.
Storage/Plugin.pm - volume_export_formats() +
GuestImport.pm - extract_disk_from_import_file() +
Storage.pm - assert_iso_content():
  Doesn't use the result.
CLI/qm.pm - importdisk:
  Dies early if source is a directory.
CLI/qm.pm - importovf:
  Calls parse_ovf() earlier.

Existing callers of volume_size_info() do not break with this change:
API2/Storage/Content.pm - info:
  Uses list context, not affected by change.
QemuMigrate.pm - scan_local_volumes() +
API2/Qemu.pm - create_disks(), first call:
  Uses list context, not affected by change, does not support subvol
  directories.
API2/Qemu.pm - create_disks(), second call +
API2/Qemu.pm - import_from_volid():
  Doesn't support subvol directories, dies if size is 0.
API2/Qemu.pm - resize_vm +
VZDump/QemuServer.pm - prepare() +
QemuServer.pm - clone_disk() +
QemuServer.pm - create_efidisk():
  Doesn't support subvol directories (see NOTE above), but would not
  die directly if size is 0. (In case of create_efidisk(), the size of
  the just created disk is queried.)
API2/LXC.pm - resize_vm:
  For directory plugins, the subsequent call to resize_volume() fails
  with "can't resize this image format".
  For BTRFS, quotas are currently not supported and the call to
  resize_volume() fails with "failed to get btrfs subvolume ID from:".
  This is because the btrfs 'subvol show' command is invoked with
  '-q', so there is no output. Even if it would work, it would be more
  correct to use 0 as the current size to add to the new quota rather
  than 1.
LXC/Config.pm - rescan_volume():
  This will happily use size=1 from before this change, but that is
  not correct. A subsequent 'pct rescan' will correct the size to 0.
  It is only used when hotplugging an existing subvol directory.
LXC.pm - copy_volume():
  This will happily use size=1 from before this change, but that is
  not correct and will lead to failure "mkfs.ext4: Device size
  reported to be zero.". That is because with non-zero size, the
  allocation of the volume for the clone will be done with 'raw'
  format by the alloc_disk() helper in LXC.pm rather than 'subvol'.
  This change will make cloning containers with unsized subvol
  directories possible.
QemuServer/Cloudinit.pm - commit_cloudinit_disk():
  Doesn't support subvol directories (see NOTE above), will allocate
  a new volume when size is 0.

[0]: https://forum.proxmox.com/threads/162943/

Fixes: e50dde0 ("volume export: rely on storage plugin's format")
Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
Link: https://lore.proxmox.com/20250303092445.13873-2-f.ebner@proxmox.com
2025-04-06 21:57:58 +02:00
d0eb7df3af bump version to 8.3.5
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2025-04-06 21:18:43 +02:00
a9a2782d77 fix #3986: directory plugin: remove trailing slashes
Currently, setting up a directory storage with trailing slashes in the
path results in log messages with double slashes, if this path gets
expanded by an action like vzdump. While this is just a cosmetic
issue, it looks odd and some users might think this is a bug if they
currently investigate some other issue and see such paths.

This patch removes those trailing slashes once the directory storage
class config gets updated.

Signed-off-by: Daniel Herzig <d.herzig@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2025-04-06 21:18:20 +02:00
32f55f8c0d btrfs: volume export: fix command for incremental stream
The subvolume itself cannot be included if there is a base snapshot
or the command would fail with e.g.

> ERROR: subvolume /mnt/btrfs/images/400/vm-400-disk-0 is not read-only

Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
2025-04-06 21:18:20 +02:00
2ef1d256e7 btrfs: volume import: fix check for presence of base snapshot
For a 'raw' volume, the path includes the '/disk.raw' suffix, but the
check expects the containing subvolume directory.

Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
2025-04-06 21:18:20 +02:00
0e58fffcc2 volume export: fix handling of snapshot list
The split_list() helper will return a list, and assignment in scalar
context would result in the number of elements, instead of having the
desired array reference, that the BTRFS plugin expects.

Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
2025-04-06 21:18:20 +02:00
8a183b5db2 disk management: account for leading white space in serial number
some manufacturer seem to report leading white space in the
`ID_SERIAL_SHORT` field. the regex failed here, as it just didn't
match the whitespace at all.

reported on the forum:
https://forum.proxmox.com/threads/nvme-drive-serial-unknown.163480/#post-754953

Signed-off-by: Shannon Sterz <s.sterz@proxmox.com>
Link: https://lore.proxmox.com/20250312083819.15379-1-s.sterz@proxmox.com
2025-04-06 21:18:14 +02:00
afc58d4d95 extract backup config: delegate to backup provider for storages that support it
Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
Tested-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
Reviewed-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
Link: https://lore.proxmox.com/20250404133204.239783-8-f.ebner@proxmox.com
2025-04-06 20:58:27 +02:00
e2dc01ac9f plugin api: bump api version and age
Changes for version 11:

* Allow declaring storage features via plugin data.
* Introduce new_backup_provider() plugin method.
* Allow declaring sensitive properties via plugin data.

See the api changelog file for details.

Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
Tested-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
Reviewed-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
Link: https://lore.proxmox.com/20250404133204.239783-7-f.ebner@proxmox.com
2025-04-06 20:57:40 +02:00
db5c50c079 config api/plugins: let plugins define sensitive properties themselves
Hard-coding a list of sensitive properties means that custom plugins
cannot define their own sensitive properties for the on_add/on_update
hooks.

Have plugins declare the list of their sensitive properties in the
plugin data. For backwards compatibility, return the previously
hard-coded list if no such declaration is present.

Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
Tested-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
Reviewed-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
Link: https://lore.proxmox.com/20250404133204.239783-6-f.ebner@proxmox.com
2025-04-06 20:57:40 +02:00
ff971aefc0 plugin: introduce method for native external backup provider support
The new_backup_provider() method can be used by storage plugins for
external backup providers. If the method returns a provider, Proxmox
VE will use callbacks to that provider for backups and restore instead
of using its usual backup/restore mechanisms.

The backup provider API is split into two parts, both of which again
need different implementations for VM and LXC guests:

1. Backup API

In Proxmox VE, a backup job consists of backup tasks for individual
guests. There are methods for initialization and cleanup of the job,
i.e. job_init() and job_cleanup() and for each guest backup, i.e.
backup_init() and backup_cleanup().

The backup_get_mechanism() method is used to decide on the backup
mechanism. Currently, 'file-handle' or 'nbd' for VMs, and 'directory'
for containers is possible. The method also let's the plugin indicate
whether to use a bitmap for incremental VM backup or not. It is enough
to implement one mechanism for VMs and one mechanism for containers.

Next, there are methods for backing up the guest's configuration and
data, backup_vm() for VM backup and backup_container() for container
backup, with the latter running

Finally, some helpers like getting the provider name or volume ID for
the backup target, as well as for handling the backup log.

The backup transaction looks as follows:

First, job_init() is called that can be used to check backup server
availability and prepare the connection. Then for each guest
backup_init() followed by backup_vm() or backup_container() and finally
backup_cleanup(). Afterwards job_cleanup() is called. For containers,
there is an additional backup_container_prepare() call while still
privileged. The actual backup_container() call happens as the
(unprivileged) container root user, so that the file owner and group IDs
match the container's perspective.

1.1 Backup Mechanisms

VM:

Access to the data on the VM's disk from the time the backup started
is made available via a so-called "snapshot access". This is either
the full image, or in case a bitmap is used, the dirty parts of the
image since the last time the bitmap was used for a successful backup.
Reading outside of the dirty parts will result in an error. After
backing up each part of the disk, it should be discarded in the export
to avoid unnecessary space usage on the Proxmox VE side (there is an
associated fleecing image).

VM mechanism 'file-handle':

The snapshot access is exposed via a file descriptor. A subroutine to
read the dirty regions for incremental backup is provided as well.

VM mechanism 'nbd':

The snapshot access and, if used, bitmap are exported via NBD.

Container mechanism 'directory':

A copy or snapshot of the container's filesystem state is made
available as a directory. The method is executed inside the user
namespace associated to the container.

2. Restore API

The restore_get_mechanism() method is used to decide on the restore
mechanism. Currently, 'qemu-img' for VMs, and 'directory' or 'tar' for
containers are possible. It is enough to implement one mechanism for
VMs and one mechanism for containers.

Next, methods for extracting the guest and firewall configuration and
the implementations of the restore mechanism via a pair of methods: an
init method, for making the data available to Proxmox VE and a cleanup
method that is called after restore.

2.1. Restore Mechanisms

VM mechanism 'qemu-img':

The backup provider gives a path to the disk image that will be
restored. The path needs to be something 'qemu-img' can deal with,
e.g. can also be an NBD URI or similar.

Container mechanism 'directory':

The backup provider gives the path to a directory with the full
filesystem structure of the container.

Container mechanism 'tar':

The backup provider gives the path to a (potentially compressed) tar
archive with the full filesystem structure of the container.

See the PVE::BackupProvider::Plugin module for the full API
documentation.

Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
 [WB: replace backup_vm_available_bitmaps with
  backup_vm_query_incremental, which instead of a bitmap name provides
  a bitmap mode that is 'new' (create or *recreate* a bitmap) or 'use'
  (use an existing bitmap, or create one if none exists)]
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
Tested-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
Reviewed-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
Link: https://lore.proxmox.com/20250404133204.239783-5-f.ebner@proxmox.com
2025-04-06 20:55:50 +02:00
bbedead5fc common: add deallocate helper function
For punching holes via fallocate. This will be useful for the external
backup provider API to discard parts of the source. The 'file-handle'
mechanism there uses a fuse mount, which does not implement the
BLKDISCARD ioctl, but does implement fallocate.

Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
Tested-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
Reviewed-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
Link: https://lore.proxmox.com/20250404133204.239783-4-f.ebner@proxmox.com
2025-04-06 20:55:50 +02:00
0066560da4 add storage_has_feature() helper function
Which looks up whether a storage supports a given feature in its
'plugindata'. This is intentionally kept simple and not implemented
as a plugin method for now. Should it ever become more complex
requiring plugins to override the default implementation, it can
later be changed to a method.

Suggested-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
Tested-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
Reviewed-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
Link: https://lore.proxmox.com/20250404133204.239783-3-f.ebner@proxmox.com
2025-04-06 20:52:55 +02:00
7c62215e48 fix #3716: api: download from url: use proxy option for https
The web UI uses the download-url endpoint for downloading an ISO, VZ
template, or OVA file via wget. In a setup where this request has to
go over a proxy (configured in the http_proxy datacenter option), the
download only works for http:// URLs, not https:// URLs. The reason is
that the download-url handler does not pass the https_proxy option to
the download_file_from_url helper, hence the helper only sets the
http_proxy environment variable for wget, not the https_proxy one.

Fix this by also passing the https_proxy option to the
download_file_from_url helper.

This will break setups that rely on http_proxy not being respected for
https:// URLs. For example, setups that have a proxy for external
connections, but download e.g. ISO files (only) via https from an
internal repository that the proxy doesn't serve.

Signed-off-by: Friedrich Weber <f.weber@proxmox.com>
Reviewed-by: Maximiliano Sandoval <m.sandoval@proxmox.com>
Tested-by: Maximiliano Sandoval <m.sandoval@proxmox.com>
Link: https://lore.kernel.org/r/20250326105108.34911-2-f.weber@proxmox.com
2025-04-05 18:24:39 +02:00
22ac96a00b bump version to 8.3.4
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2025-04-03 19:20:21 +02:00
2569cb4604 introduce 'pve-storage-image-format' standard option for image format
The new 'pve-storage-image-format' standard option uses a simple enum
instead of a subroutine verifier. Since the 'pve-storage-format'
format that is replaced by it was used in pve-guest-common's
StorageTunnel, the format cannot be removed without a versioned
breaks.

Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
Acked-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
Reviewed-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2025-04-03 18:51:18 +02:00
559867f79b api: alloc: allow 'vmdk' for the 'format' option
The API endpoint will automatically detect the format from the
extension for raw, qcow2 and vmdk, but it was not yet possible to
specify the format explicitly via the parameter. This could be
annoying/surprising to users. There also might be third-party plugins
that want to use vmdk, but not require a suffix in the name. Add
'vmdk' as an allowed format to avoid these issues and for consistency
by using the 'pve-storage-format' format.

Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
Acked-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
Reviewed-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2025-04-03 18:51:18 +02:00
1b38ad0e27 schema: anchor regex for 'pve-storage-format'
Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
Acked-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
Reviewed-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2025-04-03 18:51:18 +02:00
bba0b3ae46 api: code cleanup: remove unused Data::Dumper include
Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
Acked-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
Reviewed-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2025-04-03 18:51:18 +02:00
43ad71bf30 plugin: file size info: remove ancient 'cow' from formats
The format was dropped in QEMU binary version 2.2 with commit
550830f935 ("block: delete cow block driver").

This follows qemu-server commit "drive: remove ancient 'cow' from
formats".

Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
Acked-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
Reviewed-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2025-04-03 18:51:18 +02:00
32e482a617 fix #957: iscsi: improve iscsi_test_portal logic
Check if there is already a logged session present and fall back to
previous TCP check port connection.

pvestatd is calling check_connection every 10 seconds.  This check
produces a lot of noise at the iscsi server logging.

Signed-off-by: Victor Seva <linuxmaniac@torreviejawireless.org>
Tested-by: Mira Limbeck <m.limbeck@proxmox.com>
Reviewed-by: Mira Limbeck <m.limbeck@proxmox.com>
Tested-by: Friedrich Weber <f.weber@proxmox.com>
Reviewed-by: Friedrich Weber <f.weber@proxmox.com>
2025-03-25 19:35:09 +01:00
9dd136c8df btrfs: volume export: add note to clarify special handling of 'snapshot' argument
Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
2025-02-24 10:18:38 +01:00
424280a16c btrfs: avoid superfluous check in foreach_snapshot_of_subvol() helper
The helper iterates with the BTRFS_SNAPSHOT_REGEX regular expression,
so there will always be a snapshot name.

Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
2025-02-24 10:18:35 +01:00
a25b1050ce btrfs: rename snapshot parameter
It was originally introduced as $snapshot to match the argument name of
foreach_subvol, we rename it here to make it clear that it only contains
the snapshot name.

Signed-off-by: Maximiliano Sandoval <m.sandoval@proxmox.com>
2025-02-20 15:57:02 +01:00
3abd10cedf btrfs: remove foreach_subvol
This method is not used anymore.

Signed-off-by: Maximiliano Sandoval <m.sandoval@proxmox.com>
2025-02-20 15:57:02 +01:00
cae30fef56 btrfs: rename volume regex
The regex only lists snapshots.

Signed-off-by: Maximiliano Sandoval <m.sandoval@proxmox.com>
2025-02-20 15:57:02 +01:00
d3b84d73fd btrfs: forcefully set image to readwrite
When a subvolume is transferred via btrfs send/receive the resulting
image contains the received_uuid property set. This property is required
to do incremental snapshots.

A downside though is that once the received_uuid property is set, it is
not possible to make the image readwrite again without the force (-f)
flag, and in such case the received_uuid property is lost. Since we know
the images are only set to rw for the duration of the move, it is safe
to set the flag forcefully and then in a future commit add the
received_uuid property by force.

Signed-off-by: Maximiliano Sandoval <m.sandoval@proxmox.com>
2025-02-20 15:57:02 +01:00
c2db0cb7d5 btrfs: use foreach_snapshot_of_subvol helper in free_image
Replaces the current use without changes. The `$dir` variable is not
used anymore at that moment so it is defined later.

Signed-off-by: Maximiliano Sandoval <m.sandoval@proxmox.com>
2025-02-20 15:57:02 +01:00
c05ef0dbce fix #3873: btrfs: use foreach_snapshot_of_subvol helper in volume_export
Suppose we are taking a snapshot of VM 100's disk-0. The
dir_glob_foreach runs over $path=/subvolume/images/100, lists all
snapshot names and appends their names to the path of the disk, e.g.
/subvolume/images/vm-100-disk-0@SNAP_NAME, but the original directory
$path might contain a second disk `vm-100-disk-1` which is also listed
by the dir_glib_foreach.

By using the helper we only iterate over the snapshots of the guest.

Signed-off-by: Maximiliano Sandoval <m.sandoval@proxmox.com>
2025-02-20 15:57:02 +01:00
171b760d81 btrfs: add helper to iterate over snapshots of a subvolume
In this context a subvolume means a BTRFS subvolume.
`$volume\@$snap_name` would be for example
`btrfs_volume/images/102/vm-102-disk-0@snap_name`.

Signed-off-by: Maximiliano Sandoval <m.sandoval@proxmox.com>
2025-02-20 15:57:02 +01:00
70955c2d34 api: {upload, download}_url: factor out common parameter hash accesses
Minor cleanup to reduce the amount of `$param->{...}` to variables in
the upload and download url API handler.

Signed-off-by: Daniel Kral <d.kral@proxmox.com>
2025-02-19 16:25:40 +01:00
bdabd1296b iscsidirect plugin: do not use cache in list_images()
A static cache key 'directiscsi' was used to cache storeid-specific
information. This was causing issues in case of multiple instances.

Drop $cache usage instead of fixing the issue as there is no caller
using it and the same portal/storeid multiple times.

Remove $storeid from iscsi_ls() and its callers.

Signed-off-by: Dmitry Petrov <dpetrov67@gmail.com>
2025-02-12 14:28:34 +01:00
9b7c1746f1 rbd plugin: do not use cache in list_images()
A static cache key 'rbd' was used to cache pool/storeid-specific
information. This was causing issues in case of multiple RBD pools.

Drop $cache usage instead of fixing the issue as there is no caller
using it and the same pool/storeid multiple times.

Remove $pool from rbd_ls() and get_rbd_path($scfg) from list_images().

Signed-off-by: Dmitry Petrov <dpetrov67@gmail.com>
2025-02-12 14:28:32 +01:00
e5f4af47d0 bump version to 8.3.3
Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2024-12-19 15:16:45 +01:00
b3c844b858 rbd plugin: list: drop outdated error message check
This became outdated after Ceph commit ac547a5b7dc ("rbd: return 0 and
an empty list when pool is entirely empty") 11 years ago. See also:
https://tracker.ceph.com/issues/6693

Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
2024-12-19 12:38:59 +01:00
a1140d77d0 plugins: volume import: align size up to 1KiB
Previously, the size was rounded down which, in case of an image with
non-1KiB-aligned sze (only possible for external plugins or manually
created images) would lead to errors when attempting to write beyond
the end of the too small allocated target image.

For image allocation, the size is already rounded up to the
granularity of the storage. Do the same for import.

Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
2024-12-19 12:38:59 +01:00
c41d7755c3 common: introduce common module
This module's purpose is to provide shared functions, constants, etc.
for storage plugins and storage-related operations.

It starts out with a align_size_up() function, that will (initially)
be used for volume import.

[FE: start out with a different function for my use case
     fixup Makefile]

Originally-by: Max Carrara <m.carrara@proxmox.com>
Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
2024-12-19 12:38:59 +01:00
cc0efbd250 iscsi direct plugin: support volume export
Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
Tested-by: Filip Schauer <f.schauer@proxmox.com>
2024-12-19 12:38:08 +01:00
d8a67cb6bf iscsi plugin: support volume export
Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
Tested-by: Filip Schauer <f.schauer@proxmox.com>
2024-12-19 12:37:58 +01:00
e2cf3cea96 rbd plugin: improve volume exists helper
Currently, the helper would not distinguish between different kinds
of errors. Instead of relying on an error, list the images and check
there.

Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
2024-12-19 12:34:14 +01:00
b6f4b89640 rbd plugin: implement volume import/export
For now, only 'raw+size' is supported and it's not possible to
export/import with snapshots. The volume or snapshot is exported or
imported via the corresponding 'rbd' commands.

Introducing an 'rbd' transport format might be feasible for more
complete (i.e. with snapshots, incremental) transfer between two RBD
storages.

Use the '--dest-pool' switch rather than '-p' for import, because the
latter is deprecated.

Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
2024-12-19 12:34:14 +01:00
3bf2193b44 rbd plugin: factor out helper to check if volume already exists
Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
2024-12-19 12:34:14 +01:00
9adc4c69ef export: redirect stdout to avoid any unrelated messages ending up in the export stream
Current export implementations luckily seems to not run into this
issue yet. However, for the upcoming implementation for RBD, mapping a
volume would print the device path to STDOUT, thus messing up the
export stream.

Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
2024-12-19 12:34:14 +01:00
7166db2ce4 rbd plugin: schema: document default value for 'krbd' setting
Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
2024-12-19 12:34:14 +01:00
a16bf6f791 plugin: export/import: fix calls to path() method
The plugin API does not require call context detection for the
returned value of the path() method. See other plugins like
ISCSIDirect/ZFS that do not implement it. So do not expect it for
external plugins either.

Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
2024-12-19 12:34:14 +01:00
edb18d6386 bump version to 8.3.2
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2024-12-11 15:41:54 +01:00
652154c0b0 btrfs: fix handling of non-images volumes
previously, only 'images' returned a format, now other volume types do too, so
differentiate where needed.

reported on the forum: https://forum.proxmox.com/threads/158888/

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2024-12-11 14:53:07 +01:00
c0304618f5 bump version to 8.3.1
Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2024-12-10 14:33:11 +01:00