5
0
mirror of git://git.proxmox.com/git/pve-storage.git synced 2024-12-22 13:34:16 +03:00
Commit Graph

1919 Commits

Author SHA1 Message Date
Dominik Csapak
0d4c46bf35 BTRFSPlugin: reuse DirPlugin update/get_volume_attribute
this allows setting notes+protected for backups on btrfs

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
Acked-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2022-07-05 11:24:58 +02:00
Dominik Csapak
91d49d1d52 DirPlugin: update_volume_attribute: don't use update_volume_notes
by refactoring it into a helper and use that.
With this, we can omit the 'update_volume_notes' in subclasses

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2022-07-05 11:24:53 +02:00
Wolfgang Bumiller
22bef1f99a bump version to 7.2-5
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2022-06-15 10:54:55 +02:00
Wolfgang Bumiller
15051d3d6c fixup tests
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2022-06-15 10:49:22 +02:00
Wolfgang Bumiller
2949acd638 diskmanage: only set mounted property for mounted devices
instead of setting an empty string for not mounted devices

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2022-06-15 10:49:22 +02:00
Daniel Tschlatscher
90778f7cdd Added a LOG_EXT constant as a counterpart to NOTES_EXT
and refactored usages for .log and .notes with them.
At some parts in the test case code I had to source new variables to
shorten the line length to not exceed the 100 column line limit.

Signed-off-by: Daniel Tschlatscher <d.tschlatscher@proxmox.com>
Reviewed-by: Fabian Ebner <f.ebner@proxmox.com>
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2022-06-15 10:49:22 +02:00
Daniel Tschlatscher
3048641bb4 Switched to using log_warn of PVE::RESTEnvironment
Signed-off-by: Daniel Tschlatscher <d.tschlatscher@proxmox.com>
Reviewed-by: Fabian Ebner <f.ebner@proxmox.com>
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2022-06-15 10:49:22 +02:00
Daniel Tschlatscher
e573445e93 Adapted unlink calls for archive files in case of ENOENT
This improves handling when two archive remove calls are creating a
race condition where one would formerly encounter an error. Now both
finish successfully.

Signed-off-by: Daniel Tschlatscher <d.tschlatscher@proxmox.com>
Reviewed-by: Fabian Ebner <f.ebner@proxmox.com>
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2022-06-15 10:49:22 +02:00
Daniel Tschlatscher
c3e2ff806f fix #3972: Remove the .notes file when a backup is deleted
When a VM or Container backup was deleted, the .notes file was not
removed, therefore, over time the dump folder would get polluted with
notes for backups that no longer existed. As backup names contain a
timestamp and as the notes cannot be reused because of this, I think
it is safe to just delete them just like we do with the .log file.

Furthermore, I sourced the deletion of the log and notes file into a
new function called "archive_auxiliaries_remove". Additionally, the
archive_info object now returns one more field containing the name of
the notes file. The test cases have to be adapted to expect this new
value as the package will not compile otherwise.

Signed-off-by: Daniel Tschlatscher <d.tschlatscher@proxmox.com>
Reviewed-by: Fabian Ebner <f.ebner@proxmox.com>
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2022-06-15 10:49:22 +02:00
Hannes Laimer
76c98d2353 api2: disks: add mounted boolean field
... and remove '(mounted)' from usage string

Signed-off-by: Hannes Laimer <h.laimer@proxmox.com>
2022-06-15 10:17:10 +02:00
Aaron Lauterer
a1528ffe8f rbd: get_rbd_dev_path: return /dev/rbd path only if cluster matches
The changes in cfe46e2d4a git not catch
all situations.
In the case of a guest having 2 disk images with the same name on a pool
with the same name but in two different ceph clusters we still had
issues when starting it. The first disk got mapped as expected. The
second disk did not get mapped because we returned the old $path to
"/dev/rbd/<pool>/<image>" because it already existed from the first
disk.

In the case that only the "old" /dev/rbd path exists and we do not have
the /dev/rbd-pve/<cluster>/... path available, we now check if the
cluster fsid used by that rbd device matches the one we expect. If it
does, then we are in the situation that the image has been mapped before
the new rbd-pve udev rule was introduced. If it does not, then we have
the situation of an ambiguous mapping in /dev/rbd and return the
$pve_path.

Signed-off-by: Aaron Lauterer <a.lauterer@proxmox.com>
2022-06-14 10:50:43 +02:00
Aaron Lauterer
e4671f734b rbd: fix #4060 show data-pool usage when configured
When a data-pool is configured, use it for status infos. The 'data-pool'
config option is used to mark the erasure coded pool while the 'pool'
will be the replicated pool holding meta data such as the omap.

This means, the 'pool' will only use a small amount of space and people
are interested how much they can store in the erasure coded pool anyway.

Therefore this patch reorders the assignment of the used pool name by
availability of the scfg parameters: data-pool -> pool -> fallback 'rbd'

Signed-off-by: Aaron Lauterer <a.lauterer@proxmox.com>
2022-05-20 09:43:20 +02:00
Thomas Lamprecht
ab234cbb92 bump version to 7.2-4
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2022-05-13 14:27:28 +02:00
Stoiko Ivanov
ae93163343 rbd: warn if no stats for a pool could be gathered
happens in case of a mistyped poolname, and the new message should be
more helpful than:
`Use of uninitialized value $free in addition (+) at \
/usr/share/perl5/PVE/Storage/RBDPlugin.pm line 64`

Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
2022-05-13 14:08:13 +02:00
Stoiko Ivanov
0c317c6c0f rbd: add fallback default poolname 'rbd' to status
the fallback to a default pool name of 'rbd' was introduced in:
1440604a4b
and worked for the status command, because it used the `rados_cmd`
sub.

This fallback was lost with the changes in:
41aacc6cde

leading to confusing errors:
`Use of uninitialized value in string eq at \
/usr/share/perl5/PVE/Storage/RBDPlugin.pm line 633`
(e.g. in the journal from pvestatd)

Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
2022-05-13 14:08:13 +02:00
Thomas Lamprecht
f49c6cde16 d/control: bump versioned dependecy for proxmox-backup-client
for the s/backup-ns/ns/ change

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2022-05-13 14:06:45 +02:00
Wolfgang Bumiller
4c9c5f3782 pbs: backup-ns parameter was renamed to ns
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2022-05-13 14:05:38 +02:00
Thomas Lamprecht
120b0ff20c bump version to 7.2-3
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2022-05-12 14:57:10 +02:00
Thomas Lamprecht
4be3f811b9 d/control: bump versioned dependecy for proxmox-backup-client
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2022-05-12 14:57:10 +02:00
Thomas Lamprecht
39887721cb d/control: bump versioned dependency for pve-common
for namespace support

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2022-05-12 14:45:22 +02:00
Wolfgang Bumiller
78eac5baf2 pbs: namespace support
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2022-05-12 11:56:48 +02:00
Thomas Lamprecht
ba41f78f32 bump version to 7.2-2
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2022-04-28 18:20:02 +02:00
Thomas Lamprecht
78638b3dea rbd: get path: allow fake override of fsid in scfg for some regression tests
to avoid calls into RADOS connect, that trigger RPCEnv not
initialized breakage in regression tests, but wouldn't really work
otherwise either

in the future the RBD $scfg could actually support this (or similarly
named) property, to safe on storage addition and then avoid frequent
mon commands

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2022-04-28 18:17:58 +02:00
Thomas Lamprecht
cd58a69125 bump version to 7.2-1
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2022-04-28 17:38:22 +02:00
Fabian Ebner
9594717848 rbd: unmap volume after rename
When krbd is used, subsequent removal after an an operation
involving a rename could fail with
> librbd::image::PreRemoveRequest: 0x559b7506a470 \
> check_image_watchers: image has watchers - not removing
because the old mapping was still present.

For both operations with a rename, the owning guest should be offline,
but even if it weren't, unmap simply fails when the volume is in-use.

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
2022-04-28 13:44:21 +02:00
Fabian Grünbichler
cc682faafc rbd: drop get_kernel_device_path
it only redirected to get_rbd_dev_path with the same signature and both
are private subs..

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2022-04-27 13:03:16 +02:00
Fabian Grünbichler
647a667e10 rbd: reduce number of stats in likely path
the new udev rule is expected to be in place and active, switching the
checks around means 1 instead of 2 stat()s in this rather hot code path.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2022-04-27 13:01:42 +02:00
Aaron Lauterer
cfe46e2d4a rbd: fix #3969: add rbd dev paths with cluster info
By adding our own customized rbd udev rules and ceph-rbdnamer we can
create device paths that include the cluster fsid and avoid any
ambiguity if the same pool and namespace combination is used in
different clusters we connect to.

Additionally to the '/dev/rbd/<pool>/...' paths we now have
'/dev/rbd-pve/<cluster fsid>/<pool>/...' paths.

The other half of the patch makes use of the new device paths in the RBD
plugin.

The new 'get_rbd_dev_path' method the full device path. In case that the
image has been mapped before the rbd-pve udev rule has been installed,
it returns the old path.

The cluster fsid is read from the 'ceph.conf' file in the case of a
hyperconverged setup. In the case of an external Ceph cluster we need to
fetch it via a rados api call.

Co-authored-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
Signed-off-by: Aaron Lauterer <a.lauterer@proxmox.com>
2022-04-27 12:57:22 +02:00
Dominik Csapak
43f8112f0b storage plugins: en/decode volume notes as UTF-8
When writing into the file, explicitly utf8 encode it, and then try
to utf8 decode it on read.

If the notes are not valid utf8, we assume they were iso-8859 encoded
and return as is.

Technically this is a breaking change, since there are iso-8859
comments that would successfully decode as utf8, for example: the
byte sequence "C2 A9" would be "£" in iso, but would decode to "£".

From what i can tell though, this is rather unlikely to happen for
"real world" notes, because the first byte would be in the range of
C0-F7 (which are mostly language dependent characters like "Â") and
the following bytes would have to be in the range of 80-BF, which are
only special characters like "£" (or undefined)

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2022-04-26 15:33:13 +02:00
Thomas Lamprecht
7a8751a2cd zfs pool: bump non-worker timeoiut default to 10s
With 30s we got for sync api calls 10s leaves still enough room for
answering and other stuff.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2022-04-26 15:25:40 +02:00
Dominik Csapak
4cd9b85d15 fix #3803: ZFSPoolPlugin: zfs_request: increase minimum timeout in worker
Since most zfs operations can take a while (under certain conditions),
increase the minimum timeout for zfs_request in workers to 5 minutes.

We cannot increase the timeouts in synchronous api calls, since they are
hard limited to 30 seconds, but in worker we do not have such limits.

The existing default timeout does not change (60minutes in worker,
5seconds otherwise), but all zfs_requests with a set timeout (<5minutes)
will use the increased 5 minutes in a worker.

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2022-04-26 15:19:50 +02:00
Thomas Lamprecht
428872eb71 ceph config: minor code cleanup & comment
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2022-04-26 12:47:58 +02:00
Thomas Lamprecht
34fd49a69b some code style refcatoring/cleanup
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2022-04-22 14:30:01 +02:00
Fabian Grünbichler
8c1a476be9 bump version to 7.1-2
Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2022-04-06 13:30:21 +02:00
Thomas Lamprecht
107208bdbf disks: zfs: code indentation/style improvments
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2022-04-06 12:56:47 +02:00
Fabian Ebner
8009417d0d plugins: allow limiting the number of protected backups per guest
The ability to mark backups as protected broke the implicit assumption
in vzdump that remove=1 and current number of backups being the limit
(i.e. sum of all keep options) will result in a backup being removed.

Introduce a new storage property 'max-protected-backups' to limit the
number of protected backups per guest. Use 5 as a default value, as it
should cover most use cases, while still not having too big of a
potential overhead in many scenarios.

For external plugins that do not return the backup subtype in
list_volumes, all protected backups with the same ID will count
towards the limit.

An alternative would be to count the protected backups when pruning.
While that would avoid the need for a new property, it would break the
current semantics of protected backups being ignored for pruning. It
also would be less flexible, e.g. for PBS, it can make sense to have
both keep-all=1 and a limit for the number of protected snapshots on
the PVE side.

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
2022-04-06 09:47:12 +02:00
Fabian Ebner
89a7507c7a api: file restore: use check_volume_access to restrict content type
Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
2022-04-01 09:24:16 +02:00
Fabian Ebner
1f37ad56f9 pvesm: extract config: add content type check
Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
2022-04-01 09:24:16 +02:00
Fabian Ebner
21c7b54622 check volume accesss: add content type parameter
Adding such a check here avoids the need to parse at the call sites in
some cases.

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
2022-04-01 09:24:16 +02:00
Fabian Ebner
42352a4988 check volume access: allow for images/rootdir if user has VM.Config.Disk
Listing guest images should not require Datastore.Allocate in this
case. In preparation for adding disk import to the GUI.

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
2022-04-01 09:24:16 +02:00
Fabian Ebner
3e1a618e34 check volume access: always allow with Datastore.Allocate privilege
Such users are supposed to be administrators of the storage, but
previously, access to backups was not allowed when not also having
VM.Backup.

Suggested-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
2022-04-01 09:24:16 +02:00
Fabian Ebner
f303dec6e4 pvesm: extract config: check for VM.Backup privilege
In preparation to have check_volume_access() always allow access for
users with Datastore.Allocate privilege. As to not automatically give
all such users permission to extract the config too.

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
2022-04-01 09:24:16 +02:00
Fabian Ebner
c66e0b8a0a list volumes: also return backup type for backups
Otherwise, there is no storage-agnostic way to filter by backup group.

Call it subtype, to not confuse it with content type, and to be able
to re-use it for other content types than backup, if the need ever
arises.

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
2022-03-16 17:42:39 +01:00
Fabian Ebner
5ef50a8262 cifs: check connection: bubble up NT_STATUS_LOGON_FAILURE
in the same manner as NT_STATUS_ACCESS_DENIED. It can be assumed to be
a configuration error, so avoid showing the generic "storage <storeid>
is not online". Reported in the community forum:
https://forum.proxmox.com/threads/storage-is-not-online-cifs.99201/post-428858

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
2022-03-16 17:36:38 +01:00
Fabian Ebner
38431808b4 activate storage: improve error when check_connection dies
by making sure the storage ID is part of the error. This can happen
for (at least) CIFS, and GlusterFS with local server.

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
2022-03-16 17:36:38 +01:00
Lorenz Stechauner
18bf2e59da storage/plugin: factoring out regex for backup extension re
Signed-off-by: Lorenz Stechauner <l.stechauner@proxmox.com>
2022-03-16 17:13:59 +01:00
Lorenz Stechauner
cd461a5012 storage: rename REs for iso and vztmpl extensions
these changes make it more clear, how many capture groups each
RE inclues.

Signed-off-by: Lorenz Stechauner <l.stechauner@proxmox.com>
2022-03-16 17:13:59 +01:00
Fabian Ebner
726c432964 zfs: volume import: use correct format for renaming
Previously, the transport format (which currently is always 'zfs') was
passed in, resulting in subvol-disks not to be renamed correctly.

Fixes: a97d3ee ("Introduce allow_rename parameter for pvesm import and storage_migrate")
Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2022-03-03 14:33:33 +01:00
Mira Limbeck
eba7935f83 file_size_info: cast 'size' and 'used' to integer
`qemu-img info --output=json` returns the size and used values as integers in
the JSON format, but the regex match converts them to strings.
As we know they only contain digits, we can simply cast them back to integers
after the regex.

The API requires them to be integers.

Signed-off-by: Mira Limbeck <m.limbeck@proxmox.com>
Reviewed-by: Fabian Ebner <f.ebner@proxmox.com>
2022-02-21 16:07:30 +01:00
Mira Limbeck
7f30857519 fix #3894: cast 'size' and 'used' to integer
Perl's automatic conversion can lead to integers being converted to
strings, for example by matching it in a regex.

To make sure we always return an integer in the API call, add an
explicit cast to integer.

Signed-off-by: Mira Limbeck <m.limbeck@proxmox.com>
Reviewed-by: Fabian Ebner <f.ebner@proxmox.com>
2022-02-21 16:07:27 +01:00