Commit Graph

1961 Commits

Author SHA1 Message Date
Aaron Lauterer
e05113fbe5 ZFS: use -p flag where possible
Signed-off-by: Aaron Lauterer <a.lauterer@proxmox.com>
2020-04-09 10:20:06 +02:00
Aaron Lauterer
3881e68025 ZFS: use -p flag and remove zfs_parse_size
ZFS supports the -p flag in the list command since a few years now.
Let us use the real byte values and avoid the error prone calculation
from human readable numbers that can lead to incorrect numbers if the
reported human readable value is a rounded number.

Signed-off-by: Aaron Lauterer <a.lauterer@proxmox.com>
2020-04-09 10:20:06 +02:00
Aaron Lauterer
d99de0f898 ZFSPoolPlugin: fix #2662 get volume size correctly
Getting the volume sizes as byte values instead of converted to human
readable units helps to avoid rounding errors in the further processing
if the volume size is more on the odd side.

The `zfs list` command supports the -p(arseable) flag since a few years
now.
When returning the size in bytes there is no  calculation performed and
thus we need to explicitly cast the size to an integer before returning
it.

Signed-off-by: Aaron Lauterer <a.lauterer@proxmox.com>
2020-04-09 10:19:59 +02:00
Fabian Grünbichler
8baa5ea994 bump version to 6.1-6
Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2020-04-09 09:42:30 +02:00
Fabian Grünbichler
a5ffe2c438 d/control: wrap-and-sort
Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2020-04-09 09:41:01 +02:00
Fabian Grünbichler
589db254b7 d/control: break consumers of storage_migrate
since we changed the signature, and want to ensure smooth upgrades.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2020-04-09 09:41:01 +02:00
Fabian Ebner
683a3f463f storage_migrate: add volname_for_storage helper
to guess a valid volname for a targetstorage of a different type.
This makes it possible to migrate raw volumes between 'dir' and 'lvm'
storages.

It is only used when the storage type for the source storage X
and target storage Y differ and should work as long as Y uses
the standard naming scheme (VMID/vm-VMID-name.fmt respectively vm-VMID-name).
If it doesn't, we get an invalid name and fail, which is the old
behavior (except if X and Y have different types but the same
non-standard naming-scheme, where the old behavior did work).

The original name is preserved, except for a possible extension
and it's also checked if the format is valid for the target storage.
Example: mylvm:vm-123-disk-4 <-> mydir:123/vm-123-disk-4.raw

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
2020-04-09 09:41:01 +02:00
Fabian Ebner
a97d3ee49f Introduce allow_rename parameter for pvesm import and storage_migrate
and also return the ID of the allocated volume. This option
allows plugins to choose a new name if there is a collision.

In storage_migrate, the API version of the receiving side is checked.

In Storage.pm's volume_import, when a plugin returns 'undef',
it can be assumed that the import with the requested volid was
successful (it should've died otherwise) and so volid is returned.
This is done for backwards compatibility with foreign plugins.

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
2020-04-09 09:41:01 +02:00
Fabian Ebner
5f184292fe Add apiinfo helper to pvesm
Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
2020-04-09 09:41:01 +02:00
Fabian Ebner
dc3655a1a5 Collect optional parameters for storage_migrate into $opts
Sanitizing $with_snapshots is done on extraction to save a line.

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
2020-04-09 09:41:01 +02:00
Dominic Jäger
b9364dc683 Fix 2647: Add snippet content type for Gluster
Our wiki mentions snippets as supported content type for GlusterFS storages [0]
and all other directory based storages have it enabled already [1]

[0] https://pve.proxmox.com/wiki/Storage:_GlusterFS
[1] https://git.proxmox.com/?p=pve-storage.git;a=commit;h=d1eb35ea74cf27713625ab7e7c3767a8254a4aee

Signed-off-by: Dominic Jäger <d.jaeger@proxmox.com>
2020-04-08 07:53:17 +02:00
Dominik Csapak
3587acc80a fix #2474: always show iscsi content
Instead of relying on list_volumes of Plugin.pm (which filters by
the content types set in the config), use our own to always
show the luns of an iscsi.

This makes sense here, since we need it to show the luns when using
it as base storage for LVM (where we have content type 'none' set).

It does not interfere with the rest of the GUI, since on e.g. disk
creation, we already filter the storages in the dropdown by content
type, iow. an iscsi storage used this way still does not show up
when trying to create a disk.

This also shows the luns now in the 'Content' tab, but this is also
OK, since the user cannot actually do anything there with the luns.
(Besides looking at them)

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2020-04-07 18:09:50 +02:00
Fabian Ebner
95015dbbf2 storage_migrate: check if target storage supports content type
Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
2020-03-27 14:04:09 +01:00
Fabian Ebner
e6f4eed435 Allow passing options to volume_has_feature
With the option valid_target_formats it's possible
to let the caller specify possible formats for the target
of an operation.
[0]: If the option is not set, assume that every format is valid.

In most cases the format of the the target and the format
of the source will agree (and therefore assumption [0] is
not actually assuming very much and ensures backwards
compatability). But when cloning a volume on a storage
using Plugin.pm's implementation (e.g. directory based
storages), the result is always a qcow2 image.

When cloning containers, the new option can be used to detect
that qcow2 is not valid and hence the clone feature is not
available.

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
2020-03-27 08:50:23 +01:00
Thomas Lamprecht
6c25dbd495 base plugin: get_subdir_files: split stat variables into single lines
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2020-03-06 19:27:24 +01:00
Thomas Lamprecht
1ee709380d api: storage/content: fix return schema property descriptions
a small grammar fix, and we now return ctime of all files, as
remaining storages are planned for the future omit this hint
completely.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2020-03-06 19:26:45 +01:00
Thomas Lamprecht
c05b1a8cb9 PBS plugin: code cleanup
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2020-03-06 19:26:45 +01:00
Dietmar Maurer
d65590d1be LVM list_images: return creation time
Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
2020-03-06 19:26:45 +01:00
Dietmar Maurer
51eee96d31 base plugin: return ctime for vm images
Changed file_size_info() to additionally return ctime to avoid
another stat() call.

Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
2020-03-06 19:26:45 +01:00
Dietmar Maurer
ff9c5451a5 base plugin: add ctime for all files
Creation time makes sense for other file types also.

Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
2020-03-06 19:26:45 +01:00
Dietmar Maurer
545e127e52 PBS Plugin: list_volumes: add ctime
Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
2020-03-06 19:26:45 +01:00
Dietmar Maurer
9c629b3e76 base plugin: add ctime for backup files
Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
2020-03-06 19:26:45 +01:00
Dietmar Maurer
654a987a3e api: storage/content: add ctime to return schema
to allow implementation from plugins in future patches

Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
2020-03-06 19:26:17 +01:00
Thomas Lamprecht
553c9b21a7 iscis: add iscsi_session helper
allows to write some code sligthly nicer

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2020-03-03 11:33:34 +01:00
Thomas Lamprecht
c29bad0d90 iscsi: sort and split module usage
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2020-03-03 11:33:34 +01:00
Aaron Lauterer
4f430a43ba ISCSI: whitespace cleanup
Signed-off-by: Aaron Lauterer <a.lauterer@proxmox.com>
2020-03-03 11:33:34 +01:00
Aaron Lauterer
42b988f735 fix #2620: storage API: iSCSI: return active field as integer
If active, the return value was a string: "1" and not an integer.

Signed-off-by: Aaron Lauterer <a.lauterer@proxmox.com>
2020-03-03 11:33:34 +01:00
Thomas Lamprecht
93afc379a3 followup: fix VMID regex, use same as JSONSchema does
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2020-02-21 16:02:23 +01:00
Dominik Csapak
1b39642528 list_volumes: try to return vmid also for backups
this way the content listing api also returns the vmid on content
listings which, among other things, is useful for the gui for
filtering

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2020-02-21 16:00:58 +01:00
Thomas Lamprecht
c7f74e0f6b bump version to 6.1-5
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2020-02-20 13:56:18 +01:00
Thomas Lamprecht
f33533d4da cifs: followup fix for credential fallback
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2020-02-20 13:56:18 +01:00
Thomas Lamprecht
319441e7cd cifs: move password credential file to storage subdirectory
Do not pollute top-level private directory, use "storage" folder but
with backward compatibility.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2020-02-20 13:07:29 +01:00
Dietmar Maurer
b494636ac9 PBSPlugin.pm: fix password handling using new on_update_hook 2020-02-20 12:42:59 +01:00
Dietmar Maurer
e2fc55b413 CIFSPlugin.pm: fix crediential handling using new on_update_hook 2020-02-20 12:39:50 +01:00
Dietmar Maurer
0ff4cfead1 PVE/Storage/Plugin.pm: introduce on_update_hook
We need this to correctly update the password file.
2020-02-20 12:39:44 +01:00
Thomas Lamprecht
9e34813f6c pbs: ensure storage secret file directory exists
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2020-02-20 11:12:39 +01:00
Dietmar Maurer
bb8adeb226 PBSPlugin.pm - extract_vzdump_config: fix call to run_raw_client_cmd 2020-02-20 10:45:34 +01:00
Fabian Ebner
c72155735d volume_resize: align size to 1 KiB
1. Avoids the error
qemu-img: The new size must be a multiple of 512
for qcow2 disks.
2. Because volume_import expects disk sizes to be a multiple of 1 KiB.

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
2020-02-19 15:24:09 +01:00
Thomas Lamprecht
462537a270 namespace storage specific secret files to 'priv/storage' folder
As /etc/pve/priv is already pretty polluted, having a
"<storage-id>.pw" file there smells like it could make problems in
the future.

So let the pbs pw file generator use /etc/pve/priv/storages as base
path.
Other storage should move also to that path in the future, if they
save such secrets anywhere in /etc/pve.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2020-02-19 15:00:54 +01:00
Thomas Lamprecht
1574a590a5 check if client executable ist installed before running command
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2020-02-19 14:50:42 +01:00
Thomas Lamprecht
fee2ece310 use one liner closure for outfunc
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2020-02-19 14:50:04 +01:00
Thomas Lamprecht
f155c912d0 indentation fixes
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2020-02-19 14:49:38 +01:00
Dietmar Maurer
c855ac150c implement extract_vzdump_config for PBSPlugin 2020-02-19 14:00:04 +01:00
Dietmar Maurer
271fe39460 PVE/Storage/PBSPlugin.pm: start new proxmox backup server plugin 2020-02-19 14:00:04 +01:00
Fabian Ebner
75815bf556 Check whether 'zfs get mountpoint' returns a valid absolute path
The command 'zfs get mountpoint' can return 'none' and so 'mountpoint
none' was written to storage.cfg, which would block the fall-back to
using the default mount point when requesting a path, see [0].

[0]: https://forum.proxmox.com/threads/zfs-backup-with-snapshot-mode-fails.61927/#post-284123

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
2020-02-18 13:26:46 +01:00
Thomas Lamprecht
1022a7c4a9 systemd unit name escape helpers moved to common, use them
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2020-02-05 17:14:39 +01:00
Thomas Lamprecht
b0373adc71 directory/cephfs: sort module usage
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2020-02-05 17:13:30 +01:00
Fabian Grünbichler
8e55b4f288 storage_migrate: only set errfunc for send stream
since we redirect the output to our (insecure) socket, logfunc is only
used for STDERR anyway, so we might as well make it explicit on the
caller side.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2020-02-05 09:37:09 +01:00
Fabian Ebner
aca83310dd storage_migrate: also log with an insecure connection if there is a log function
Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
2020-02-05 08:50:14 +01:00
Fabian Ebner
94dd8b0cfa Remove unused string
Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
2020-02-05 08:50:14 +01:00