Commit Graph

543 Commits

Author SHA1 Message Date
Dominik Csapak
89cf42d411 fix #1379: return size as number instead of string
this caused the webinterface to sort alphabetically instead of numerical
when sorting by image size

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2017-06-02 10:25:19 +02:00
Dominik Csapak
f5451f288d remove immutable flag also for subvols on directory storage
or else the removal of such templates (with rootfs size 0) fails

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2017-03-10 09:21:53 +01:00
Fabian Grünbichler
d746da86d8 rbd: fix exit from 'rbd ls -l' parser 2017-02-23 09:22:57 +01:00
Wolfgang Bumiller
b2e430d30f rbd: minor regex fixup 2017-02-20 10:00:57 +01:00
Fabian Grünbichler
292a33fdd4 rbd: fix typo
Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2017-02-13 12:13:06 +01:00
Fabian Grünbichler
4db25fa2a6 rbd: use consistent image name schemes
since we allow vm-ID-whatever when allocating images, we
should also include those when listing them.

note: '@' is reserved for snapshots in ceph, so it is safe to
skip lines including an '@' in the image name.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2017-02-13 12:13:06 +01:00
Fabian Grünbichler
53a236f2c5 rbd: use 'rbd ls' without '-l' to find free names
with more than a few images, 'rbd ls -l' gets rather slow
compared to a simple 'rbd ls'. since we only need to check
existing image names for finding a free one, the latter is
sufficient.

example with ~400 rbd images:
$ time rbd ls -p ceph-vm > /dev/null
real    0m0.027s
user    0m0.012s
sys     0m0.008s

$ time rbd ls -l -p ceph-vm > /dev/null
real    0m5.250s
user    0m1.632s
sys     0m0.584s

a linked clone of two disks on the same setup accordingly
also shows a massive speedup:

$ time qm clone 1000 10000 -snap test
create linked clone of drive scsi0 (ceph-vm:vm-1000-disk-2)
clone vm-1000-disk-2: vm-1000-disk-2 snapname test to
vm-10000-disk-1
create linked clone of drive scsi1 (ceph-vm:vm-1000-disk-1)
clone vm-1000-disk-1: vm-1000-disk-1 snapname test to
vm-10000-disk-2

real    0m11.157s
user    0m3.752s
sys     0m1.308s

$ time qm clone 1000 10000 -snap test
create linked clone of drive scsi1 (ceph-vm:vm-1000-disk-1)
clone vm-1000-disk-1: vm-1000-disk-1 snapname test to
vm-10000-disk-1
create linked clone of drive scsi0 (ceph-vm:vm-1000-disk-2)
clone vm-1000-disk-2: vm-1000-disk-2 snapname test to
vm-10000-disk-2

real    0m0.872s
user    0m0.652s
sys     0m0.096s

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2017-02-13 12:13:06 +01:00
Dietmar Maurer
ec73c0ff67 fix bug #1280: Can't locate object method "root@pam"
This was introduced by commit 04a13668b9.
2017-02-12 09:55:50 +01:00
Fabian Grünbichler
086c4bf12b extract_vzdump_config: handle RE consistently
Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2017-01-20 11:14:01 +01:00
Fabian Grünbichler
8944339466 weaken matching for vzdump config extract filename
to allow "pvesm extractconfig filename" when in the dump
directory.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2017-01-20 11:13:58 +01:00
Dietmar Maurer
04a13668b9 PVE::Storage: new helper check_volume_access()
Copied from PVE::RPCEnvironment to avoid cyclic dependency
(pve-storgae => pve-access-control => pve-storage).
2017-01-19 09:14:41 +01:00
Dietmar Maurer
ef881e10eb fixes for new PVE::RPCEnvironment implementation
Use PVE::RPCEnvironment->is_worker() instead of
PVE::RPCEnvironment::is_worker().
2017-01-19 09:14:41 +01:00
Wolfgang Bumiller
e438d0940f fix #1252: rbd: delete snapshots when using krbd 2017-01-17 10:32:23 +01:00
Dmitry Petuhov
a4aee43380 Fix RBD resize with krbd option enabled.
With krbd we resize volume and tell QemuSever to notify running QEMU
with zero $size by returning undef.

Signed-off-by: Dmitry Petuhov <mityapetuhov@gmail.com>
2017-01-16 09:14:00 +01:00
Dietmar Maurer
f984732e0e add setup_environment hook to CLIHandler class
and use run_cli_handler instead of depreciated run_cli.
2017-01-12 13:27:43 +01:00
Alexandre Derumier
e2e74320b7 sheepdog : volume_resize return if running
fix : https://forum.proxmox.com/threads/sheepdog-disk-resize-not-working.31760/

Signed-off-by: Alexandre Derumier <aderumier@odiso.com>
2017-01-09 13:27:11 +01:00
Dominik Csapak
1590fc13bf fix #1099 (again): map cciss/c0d0 to cciss!c0d0
there was still a point where we got the wrong string
on createosd we get the devpath (/dev/cciss/c0d0)

but need the info from get_disks, which looks in /sys/block
where it needs to be cciss!c0d0

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2017-01-05 15:54:11 +01:00
Fabian Grünbichler
afd0afe4f5 fix #1135: always clean up ZFS snapshots on migration
otherwise there are situations where snapshots are left
behind for already sent volumes. also include more warnings.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2017-01-03 11:45:16 +01:00
Dietmar Maurer
46f114a53f storage_migrate: use bs=4k to copy images with dd
The default block size is 512 bytes, and is quite slow. We do not
want to use blocks bigger than 4k, because we want to detect empty
blocks (sparse).
2016-12-24 10:55:31 +01:00
Wolfgang Link
0d28307d2f Add function get_blockdev.
This function will return you the block device of a given partition path.
2016-12-22 12:14:34 +01:00
Wolfgang Link
3196c387d2 Add new function part_num
With this function you get the partnum of a dev.
2016-12-22 12:12:47 +01:00
Dominik Csapak
7b32e2a7cd add crucial smart attribute for wear leveling
Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2016-11-30 17:20:09 +01:00
Dominik Csapak
bd54091c2a catch '---' in threshold output of sandisk ssds
sandisk ssds have a default threshold of '---' on nearly all fields,
which prevents our parsing

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2016-11-30 17:19:43 +01:00
Dominik Csapak
2ff3b506a1 use qemu gluster blockdriver for linked clone creation
this works around a bug, where qemu does not align the qcow2 file
when using the filesystem directly, and the gluster blockdriver
refuses to read from it

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2016-11-29 09:40:10 +01:00
Fabian Grünbichler
72bdeea1bf increase default timeout for zpool import
as zpool import can easily take longer than 5 seconds on
systems with lots of disks
2016-11-29 09:30:26 +01:00
Fabian Grünbichler
e2e6380112 improve zpool activate_storage
the old code was way too broad here, this fixes at least the
following issues:
- importing of other/unconfigured zpools by "import -a"
- possible false positives if a pool name is a substring of
  another pool name because of "list" without pool name,
  potentially skipping activation for such pools
- not noticing failure to activate in activate_storage
  because the success of "zpool import -a" does not tell us
  anything about the pool we actually wanted to import

checking specifically for the pool to be activated when
calling "zpool list" gets rid of the second issue, and
trying to import only that pool fixes the other two.
2016-11-29 09:29:33 +01:00
Stefan Priebe
4b7dd9d743 allow --allow-shrink on RBD resize
Signed-off-by: Stefan Priebe <s.priebe@profihost.ag>
2016-11-17 09:06:55 +01:00
Dominik Csapak
571b6f2638 add default rotational value
because if the file does not exist,
we have an perl error for comparing an uninitialized
value

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2016-10-28 10:20:28 +02:00
Dominik Csapak
865bdbd917 use model from udevadm
we want this, because the model in /sys/block/<device>/device/model
is limited to 16 characters

and since the model is not always in the udevadm output (nvme),
also read the model from the model file as fallback

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2016-10-28 10:19:40 +02:00
Dominik Csapak
10a48db55c make dir_is_empty a proper sub
this allows us later to mock the sub,
which we need for testing

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2016-10-28 10:19:40 +02:00
Dominik Csapak
461a9fd8da move directory test into get_sysdir_info
because it logically belongs there, also
this makes the testing easier

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2016-10-28 10:19:40 +02:00
Dominik Csapak
532e89e7be use /sys/block/ path for udev instead of name
since we iterate over the entries in /sys/block
it makes sense to use this path

this should fix #1099
because udevadm does not take
 -n cciss!c0d0 (because it only looks in dev for this)
but takes
 -p /sys/block/cciss!c0d0

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2016-10-28 10:19:40 +02:00
Fabian Grünbichler
8b5ccc06b7 fix #1165: only check mount status when is_mountpoint is set
otherwise the status() method returns garbage for non-mount
point directory storages.
2016-10-13 08:29:30 +02:00
Wolfgang Bumiller
d57fb43d9b disks: fix warnings 2016-10-07 09:28:06 +02:00
Dominik Csapak
a0028cf97e allow rbd images < 1M to be detected
without this, having an efidisk on a ceph storage
prevents creating another disk on the same
ceph storage, because it will not be detected
and we try to allocate one with the same name

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2016-10-07 08:17:40 +02:00
Dominik Csapak
38ddd4ce8e correctly parse cciss devices in get_disks
cciss maps the devices to
/sys/block/cciss!cXdY

and not to

/sys/block/cXdY

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2016-10-06 07:50:05 +02:00
Dominik Csapak
6965a6701e fix #1135: refactor wear level parsing
refactored the wear level parsing into its
own function, where we can now define a
vendor <-> attribute id
mapping

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2016-10-06 07:49:30 +02:00
Dominik Csapak
dd902da78e merge get_smart_data/health
instead of parsing the output of smart in two places,
give get_smart_data a flag if we only want health

this fixes a bug (not on the bugtracker), where
an ssd with disabled smart had an empty string as health
in the gui

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2016-10-06 07:48:57 +02:00
Fabian Grünbichler
c9bd3d22b2 fix #1123: modify NVME device path for SMART support
seems like we need to drop the namespace part before calling
smartctl.

note that NVME devices require smartmontools >= 6.5
2016-10-04 10:35:30 +02:00
Fabian Grünbichler
16bf963b94 add return schema to smart API path 2016-10-04 10:34:47 +02:00
Fabian Grünbichler
dc1311cbe8 fix #1120: non-ATA disks with unstructured smart data
simple parser as fallback for non-ATA disks, just collect
all lines in the "SMART DATA" section.
2016-10-04 10:34:22 +02:00
Fabian Grünbichler
5db2d529ed fix #1120: SCSI SMART health parsing
SCSI disks report their health as "SMART Health Status: OK"
2016-10-04 10:34:06 +02:00
Fabian Grünbichler
7a98a62dbc disks: allow get_disks without smart checks
the smart checks are only needed for the API call(s) that
list all disks and their status, but get_disks is also used
in disk usage checks and in the Ceph code, where the smart
status is completely irrelevant.

drop the implicit skipping of smart checks if $disk is set,
since we have an explicit parameter for this now.
2016-10-04 10:33:49 +02:00
Fabian Grünbichler
1993540bf8 fix #1122: correctly create LUNs for linked clones 2016-09-29 08:42:26 +02:00
Fabian Grünbichler
e3b02ffe6e disks: fix typo 2016-09-29 08:42:15 +02:00
Fabian Grünbichler
1c99955364 disks: parse smart attributes using RE 2016-09-29 08:42:06 +02:00
Fabian Grünbichler
0c486b09df disks: use smartctl -H -A
to only list SMART health and attributes, instead of
"smartctl -a", which prints "all SMART information"
2016-09-29 08:41:31 +02:00
Fabian Grünbichler
acd3d91649 move SMART error handling into get_disks
because we never ever want to die in get_disks because of a
single disk, but the nodes/xyz/disks/smart API path is
allowed to fail if a disk device is unsupported by smartctl
or something else goes wrong.
2016-09-29 08:40:19 +02:00
Wolfgang Bumiller
d547f26c7d Fix #1012: dir storage: add is_mountpoint option
While the mkdir option deals with the case where we don't
want to clobber a mount point with directories (like ZFS,
gluster or NFS), putting a directory storage directly onto a
mount point is still risky:
If the path exists - which it usually does even if not
mounted - the storage will be considered successfully
activated, but empty (or with unexpected content). Some
operations will then lead to unexpected problems: the
free_disk operation for instance only warns if the disk does
not exist, but does not throw an error. In this case the
configuration might be updated without the real disk being
deleted. Once it's mounted back in, later operations which
check existing disks which are not part of the current VM
configuration (like migration) might error unexpectedly.

This adds an 'is_mountpoint' option to directory storages
which assumes the directory is an externally managed mount
point (eg. fstab or zfs) and changes activate_storage() to
throw an error if the path is not mounted.
2016-09-27 09:56:55 +02:00
Wolfgang Bumiller
c7616abcb2 path based storages: improve the mkdir option
So far this only prevented the creation of the toplevel
directory. This does not cover all problem cases,
particularly when said directory is supposed to be a mount
point, including NFS and glusterfs beside ZFS.

The directory based storages we have already use mkpath
whenever they need to create files, and for actions on files
which are supposed to exist it's fine if it errors out.
So it should also be safe to skip the creation of standard
subdirectories in activate_storage().

Additionally NFS and glusterfs storages should also accept
the mkdir option as they otherwise may exhibit similar
issues, eg. when an NFS storage is mounted onto a directory
inside a ZFS subvolume.
2016-09-27 09:54:53 +02:00