It is often useful to prepare but not activate a device, for example when
preparing a bunch of spare disks. This marks a device as 'do not
activate' so that it can be prepared without activating.
Fixes: #3255
Signed-off-by: Sage Weil <sage@inktank.com>
Use a separate lock file for prepare and activate to avoid deadlock. This
didn't seem to trigger on all machines, but in many cases, the prepare
process would take the file lock and later trigger a udev event and the
activate would then block on the same lock, either when we explicitly call
'udevadm settle --timeout=10' or when partprobe does it on our behalf
(without a timeout!). Avoid this by using separate locks for prepare
and activate. We only care if multiple activates race; it is
okay for a prepare to be in progress and for an activate to be kicked
off.
Signed-off-by: Sage Weil <sage@inktank.com>
Two fixes for Centos 6.3 and other systems with udev versions
prior to 172. The disk peristant name using the GPT UUID does
not exist, so use the by_path persistent name instead for the
journal symlink.
The gpt label fields are not available for use in udev rules. Add
ceph-disk-udev wrapper script that extracts the partition
type guid from the label and calls ceph-disk-activate if it is
a ceph guid type. (Bug #4632)
Signed-off-by: Gary Lowell <gary.lowell@inktank.com>
With OSD sharing data and journal, the previous code created the
journal partiton from the end of the device. A uint32_t is
used in sgdisk to get the last sector, with large HD, uint32_t
is too small.
The journal partition will be created backwards from the
a sector in the midlle of the disk leaving space before
and after it. The data partition will use whichever of
these spaces is greater. The remaining will not be used.
This patch creates the journal partition from the start as a workaround.
Signed-off-by: Alexandre Marangone <alexandre.marangone@inktank.com>
This is based on Sandon's initial patch, but much-modified.
Mounts ceph data volumes temporarily to see what is inside. Attempts to
associated journals with osds.
Resolves: #3120
Signed-off-by: Sage Weil <sage@inktank.com>
Reviewed-by: Dan Mick <dan.mick@inktank.com>
Use /dev/disk/by-id to list disks and their partitions. This is more
accurate and correct than the previous (as-yet unused) implementation.
Signed-off-by: Sage Weil <sage@inktank.com>
Previously we were assuming any device that ended in a digit was a
partition, but this is not at all correct (e.g., /dev/sr0, /dev/rbd1).
Instead, look in /dev/disk/by-id and see if there is a symlink that ends in
-partNN that links to our device.
There is probably still a better way...
Signed-off-by: Sage Weil <sage@inktank.com>
After changing the partition table, allow the udev event to be
processed before calling partprobe. This helps prevent partprobe
from getting a resource busy error on some platforms.
Signed-off-by: Gary Lowell <gary.lowell@inktank.com>
Cast output of subprocess.Popen() to str() to be able to use
str.split() and str.splitlines() without warnings from pylint.
Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
ceph-disk prepare ...
ceph-disk activate ...
ceph-disk ...
This let's us share code (we were already duplicating a bunch of stuff!)
and to add new commands easily.
Signed-off-by: Sage Weil <sage@inktank.com>