Commit Graph

1147 Commits

Author SHA1 Message Date
Thomas Lamprecht
d4c31eff96 d/control: bump ceph dependency to 12.2
A newer than the Luminous version is shipped with buster, and our
ceph repos are on Nautilus (14.2) in PVE 6.

Allows to drop a check for really old ceph versions (< 10, so
Infernalis and older).

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2020-04-25 11:27:38 +02:00
Thomas Lamprecht
81c5c736ca followup: only parse version if required, fix whitespace error
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2020-04-25 11:18:03 +02:00
Alwin Antreich
e54c3e3347 Fix #2705: cephfs: mount fails with bad option
dmesg: libceph: bad option at 'conf=/etc/pve/ceph.conf'

After the upgrade to PVE 6 with Ceph Luminous, the mount.ceph helper
doesn't understand the conf= option yet. And the CephFS mount with the
kernel client fails. After upgrading to Ceph Nautilus the option exists
in the mount.ceph helper.

Signed-off-by: Alwin Antreich <a.antreich@proxmox.com>
2020-04-25 11:15:23 +02:00
Thomas Lamprecht
187e32ce41 config: add missing whitespace
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2020-04-25 11:12:48 +02:00
Dominik Csapak
ce73713ef7 fix nvme wearout parsing
the '.*' was greedy, also consuming all but one digits of the real percentage

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>

switch to \s* instead of .*?, to prevent mis-interpreting potential
strings like '< 50%' or '0-50%'

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2020-04-15 12:54:10 +02:00
Fabian Ebner
2668adcec2 Add comment for volume_has_feature
Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
2020-04-09 12:05:11 +02:00
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 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
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
Thomas Lamprecht
e38418266f cephcfg sort keys in write_ceph_config
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2020-01-29 19:59:08 +01:00
Thomas Lamprecht
9a80a3eae0 cephfs mount: reload systemd if existing unit gets regenerated
One the first write bringing the unit file in existence we can just
start it, after that we need to tell systemd that we want to actively
reload it.

While this is slightly shaky due to the fact that we do not check all
paths where such a unit could reside, it is something we can do
because earlier one couldn't have a unit/overwrite anyway (from
procfs mountinfo generated one do not support that) and does adding
such override ones from now on should work.

Also note that we can only get here in the "user does no weird stuff"
case when "cephfs_is_mounted" actively tells that there is no cephfs
mounted at the $mountpoint - at which time we can safely re-write the
potential updated unit file, reload and mount again.

So let's make our life a bit easier here until a user actually
complains about a rational issue for this, maybe we have PVE 7.0 then
and can get rid of that anyway :)

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2020-01-29 19:54:40 +01:00
Thomas Lamprecht
25e222ca0d cephfs: mount fuse through systemd with correct order dependencies
This fixes a potential races where fuse get's unmouted to late in the
shutdown process, i.e., at a time where network was down and it could
not talk to any MDS or monitor anymore.

We could fix it the same way we did once with the kernel based mount,
i.e., adding _netdev, but doing so would require to switch over from
"ceph-fuse" to "mount.fuse.ceph" which has better compatibility with
the common mount tool API.

As that helper exists we can reuse the newer systemd_netmount
ephemeral unit generator, only some options differ in name between
fuse and kernel variant.

So besides solving a potential issue we get a more unified handling
of those two cases.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2020-01-29 19:41:11 +01:00
Thomas Lamprecht
d9ece228fb fix random hangs on reboot with active CephFS mount ordering cycle
commit 54e0b0034b introduced the
"_netdev" option, for PVE 5.3. The systemd generator then correctly
resolved that in the following resulting order-dependencies:
> Wants=network-online.target
> Before=umount.target remote-fs.target
> After=remote-fs-pre.target system.slice network.target network-online.target -.mount

This worked well and all were happy. With the current systemd in 6.0
we sometimes get the local-fs ones there generated too. This is a
fallout from a try to better handling nested mount hierachies, where
a .mount unit needs to be mounter or unmounted, before or after,
respectively, the parent mount was processed. It seems that sometime
that glitches and thus a "RequireMountFor=/mnt/pve" gets thrown in
and result sometimes in the local-fs order constraints being added.

The issue now is, that one must not have ordering depends to all,
local-fs, local-fs-pre, remote-fs, remote-fs-pre, as that gets you a
ordering cycle. Systemd tries to solve that cycle by randomly
dropping one constraint and retrying. By luck this is a not so
important unit, and all goes on well. Most of the time one isn't that
lucky and something important gets dropped, for example:

> Jan 24 18:43:05 prod1 systemd[1]: sysinit.target: Found ordering cycle on systemd-timesyncd.service/stop
> Jan 24 18:43:05 prod1 systemd[1]: sysinit.target: Found dependency on systemd-tmpfiles-setup.service/stop
> Jan 24 18:43:05 prod1 systemd[1]: sysinit.target: Found dependency on local-fs.target/stop
> Jan 24 18:43:05 prod1 systemd[1]: sysinit.target: Found dependency on mnt-pve-cephfs.mount/stop
> Jan 24 18:43:05 prod1 systemd[1]: sysinit.target: Found dependency on remote-fs-pre.target/stop
> Jan 24 18:43:05 prod1 systemd[1]: sysinit.target: Found dependency on rbdmap.service/stop
> Jan 24 18:43:05 prod1 systemd[1]: sysinit.target: Found dependency on sysinit.target/stop
> Jan 24 18:43:05 prod1 systemd[1]: sysinit.target: Job remote-fs-pre.target/stop deleted to break ordering cycle starting with sysinit.target/stop

Then, most of the time the host reboot hangs for ~10 minutes, often
showing scapegoat units like the pve-ha-lrm being the cause of the
hang (even if no HA is configure >.<).

This behavior is fixed with newer systemd versions, e.g., the v244
from buster-backports, but that is not a real option for us for now.

So until 7.0 we generate the unit with the correct dependencies
directly in the ephemeral /run/ tmpfs backed systemd/system path and
start it.

While FUSE gets only the local-fs ordering constraint, it seems to cope
very well regarding such symptoms. But it _is_ racy and probably only
works due to systemd stopping it early as it has not much ordering
constraints at all.. It should be moved in the future nonetheless, as
there's a mount.fuse.ceph helper that should be not an issue.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2020-01-29 18:25:21 +01:00
Thomas Lamprecht
edaaf47aec CephFSPlugin: copy over systemd_escape
This is but a hack, but we have no general helper/tools module here
and I do not want to do versioned dependencies for this fast-tracked
bugfix to pve-common, so I'll have to live with the shame for now.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2020-01-29 18:00:37 +01:00
Fabian Grünbichler
a420842d01 don't (accidentally) modify PVE::Cluster::vmlist
when listing volumes, otherwise an empty hash can be persisted into the
current worker's $vmlist, which could cause issues at various other API
endpoints.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2020-01-08 12:01:10 +01:00
Dominic Jäger
c3ed9ac3da cifs-plugin: Add bwlimit storage option
This is already implemented in all other storage plugins.

Signed-off-by: Dominic Jäger <d.jaeger@proxmox.com>
2019-12-20 10:35:45 +01:00
Thomas Lamprecht
481f6177a5 grammar fix: s/does not exists/does not exist/g
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-12-13 12:11:26 +01:00
Thomas Lamprecht
01e872db98 base find_free_diskname: refactor mapping from disks to volid array
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-12-12 12:59:57 +01:00
Fabian Ebner
a44c0147bc Use a common interface for find_free_diskname
We can use 'list_images' to get the desired volume IDs in
'find_free_diskname' for most plugins. For the two LVM plugins, 'list_images'
potentially skips untagged volumes, so we keep the custom version. For the
RBD plugin, 'list_images' is much more costly than the custom version, so we
keep the custom version.

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
2019-12-12 12:52:43 +01:00
Fabian Grünbichler
a573f66a2e rbd: unprotect all snapshots on image removal
we need to unprotect more snapshots than just the base one, since we
allow linked clones of regular VM snapshots. unprotection will only work
if no linked clones exist anymore.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2019-12-11 10:55:04 +01:00
Fabian Ebner
d3e3e5d6bd When resizing a ZFS volume, align size to 1M
The size is required to be a multiple of volblocksize. Make sure
that the requirement is always met, so ZFS won't complain when we do
things like 'qm resize 102 scsi1 +0.01G'.

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
2019-12-09 14:07:50 +01:00
Tim Marx
3ea55f0532 calculate reasonable metadatasize for lvm thin pools on creation
Letting LVM set the meta-data size internally was not a good idea, as
it produces really small metadata LVs. Adapts the same logic as the
installer.

Signed-off-by: Tim Marx <t.marx@proxmox.com>
Reviewed-By: Dominik Csapak <d.csapak@proxmox.com>
Tested-By: Dominik Csapak <d.csapak@proxmox.com>
2019-12-09 14:04:07 +01:00
Thomas Lamprecht
14c7ede3a3 lvm: vg create: followup for bogus warnings
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-12-02 15:15:52 +01:00
Thomas Lamprecht
14092a3794 LVM commands: ignore "No medium found" bogus warnings
Those come normally from virtual devices, like a IPMI disk, if no
media is attached. They spam the log really often on operations like
migrate, and are quite scare-mongering. So filter them out.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-11-29 14:44:17 +01:00
Fabian Grünbichler
518f3908bf rbd: update features of image when mapping snapshot
in order to fix the features even if the image itself never gets mapped.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2019-11-29 13:41:33 +01:00
Fabian Grünbichler
b4227e776f rbd: don't attempt to update features of snapshots
it does not work:

disable RBD image features this kernel RBD drivers is not compatible with: fast-diff,object-map,deep-flatten
clone failed: could not disable krbd-incompatible image features 'fast-diff,object-map,deep-flatten' for rbd image: vm-123123123-disk-0@test: rbd: snapshot name specified for a command that doesn't use it

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2019-11-29 11:09:52 +01:00
Fabian Grünbichler
b5eff97d66 pvesm import: make error messages consistent
Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2019-11-27 14:36:19 +01:00
Fabian Grünbichler
f105c1766e pvesm import: improve handling of interrupted export
since 'pvesm export' and 'pvesm import' are connected via a pipe and
SSH, a fatal error in the former can lead to no valid header being
written to the pipe. handle this more gracefully by printing an easier
to understand error message, instead of uninitialized warnings with no
context.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2019-11-27 14:36:19 +01:00
Thomas Lamprecht
97cf933fe5 fix #2309: allow LVM Volume Group names starting with a digit
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-11-26 14:17:19 +01:00
Thomas Lamprecht
0ef8fb9d4d RBD: disable and enable features depending on kernel version
Modern kernel, like 5.3, support all those features ('fast-diff',
'object-map', 'deep-flatten'), so we do not want to disable them
there. 5.0 already supports exclusive-locks, so no need to disable
exclusive locking there.

Further, we also want to profit from new features available, so let's
enable those which can be enabled "live" (i.e., after image creation)
if their available.

While we could also parse the kernel information directly from:
/sys/module/libceph/parameters/supported_features
there's not much advantage to that, features cannot be disabled with
KConfig, their also very dependent of the kernel version booted.
So for us it's enough to check that one.

This only affects container and VMs backed by a storage with KRBD
explicitly enabled. But as the enabling and disabling happens
transparently, it has no effect on the running guest.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-11-23 15:44:19 +01:00
Thomas Lamprecht
5102900d50 rbd: group and sort module usage
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-11-22 18:15:25 +01:00
Thomas Lamprecht
a4e603c657 RBD: fix ceph version detection
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-11-22 16:02:40 +01:00
Thomas Lamprecht
0877df047c cleanuo: no need to negate we have not-equal
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-11-21 12:43:55 +01:00
Tim Marx
a4e41b0bbf change var name ct to type to prevent confusion with container
Signed-off-by: Tim Marx <t.marx@proxmox.com>
2019-11-21 12:43:55 +01:00
Tim Marx
5dae1a319b fix #2467: avoid duplicate volumes & tag with correct content type
The bugfix for #2317 introduced a kind of odd API behavior, where
each volume was returned twice from our API if a storage has both
'rootdir' & 'images' content types enabled. To give the content type
of the volume an actual meaning, it is now inferred from the
associated guest, if there's no guest or we don't have an owner for
that volume we default to 'images'.

At the volume level, there is no option to list volumes based on
content types, since the volumes do not know what type they are
actually used for.

Signed-off-by: Tim Marx <t.marx@proxmox.com>
2019-11-21 12:43:55 +01:00
Thomas Lamprecht
528aa0eefb followup: remove no-op JSONSchema::check_format on mountpoint
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-11-21 12:43:55 +01:00
Fabian Ebner
dcefd9dd28 fix #2085: add mountpoint property for non-default ZFS pool MPs
When adding a zfspool storage with 'pvesm add' the mount point is now
added automatically to the storage configuration if it can be
determined.  path() does not assume the default mountpoint anymore,
fixing 2085.

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
2019-11-21 12:42:38 +01:00
Thomas Lamprecht
61c261e76c pvesm list: right align size column
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-11-21 11:59:43 +01:00
Tim Marx
2e2e11db3e add content type to pvesm list output
Signed-off-by: Tim Marx <t.marx@proxmox.com>
2019-11-21 09:01:43 +01:00
Fabian Grünbichler
0ce8cadd7f use PVE::RRD for RRD data
refactored from PVE::Cluster. same code, same semantics, different file.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2019-11-18 12:03:00 +01:00
Fabian Grünbichler
65bb98596c use PVE::SSHInfo
Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2019-11-18 12:03:00 +01:00
Fabian Grünbichler
2f08fb4bac use PVE::DataCenterConfig
to make sure that the corresponding cfs_read_file works() works.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2019-11-18 12:03:00 +01:00
Fabian Ebner
4966c8869e Introduce zfs_get_properties helper
Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
2019-11-14 12:38:25 +01:00
Thomas Lamprecht
ed2df8e35e followup: different error messages for no and to many IPs
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-11-08 12:19:04 +01:00
Fabian Grünbichler
a2aae38c4b use correct local IP address helper
this always uses an explicit CIDR, so we don't need a round-trip via
datacenter.cfg ..

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2019-11-08 11:24:52 +01:00
Tim Marx
83a9960c71 convert vmid to int to conform with return type declaration
Signed-off-by: Tim Marx <t.marx@proxmox.com>
2019-11-05 18:37:15 +01:00
Tim Marx
9148f5b355 whitespace cleanup
Signed-off-by: Tim Marx <t.marx@proxmox.com>
2019-11-05 18:37:15 +01:00
Thomas Lamprecht
6ed43d81dc cleanup: omit module prefix for call to methods in same module
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-10-31 07:36:27 +01:00
Fabian Ebner
3824ba88a9 Whitespace cleanup
Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
2019-10-08 11:22:12 +02:00
Daniel Berteaud
9258d94531 LIO: re-use variables
Signed-off-by: Daniel Berteaud <daniel@firewall-services.com>
2019-09-26 18:16:42 +02:00
Daniel Berteaud
eb89269f2e LIO: Prefix backstores with the pool name
So it won't clash with another backstore in another pool

Signed-off-by: Daniel Berteaud <daniel@firewall-services.com>
2019-09-26 18:16:42 +02:00
Daniel Berteaud
609f8ec6cf LIO: Make the target cache works per target and portal
When working with several ZFS over iSCSI / LIO storages, we might lookup
between them with less than 15 sec interval.
Previously, the cache of the previous storage was used, which was breaking
disk move for example

Signed-off-by: Daniel Berteaud <daniel@firewall-services.com>
2019-09-26 18:16:42 +02:00
Thomas Lamprecht
61137a54d6 lio: list_lun: return early if volname cannot be parsed
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-09-26 15:31:07 +02:00
Thomas Lamprecht
2dbca26d99 lio: list_lun: re-use $object variable
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-09-26 15:30:27 +02:00
Daniel Berteaud
c243be83b4 Parse volname where needed
The common ZFSPlugin was missing volume name parsing
in a few places. This was not a problem for standard
volumes, but broke functionnalities (like resize,
snapshot, rollback) with linked clones as the name of
the zvol must be extracted from the entry in the config
(remove base-X-disk-Y prefix)

Signed-off-by: Daniel Berteaud <daniel@firewall-services.com>
2019-09-23 16:09:10 +02:00
Daniel Berteaud
b7c8738f17 Enable unmap support
In the default config, emulate_tpu is set to 0, which disables
unmap support. Once enabled, trim can run from guest to reclaim free
space.

Signed-off-by: Daniel Berteaud <daniel@firewall-services.com>
2019-09-23 16:09:10 +02:00
Daniel Berteaud
525ed353dc Don't remove and recreate lun when changing a volume
It's not needed, LIO sees the new size automatically.
And it was broken anyway. Partially fix #2335

Signed-off-by: Daniel Berteaud <daniel@firewall-services.com>
2019-09-23 16:09:10 +02:00
Thomas Lamprecht
80699b1da5 followup: add JSON use and cleanup
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-09-20 13:32:18 +02:00
Tim Marx
af0335e82f change file_size_info sub to use qemu-img info json decoding
Using the json output, as suggested by Thomas, we now die if the decoding
fails and, if not, all return values are set to the corresponding decoded
values. That should prevent any unforeseen null size values, except if
qemu-img info reports it, which we then consider as valid.

Signed-off-by: Tim Marx <t.marx@proxmox.com>
2019-09-20 13:01:00 +02:00
Fabian Ebner
cfdffd8a20 Actually use target_volid
Migration with --targetstorage was broken because of this.

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-09-17 09:28:52 +02:00
Dominik Csapak
ce8b24a937 fix vmid filter for backup listing
$1 and $2 get set to undef from the vmid filter regex, so we have to do
the name/format regex after, else we get errors like:

'use of unitiialized value $1[...]'

and the listing is empty

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2019-09-09 16:38:37 +02:00
Thomas Lamprecht
1dbbd5abd6 file_size_info: move parser to own variable
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-09-09 15:36:14 +02:00
Tim Marx
aa4594b1d1 warn if filesize info couldn't be read due to error
This sh
Signed-off-by: Tim Marx <t.marx@proxmox.com>
2019-09-09 15:27:26 +02:00
Tim Marx
3918b96afa whitespace cleanup
Signed-off-by: Tim Marx <t.marx@proxmox.com>
2019-09-09 15:27:26 +02:00
Alwin Antreich
e79ab52c14 Fix #2346: rbd storage shows wrong %-usage
The patch uses the value from the field 'stored' if it is available.

In Ceph 14.2.2 the storage calculation changed to a per pool basis. This
introduced an additional field 'stored' that holds the amount of data
that has been written to the pool. While the field 'used' now has the
data after replication for the pool.

The new calculation will be used only if all OSDs are running with the
on-disk format introduced by Ceph 14.2.2.

Signed-off-by: Alwin Antreich <a.antreich@proxmox.com>
2019-09-03 10:19:45 +02:00
Thomas Lamprecht
b295e05ebe followup: just use case sensitive flag, no manual hack
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-09-03 09:42:15 +02:00
Thomas Lamprecht
fd9ca08c70 fixup: use our to make $iso_extension_re value available for other modules
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-09-03 09:41:50 +02:00
Stefan Reiter
4c69349140 fix #2216: Allow .img files in 'iso' type storages
To maintain full (backwards) compatibility, leave the type name as
'iso' - this makes this patch work without changing every consumer of
storage APIs.

Note that currently these files can only be attached as a CDROM/DVD
drive, so USB-only images can be uploaded but might not work in VMs.

Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
2019-09-03 07:09:28 +02:00
Fabian Grünbichler
56362cfb55 ZFS: refactor waiting for zvol symlinks
and actually do that not just for creating zvols, but also when
activating them. this should fix a range of issues/races that sometimes
occured on bootup, snapshot rollback or similar operations.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2019-08-06 13:39:43 +02:00
Fabian Grünbichler
be78543909 fix 2317: list images on 'rootdir' only storages
plugins can still override list_volumes if they want separate methods to
list rootdir and images content.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2019-08-06 13:39:43 +02:00
Dominic Jäger
1f56f6f8d1 Fix #582: Add DELETE delay logic
Previously, the web GUI timed out when removing content (e.g. backup) took
too long. Doing the main part of the API DELETE call in a fork_worker solves
this.

Signed-off-by: Dominic Jäger <d.jaeger@proxmox.com>
2019-07-25 10:04:38 +02:00
Fabian Grünbichler
a14e0a5e95 storage plugin: move get_subdir call
since list_volumes is only supposed to be called with filtered content
types, this should ensure that get_subdir is only called for plugins
that have a defined 'path' property, like the old code in
PVE::Storage::template_list did.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2019-07-19 14:04:34 +02:00
Dietmar Maurer
c2fc9fbe1d storage plugin: new list_volumes plugin method
This cleanup improve code reuse, and allows plugins to override list_volumes.
2019-07-19 13:49:29 +02:00
Dominik Csapak
bfb3d42daf Diskmanage: add flag for encrypted osds
we can only do this here, since the ceph cluster is not aware of
osd encryption, only the local node is (via ceph-volume and lv tags)

this way, we are able to show an 'encrypted' flag in the disk gui at least

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2019-07-12 15:38:24 +02:00
Dominik Csapak
8cd6d7e8e3 Diskmanage: change parttype uuid detection
previously ceph included a udev rule to populate
/dev/disk/by-parttypeuuid/

but not anymore, so we now use 'lsblk --json -o path,parttype' to
get a mapping between parttype uuid and partition

fix the test by simulating empty lsblk output

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2019-07-12 15:37:57 +02:00
Thomas Lamprecht
228e5be920 pvesm import: allow to pass a tcp://<IP> as file
To allow getting closer to finally drop "pvecm mtunnel".
Code parts taken from pipe_socket_to_command

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
[regex fixup]
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-07-11 10:13:37 +02:00
Dominik Csapak
79f4a7bfd3 fix #2266: Diskmanage: get correct osd id
The osdid can consist of multiple digits, cope with that and add more
regression tests for this

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2019-07-08 19:04:08 +02:00
Dominik Csapak
82881c5f9e cephfs: make is_mounted check less strict
checking '$server:$subdir' is too strict to work in all cirumcstances,
e.g. adding/removing a monitor would mean that it is not the same
anymore, same if one is adding/removing the ports from the config

check only if the subdir is the same and if it is a cephfs
this way, it still returns true if someone changes the config

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2019-07-03 10:15:14 +02:00
Dominik Csapak
35ccd3d004 fix missing osd info for osd 0
0 is falsy, we have to check for definedness
also adapt the tests so we test for this

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2019-07-03 08:59:47 +02:00
Dominik Csapak
5b79dac99b CephConfig: read monitor addresses also from mon_host for cephfs
since we write only the mon_host config beginning with nautilus,
we have to get the monitor ips from there as well

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2019-06-27 16:16:36 +02:00
Dominik Csapak
c8a3234574 CephConfig: refactor host port parsing
Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2019-06-27 16:16:36 +02:00
Dominik Csapak
c835d9eca8 CephConfig: do not always interpret '; ' as a comment
; is the beginning of a comment, but in some configuration settings
it is also valid syntax, e.g. for mon_host it is a valid
seperator for hosts (sigh ...)

only remove lines when it starts with a ';'

since we remove all comments anyway any time we write the ceph conf
it should not really matter for our users

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2019-06-27 16:16:36 +02:00
Thomas Lamprecht
60fd708242 followup: comment reword
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-06-19 10:23:01 +02:00
Dominik Csapak
9841fa31b5 CephConfig: map special config key characters to _
we want a consistent config has, regardless of how the user or a tool
adds it to the config, so we map ' ' and '-' to '_' in the keys

this way we can always access the correct key without trying multiple
times

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2019-06-19 10:21:42 +02:00
Thomas Lamprecht
de0cd0c2e0 partially revert follow up
see
https://pve.proxmox.com/pipermail/pve-devel/2019-June/037575.html

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-06-17 12:35:56 +02:00
Thomas Lamprecht
f6f22cb3a2 followup: free_image: just check if a file in general exist
don't require any specific file types, if something is here which can
be requested to delete over API/CLI it either comes from an API/CLI
operation and should be thus OK to delete, else a user caused the
creation of the special file and it either works and all is good or
the user gets notified as we check if unlink succeeded anyway

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-06-17 11:51:29 +02:00
Stefan Reiter
26f14f6b07 fix #2226: allow broken symlinks to be deleted via API
Symlinks with a non-existing target fail Perls '-f' test and were thus
not deleteable via the API (failing with '$path does not exist').

Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
2019-06-17 11:49:33 +02:00
Stefan Reiter
5f73686fd3 fix #2226: ignore broken symlinks in *_list
Broken symlinks (and other files without a size) will now show up as 0
byte instead of causing a format validation error in the API.

Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
2019-06-17 11:49:33 +02:00
Alwin Antreich
9553b55c4f cephfs: Exclude _netdev when mounting with fuse
Since ceph-fuse is called directly in the CephFS storage plugin, which
can not process the _netdev option, mounting the CephFS storage fails
when fuse is set in the storage.cfg.

This patch moves the _netdev option into the else part of the if fuse is
set statement. _netdev is only added if the CephFS kernel client mounts
the storage.

It seems _netdev is not needed anyway for the fuse mount, as the
connection is closed, once the fuse process gets killed on shutdown.

Signed-off-by: Alwin Antreich <a.antreich@proxmox.com>
2019-06-14 10:04:51 +02:00
Thomas Lamprecht
243f413ad2 followup: reword comment a bit
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-06-13 11:59:58 +02:00
Stefan Reiter
5c0720d6c9 fix #1427: Set file mode on uploaded templates/ISOs
simply chmod the temp file before copying to the "correct" permission
mode, where all users with access to the directory can read the file,
to mirror the behavior one gets for a apl_download call.

Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
2019-06-13 11:55:18 +02:00
Thomas Lamprecht
11efb06659 drop un-maintained sheepdog plugin
as already announced over two months ago[0], remove the unofficial
SheepDog plugin now completely. Besides that it was never fully
supported in Proxmox VE one of its main developer and ex-maintainer
declared it as abandoned[1], and thus just let's remove it, git
allows to resurrect it any time if a wonder happens anyway.

[0]: https://pve.proxmox.com/pipermail/pve-user/2019-March/170497.html
[1]: http://lists.wpkg.org/pipermail/sheepdog/2019-March/068449.html

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-06-04 17:02:47 +02:00
Thomas Lamprecht
3ed611874e buildsys: split storage plugins to single lines
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-06-04 16:56:46 +02:00
Dominik Csapak
9250ddfe3a Diskmanage: correctly add wearout value of 0
if wearout is 0 we showed 'N/A' instead of 100%
(wearout is really the 'life left' value)

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2019-06-04 13:14:45 +02:00
Dominik Csapak
c5fa45a99f Diskmanage: fix incorrect variable usage
sysdir is a string, we wanted sysdata

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2019-06-04 13:14:45 +02:00
Dominik Csapak
ea928fd41a Diskmanage: extract nvme wearout from smartctl text
extract the info from the line:
Percentage Used: XX%

also adapt the tests

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2019-06-04 13:14:45 +02:00
Dominik Csapak
1dc3038d40 Diskmanage: add append_partition sub
we will use this for adding a partition to a disk when using a device
for ceph osd db/wal which already has partitions on it

first we search for the highest partition number, then add the partition
and search for the resulting device (we cannot assume to simply
append the number, e.g. from /dev/nvme0n1 we get /dev/nvme0n1pX)

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2019-06-04 12:51:44 +02:00
Dominik Csapak
52a064afcd Diskmanage: allow get_disks to take multiple disks
we now expect the first parameter to be either a string with a single
disk, or an array ref with a list of disks

this way we can get the info of multiple disks simultaneously while
not iterating over all disks

this will be used to get the info for osd/db/wal disk

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2019-06-04 12:51:44 +02:00
Dominik Csapak
558d412d10 Disks API: allow also unused disks for db/wal
since we will create a pv/vg/lv on it with nautilus

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2019-06-04 12:51:44 +02:00
Dominik Csapak
c86ba76db7 LVMPlugin: factor out the lv creation
we will want to create lvs manually for ceph nautilus db/wal devices

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2019-06-04 10:26:46 +02:00
Thomas Lamprecht
0180fa427f followup: get_disks: use own variable for frequent access
Less reading and the own name for the variable should helps to grasp
more quickly what it should contain

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-05-31 12:04:42 +02:00
Thomas Lamprecht
248f43f58b follouwp: get_ceph_volume_infos: code and comment cleanup
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-05-31 12:04:13 +02:00
Dominik Csapak
19dcd1adcb Diskmanage: detect osds/journals/etc. created with ceph-volume
ceph-volume creates osds/journal/etc. on LVM instead of partitions,
so to detect them, we have to parse the lv_tags of the LVs and
match them with the underlying device

also add tests for this detection

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2019-05-31 11:41:33 +02:00
Dominik Csapak
cd814c0453 allow disk with LVM for journal devices
With this, users can select disks with LVM on it for journal/db devices,
which will be necessary for ceph nautilus, since there
journals/db/wal will be put on an LV

of course when creating an osd, we have to detect if that
is ok (probably based on the vg name on it)

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2019-05-31 11:41:33 +02:00
Thomas Lamprecht
37ab64f388 api/config update: indentation and whitespace fixes
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-05-15 10:36:01 +02:00
Thomas Lamprecht
91f42b33a0 api/config update: only iterate over hash keys, not values
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-05-15 10:34:12 +02:00
Thomas Lamprecht
4273e3ace9 pvesm set: handle deletion of properties
the delete parameter get's injected by the SectionConfigs
updateSchem, but we need to handle it ourself in the code
This makes the following possible:

pvesm set STORAGEID --delete property

Also the API equivalent is now possible. Adapted from the HA
managers Resource update API call.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-05-14 16:24:34 +02:00
Mira Limbeck
d560ec2860 map_volume: fall back to 'path'
Adds a fallback to 'Plugin::path' in the default implementation of
'map_volume' to simplify a common case of calling 'map_volume' followed
by a defined-check and a call to path if it is not. The path is now
always returned if the plugin in question does not override
'map_volume'.

Signed-off-by: Mira Limbeck <m.limbeck@proxmox.com>
2019-04-29 13:44:40 +00:00
Thomas Lamprecht
b5c8278a3e zpool: handle race with other zpool imports
The underlying issue is that a zpool can get imported only once, so
we first check if it's in `zpool list`, and thus imported, and only
if it does not shows up there we try to import it.

But, this can race with either:
* parallel running activate_storage call, through CLI/API/daemon
* a zpool import from an admin (a bit unlikely, but hey that's the
  thing with race conditions ;))

So refactor the "is pool imported" check into a closure, and call it
addditionally if the import failed, and silent the error if the pool
is now listed, and thus imported. This makes it a little bit nicer to
read too, IMO.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-04-18 10:01:39 +02:00
Thomas Lamprecht
e9ab8ea313 zPool: fixup timeout setting for import
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-04-17 14:54:42 +00:00
Thomas Lamprecht
a10695b4e8 zpool: cleanup zfs_request command a bit
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-04-17 14:31:05 +00:00
Wolfgang Link
dc18abe07b ZFS Pool: improve error output from activate_storage
related to #2154 which has some issues on zpool list, but we do not
see the error messages from that step : Buggy "pvesm status" output
2019-04-17 08:05:04 +00:00
Christian Ebner
4af7713268 Status: Include command error in error message when storage activation fails
Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
2019-04-11 08:04:32 +02:00
Thomas Lamprecht
a2a04139da followup: code cleanup
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-04-10 10:15:42 +02:00
Dominic Jäger
b1f9d99017 Fix #318: Delete vzdump log when deleting a backup
Vzdump log files were not deleted when a backup was deleted.
Consequently, the folder continuously filled with .log files.
Now they get deleted after the backup is removed.

Signed-off-by: Dominic Jäger <d.jaeger@proxmox.com>
2019-04-10 10:10:44 +02:00
Thomas Lamprecht
501562d4b7 code cleanup
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-04-08 17:48:59 +02:00
Stoiko Ivanov
4526dffa53 Diskmanage: don't run zpool if not present
Since zfsutils are not a hard dependency of our stack it is possible to not have
`zpool` available.

Checking for existance of `zpool` before calling it suppresses spurious warnings
in the logs (e.g. when creating Ceph OSDs or accessing the 'Disk' Tab in the
GUI).

Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
2019-04-08 17:47:07 +02:00
Stoiko Ivanov
396aedff95 get_bandwidt_limits: ignore 'undef' as storage
If one of the storages passed in $storage_list was not defined
get_bandwidth_limit died (see [0], of an occurence of this).
This patch changes the behavior to ignore undef as storage instead.

[0] https://pve.proxmox.com/pipermail/pve-devel/2019-April/036515.html

Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
2019-04-05 18:15:01 +02:00
Fabian Grünbichler
c6f1315524 zfs: don't generate/update cachefile on pool import
during storage activation.

for pools that don't get imported at boot (e.g. because their vdevs are
not available when zfs-import-*.service runs) it is fatal to include
them in the cachefile, for those that do get imported at boot this code
should never run anyway as they are already imported.

in any case, a fallback to import without cachefile is the safe variant.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2019-04-03 12:18:37 +02:00
Mira Limbeck
cdef3abb25 workaround zfs create -V error for unaligned sizes
fixes the 'cannot create 'nvme/foo': volume size must be a multiple of
volume block size' error by always rounding the size up to the next 1M
boundary. this is a workaround until
https://github.com/zfsonlinux/zfs/issues/8541 is solved.
the current manpage says 128k is the maximum blocksize, but a local test
showed that values up to 1M are allowed. it might be possible to
increase it even further (see f1512ee61).

Signed-off-by: Mira Limbeck <m.limbeck@proxmox.com>
2019-03-30 15:38:35 +01:00
Stoiko Ivanov
074bdd354f Storage::get_bandwidth_limit: fix if condition
Passing 'undef' as '$storage_list' led to a warning about using an
uninitialized value as array_ref.

Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
2019-03-29 09:04:48 +01:00
Dominik Csapak
eebcdb1119 fix tests when one has iscsi devices
the test would read the real device and if one is an iscsi device
it would fail, move the test code to a sub and mock it in the tests

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2019-03-07 11:08:43 +01:00
Dominik Csapak
3add8714a9 fix content listing for user mode iscsi plugin
the format is a required in the result schema

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2019-03-07 11:08:43 +01:00
Christian Ebner
a8ec2f0227 fix #585: remove leftover disks/directory after VM creation failed
When trying to create a qcow2 disk image with a size larger than available on the
storage, this will fail.
As qemu-img does not clean up the disk afterwards, it needs to be deleted
explicitly. Further, the vmid folder is cleaned up once it is empty.

Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
2019-03-05 10:36:51 +01:00
Thomas Lamprecht
4b5b01192e followup: try to be a bit more like systemd-escape
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-02-20 16:31:25 +01:00
Thomas Lamprecht
fc31916384 followup comment that we do not escape completely like systemd
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-02-20 16:30:46 +01:00
Dominik Csapak
43e04c681e fix #2099: escape systemd path names in mount unit
we only allow '-' '_' and '.' int storage-ids and names,
and we do not need to escape '_' and '.' (see man 5 systemd.unit)

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2019-02-20 16:06:39 +01:00
Thomas Lamprecht
775fdc697d followup: improve comment
while the commit message tells it nicely a comment should add
additional info for people just giving this a quick look

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-02-05 17:42:42 +01:00
Fabian Grünbichler
061b9ca666 check_volume_access: tighten checks for iso/tmpl
(custom) templates might contain sensitive data, so require at least
read access on the underlying storage to access ISO and template files.

the same permissions are already needed for listing them, so this is
unlikely to cause fallout.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2019-02-05 17:14:50 +01:00
Wolfgang Bumiller
f2e5018e70 diskmanage: fix device encoding handling
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-02-04 11:39:02 +01:00
Dominik Csapak
4ec588fe92 allow snippets by default for new dir storages
Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2019-01-31 11:04:29 +01:00
Dominik Csapak
d1eb35ea74 enable snippets content type for all directory based storages
Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2019-01-31 11:04:29 +01:00
Dominik Csapak
7c7ae12f43 add new content type 'snippets'
will be used to contain files which can be executed as hookscripts or
contain custom cloud-init configs

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2019-01-31 11:04:29 +01:00
Thomas Lamprecht
931c35cfa0 fix #1598: use glusterfs daemon default port for online check
use the port where the main glusterfs daemon listens on as ping port,
this one is also used by QEMU as default.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-01-29 08:27:27 +01:00
Christian Ebner
712e27f178 Fix #1941: remove empty directories when freeing image on FS based storages
Remove directories if they are empty, which can happen if all images
from a VM got deleted, e.g., after destroying said VM.

Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
2019-01-24 15:09:20 +01:00
Stoiko Ivanov
4e8de9ad56 Fix #2050: only provide 'conv=sparse' for LvmThin
LVMPlugin->volume_import (used by storage_migrate on either offline
migration with local disks, or online migration with storage-only
referenced disks) passed 'conv=sparse' to `dd`. This can lead to
data-corruption, if the target volume is not zero-initialized.

dropping the sparse argument completely would fix the problem, but
breaks keeping data sparse for LvmThinPlugin.

This patch moves the dd out into (LVM*) plugin specific sub so that
each can control the parameters.

Steps for reproducing the issue:
* create a cluster with (at least) 2 nodes A and B, with a free
  disk-device (/dev/sdx)
* write a recognizable pattern to /dev/sdx on B:
  `dd if=/dev/zero bs=10M | tr '\000' '\255' | dd of=/dev/sdb bs=10M`
  (would be grateful for alternatives to the dd| tr| dd)
* on both A and B create a lvm-vg (pvcreate, vgcreate)
* add it as _not_ shared storage, which is available on nodes A and B
* create a small guest on A
* fill a file in the guest with zeros
  `dd if=/dev/zero of=/zerofil bs=10M`
* stop the guest, migrate it to B
* start the guest - check that the file `/zerofil` contains `ad`
  instead of `00`

Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-01-18 10:46:33 +01:00
Stoiko Ivanov
628a921a94 LVM: Add '--refresh' when activating volumes
From `man 8 lvchange`:
  --refresh
      If the logical volume is active, reload its metadata. This is not
      necessary in normal operation, but may be useful ... if you're doing
      clustering manually without a clustered lock manager.

Fixes migration in a shared LVM (iscsi) setup, where a disk gets resized on one
node A and the guest is afterwards migrated to another node B: B still presents
the old size to the guest, leading to data corruption.

It is necessary to run `lvchange` twice because the options `-ay` and
`--refresh` are mutually exclusive.

Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
2019-01-15 09:43:07 +01:00
Stoiko Ivanov
955c1f2cf7 fix #2046 add volume_size_info to LVMPlugin
Without volume_size_info a Storage plugin falls back to the Implementation
in PVE/Storage/Plugin.pm, which relies on `qemu-img info`.

`qemu-img info` returns wrong results on a node in the case of shared volume
groups (e.g. when sharing disks via iSCSI), if a disk was resized on another
node (it lseeks to the end of the block-device, and this yields the old size).

Using lvs directly fixes the issue, since the LVM metadata gets updated when
invoking lvs.

Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
2019-01-15 09:43:07 +01:00
Thomas Lamprecht
4b3088a0a8 get_monaddr_list: also ensure that returned 'mon addr' are defined
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-01-09 15:23:44 +01:00
Alwin Antreich
187df8553e ceph: get_monaddr_list: exclude general monitor section
Else, if a general MON section existed in the ceph.conf, we added a
undefined entry and a cephfs storage can't be mounted anymore.

Signed-off-by: Alwin Antreich <a.antreich@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-01-09 13:40:21 +01:00
David Limbeck
5b5534a9d7 fix use of uninitialized value in parse_ceph_config
Signed-off-by: David Limbeck <d.limbeck@proxmox.com>
2019-01-03 10:26:57 +01:00
Dominik Csapak
71be011328 register ceph.conf parser/writer
With this we can use cfs_read_file/cfs_write_file and cfs_lock_file.

Code for writing is mostly copied from pve-managers CephTools.pm,
with the addition of mgr sections.

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2018-12-20 09:26:11 +01:00
Dominik Csapak
4050fcc16b move Storage/CephTools to CephConfig
it is not a storage plugin, and it makes more sense to have it
top-level, but there we cannot name it CephTools because of the
existing ones in pve-manager

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2018-12-20 09:26:11 +01:00
Wolfgang Bumiller
c3442aa554 Fix #2020: use /sys to map nvmeXnY to nvmeX
`nvmeX` devices nodes are apparently allocated independently
from their namespace block devices `nvmeXnY` and therefore
they are not strictly related by name. For instance:
  $ readlink /sys/block/nvme0n1/device
  ../../nvme1
  $ readlink /sys/block/nvme1n1/device
  ../../nvme0

Here /dev/nvme0n1 is the first namespace of /dev/nvme1 while
/dev/nvme1n1 is the first namespace of /dev/nvme0.

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2018-12-10 14:54:11 +01:00
Alwin Antreich
d35a0b4b62 Fix #2019: CephFS storage misses maxfiles
Signed-off-by: Alwin Antreich <a.antreich@proxmox.com>
2018-12-07 13:47:05 +01:00
Thomas Lamprecht
54e0b0034b cephfs: tell systemd that mount mount requires network
As we mount this manually and thus systemd doesn't know about any
dependency for cephFS mounts, this got umounted only at the last
stage of shutdown, where network wasn't active anymore.

But, CephFS needs to be connected to an active MDS for a clean
unmount so without network this mount would delay shutdown for quite
a bit, until after some minutes systemd gave up and forced unmount.

So tell systemd that this mount requires network, which can be done
with the '_netdev'[0] mount option, that lucky for us can be also
passed to a mount call and isn't only available for fstab.

with this a mount gets, among others:
> Wants=network-online.target
> Before=umount.target remote-fs.target
> After=remote-fs-pre.target system.slice network.target network-online.target -.mount

Which does the trick for us.

[0]: https://www.freedesktop.org/software/systemd/man/systemd.mount.html#_netdev

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2018-11-27 12:10:36 +01:00
Thomas Lamprecht
957321a86e pvesm: add scan subcommands
Change to a cleaner sub command interface grouping all scan commands.

Alias to old command names for backward compatibility
Best viewed with the ignore whitespace/indent change '-w' flag from
git

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2018-11-22 14:11:38 +01:00
Dominik Csapak
98bf79f78b remove usb scan code
this is now in PVE::SysFSTools

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2018-11-19 13:20:04 +01:00
Dominik Csapak
a0965edde7 remove PVE/API2/Storage/Scan.pm
since those are now defined in pve-manager

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2018-11-19 13:20:04 +01:00
Dominik Csapak
7963ba74bb move Scan API calls from PVE/API2/Storage/Scan.pm to pvesm.pm
since the calls for the real API are defined now in pve-managers Scan.pm

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2018-11-19 13:20:04 +01:00
Thomas Lamprecht
a0908caa99 APIAGE followup: fix typo and print versions in error message
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2018-11-19 12:18:03 +01:00
Wolfgang Bumiller
042dd4be1f plugin loader: add an APIAGE
With the addition of the map/unmap_volume() methods we made
an (actually unnecessary) API version bump.
All current users of these methods fall back to path() when
they return undef, so plugins implementing version 1 are
in fact compatible currently. (In fact, the default
Plugin::map_volume() could fall back to it on its own, but
doesn't currently).

For now let's just allow plugins older plugins to also be
loaded by introducing an API age variable. With it, if we
have a reason to break older plugins, we can have a
deprecation period during which older plugins cause a
warning instead of refusing to load altogether.

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2018-11-19 10:47:46 +01:00
Thomas Lamprecht
49cc7802f7 LVM: lock on volume_resize
This is important for shared LVM storages. As with deletes and
creates of images, as else we may have not the up-to-date metadata
and extents may get reused if another node created an image during
the same time, for example.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2018-11-15 10:13:57 +01:00
Thomas Lamprecht
a4bdab17bb fix #862: do not resolve portal adress on storage add
as described in #862:

> I experienced a problem with ISCSI portal when using a hostname and
> not IP.
> The GUI resolves the hostname to an IP and writes it to storage.cfg.
> As my setup requires hostnames, i needed to change the config
> manually back to the hostname which is working fine.
>
> Why is this conversion done? If I enter a hostname, i want to have a
> hostname. If i enter an IP address i want to have an IP address.

This makes sense to me, a feature of using domains is that they
are/should be resolved when actually using (i.e., connecting to them)
so resolving it once on add does not seems like a good idea (if I do
not miss something - as this is a classic "imported from SVN" I do
not have any rationale to look at).

So save the work and pass it as is.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2018-11-15 10:06:19 +01:00
Dietmar Maurer
40d698932e implement map_volume and unmap_volume
This allows to request a mapped device/path explicitly, regardles of
the storage option, eg. krbd option in the RBDplugin.

Bump of the storage ABI => 2

Co-authored-by: Alwin Antreich <a.antreich@proxmox.com>
Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
2018-11-09 17:25:51 +01:00
Thomas Lamprecht
8b6b710265 folowup: fix whitespace errors and s/and/&&/ for consistency
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2018-11-09 15:27:08 +01:00
Tim Marx
5b4b715771 storage zfs: removed unused variable
Signed-off-by: Tim Marx <t.marx@proxmox.com>
2018-11-09 14:49:43 +01:00
Tim Marx
32f749b840 storage zfs: changed return value description & optionals
Signed-off-by: Tim Marx <t.marx@proxmox.com>
2018-11-09 14:49:43 +01:00
Tim Marx
a49fc735e5 close #1949: storage zfs: changed zpool command parser
Signed-off-by: Tim Marx <t.marx@proxmox.com>
2018-11-09 14:49:43 +01:00
Tim Marx
b005f2f483 Fix: api zfs: changed return value name to errors
Signed-off-by: Tim Marx <t.marx@proxmox.com>
2018-10-29 10:33:39 +01:00
Thomas Lamprecht
a298e55665 remove outdated unused API2::Storage::Replication module
this was not installed, had references to non-existing modules
(e.g., PVE::ReplicationTools) and the things it probably was intended
for are done in pve-manager, which has full access to all pve perl
libs and API methods (from a dependency POV)

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2018-10-03 16:58:57 +02:00
Thomas Lamprecht
0370861cfd diskmanage: rename check_unused to assert_disk_unused
to have a clear method name for this. check_XYZ suggests also that we
return true if the check was OK, but we don't.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2018-10-03 14:51:38 +02:00
Thomas Lamprecht
9280153e10 rename check_available to assert_sid_unused
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2018-10-03 14:49:14 +02:00
Dominik Csapak
4dcb16c0dc fix #1929: only check storage if user want to create one
this is useful if a user wants to create similar storage on each host

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2018-10-03 14:30:22 +02:00
Dominik Csapak
820bab50b9 add missing storage check in LVM Disk API
Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2018-10-03 14:30:22 +02:00
Dominik Csapak
76c1e57be7 refactor disk/storage checks for Disk API
Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2018-10-03 14:30:22 +02:00
Dietmar Maurer
94836d7b8c pvesm iscsiscan: fix cli parameters
Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
2018-10-01 10:56:18 +02:00
Thomas Lamprecht
dd9e97ed14 find_free_diskname: fixup regex match operator
Co-developed-by: Stoiko Ivanov <s.ivanov@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2018-09-19 11:21:37 +02:00
Dietmar Maurer
0057171085 Fix #1925: untaint rbd JSON output
Reviewed-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
Tested-by: Stoiko Ivanov <s.ivanov@proxmox.com>
Reviewed-by: Stoiko Ivanov <s.ivanov@proxmox.com>
Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
2018-09-19 11:21:37 +02:00
Dominik Csapak
401b56fc54 fix #1912: find the partition instead of guessing it
instead of using '$dev1' as partition,
get the information from /sys/block/$dev

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2018-09-14 11:24:42 +02:00
Thomas Lamprecht
dd1fa860d0 get_vm_disk_number: follow up cleanup
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2018-09-14 09:19:08 +02:00
Stoiko Ivanov
f4cc2c4afe Fix #1913: get_vm_disk_number: clone plugindata to avoid side effects
Accessing a non-existing 'format' key in plugindata (e.g., in LvmThinPlugin),
created it by autovivication, thus breaking the fallback to the default value
'raw' upon any following access.

Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
2018-09-14 09:17:40 +02:00
Alwin Antreich
e5b2206f8a rbd: krbd_feature_disable was not disabling features
$features is actually an array reference, so use it as one.
This broke creation and migration of disks on rbd storages

Signed-off-by: Alwin Antreich <a.antreich@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2018-09-12 14:56:36 +02:00
Thomas Lamprecht
83a40b8d3b refactor is_valid_vm_diskname to private simpler sub
This was newly introduced and is only used once, so having a
wantarray return mechanism, without ever using it or knowing for sure
if this may help with reuse of the method is not ideal.

Make the sub a module private one just returning the vm disk number
or explicit undef. Pass it the $suffix variable, to avoid recomputing
it every time called by out caller's loop.

If there's re-use potential in the future we can actually decide what
makes sense to return.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2018-09-11 07:52:43 +02:00
Stoiko Ivanov
c4a29df483 refactor finding next diskname for all plugins
Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
2018-09-10 12:21:10 +02:00
Thomas Lamprecht
59fa9fd6a3 next diskname: start ids with 0 to honor MAX_VOLUMES_PER_GUEST
else we can only have MAX_VOLUMES_PER_GUEST-1 disk per VMID,
not tragic but possible confusing

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2018-09-10 11:21:12 +02:00
Stoiko Ivanov
c0535aa72f make max number of disks a constant
Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
2018-09-07 15:28:15 +02:00
Stoiko Ivanov
345f898108 add vm_diskname helpers (get_next, is_valid)
Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
2018-09-07 15:28:15 +02:00
Alwin Antreich
aa14def420 Addition to fix #1895, skip image if no owner
Non conforming image names are not ignored anymore by the new rbd_ls
implementation, this patch adds the old behaviour.

This fix is a temporary workaround and should be removed, once the new
image name parser is ready.

Signed-off-by: Alwin Antreich <a.antreich@proxmox.com>
2018-09-07 13:51:18 +02:00
Thomas Lamprecht
1be93fe2fd rdb: followup cleanups
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2018-09-06 15:19:16 +02:00
Dominik Csapak
c093e93b28 rbd: remove unused size conversion function
since the json output gives the sizes in bytes, we do not
need to convert anymore

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2018-09-06 15:18:23 +02:00
Dominik Csapak
89a8800bc3 fix #1895: use json for 'rbd ls -l' and 'rbd info'
since ceph changed the plain output format for 12.2.8
we have to change the code anyway, and when were at it,
we can change it to the (hopefully) more robust json output

Co-authored-by: Alwin Antreich <a.antreich@proxmox.com>
Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2018-09-06 15:11:26 +02:00
Dietmar Maurer
1e17594e74 add missing parameter descriptions 2018-08-09 09:52:44 +02:00
Dietmar Maurer
48dccd2fbe cleanup return property descriptions 2018-08-09 09:29:10 +02:00
Dietmar Maurer
2654942813 PVE::API2::Storage::Content::index - document return values 2018-08-09 08:53:24 +02:00
Dominik Csapak
4d12dbffc4 add return description for zfs detail api call
Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2018-08-08 12:01:54 +02:00
Dominik Csapak
e39e8ee213 refactor diskmanagement lock_file calls
so that we only have one place where we reference the lockfile
and the timeout

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2018-08-08 12:01:02 +02:00
Dominik Csapak
7058abe29e add 'single' raidlevel for zfs
the syntax for creating a pool with a single disk is
not the same as for mirror, so let the user select it
explicitely

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2018-08-08 12:00:18 +02:00
Dominik Csapak
38572a8f56 rename raidlvl to raidlevel
Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2018-08-08 11:56:35 +02:00
Dominik Csapak
fdc863c705 fix descriptions of api calls
Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2018-08-08 11:56:17 +02:00
Dietmar Maurer
7d597888a4 cleanup descriptions 2018-08-08 08:22:27 +02:00
Dietmar Maurer
5be1a092d6 fix schema - 'string-list' is a format, not a type 2018-08-08 08:21:06 +02:00
Dominik Csapak
c84106edc9 add API for ZFS management
a list, a detail and a create api call

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2018-08-08 08:02:14 +02:00
Dominik Csapak
5e35281da2 rename lvmcreate to lvmthincreate for lvm thin
Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2018-08-08 07:44:14 +02:00
Dietmar Maurer
d347322a63 PVE::API2::Storage::Status::index - document return schema properties
And add property "used_fraction" - I want to use that for the CLI tool.
2018-08-07 13:24:27 +02:00
Stoiko Ivanov
ca552c7639 Fix #1858: lvm_find_free_diskname check for base
lvm_find_free_diskname only checked for existing volumes starting with 'vm-',
and not with 'base-'.

Unify implementation with other Plugins.

Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
2018-08-07 12:14:11 +02:00
Thomas Lamprecht
f15ac9b5a8 LIO: followup: various small cleanups
move two loop bodies from

if (condition) {
    ...
}

too
next if !condition;

...

to save an indentation level

rename variables to a bit shorter version, i.e.:
s/oneTarget/target/
s/oneTpg/tpg/

and a comment rewording

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2018-08-02 14:57:07 +02:00
Thomas Lamprecht
ff69c66022 LIO: followup: shorter stderr/out logging
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2018-08-02 14:56:20 +02:00
Thomas Lamprecht
ccdf8ddbda LIO: followup: fix indentation 2018-08-02 14:56:20 +02:00
Thomas Lamprecht
d9254744a8 LIO: followup: remove trailing whitespaces
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2018-08-02 14:56:20 +02:00
Udo Rader
46c6107eb1 Linux LIO/targetcli support
Introducing LIO/targetcli support allowing to use recent linux
distributions as iSCSI targets for ZFS volumes.

In order for this to work, two preconditions have to be met:

1. the portal has to be set up correctly using targetcli
2. the initiator has to be authorized to connect to the target
   based on the initiator's InitiatorName

When adding a LIO iSCSI target, a new "LIO target portal group" field needs
to be correctly populated in the "Add: ZFS over iSCSI" popup, containing the
fitting "LIO target portal group" name (typically something like 'tpg1').

Signed-Off-By: Udo Rader <udo.rader@bestsolution.at>
Tested-by: Stoiko Ivanov <s.ivanov@proxmox.com>
2018-08-02 14:56:20 +02:00
Dietmar Maurer
fd87487b3a fix typo 2018-08-02 12:44:30 +02:00
Dominik Csapak
793d720cd2 add API for add Directory storage
creates/lists systemd mount units for /mnt/pve/.*
filetypes allowed are ext4 and xfs for now
mount with /dev/disk/by-uuid

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2018-08-02 12:28:27 +02:00
Dietmar Maurer
fc1880566c cleanup: do not convert exceptions to strings. 2018-08-02 11:39:35 +02:00
Dominik Csapak
0ea9f3844e add API for LVMThin management
like the LVM API, but return an array for the list,
because we do not have nested data here

and create a vg and thin lv with the name given and use the full size

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2018-08-02 11:29:47 +02:00
Dominik Csapak
2c2fd98b87 add metadata_size and _used to lv list
so that we can show it in the webinterface and the user can check
how full it is

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2018-08-02 11:16:05 +02:00
Dominik Csapak
49d149e638 extend list_thinpools for multiple vgs and more information
if no vg is given, give back all thinpools from all vgs
if verbose is 1, then give back the information about the thinpools
(like size and free)

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2018-08-02 11:10:33 +02:00