Commit Graph

47 Commits

Author SHA1 Message Date
Sage Weil
225fefe5e7 ceph-disk: add '[un]suppress-activate <dev>' command
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>
2013-05-13 12:35:32 -07:00
Sage Weil
60603d01e5 ceph-disk: use separate lock files for prepare, activate
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>
2013-05-06 12:12:04 -07:00
Sage Weil
cd1d6fb3f9 ceph-disk: tolerate /sbin/service or /usr/sbin/service
CentOS/RH has it in /sbin, others in /usr/sbin.

Backport: bobtail
Signed-off-by: Sage Weil <sage@inktank.com>
2013-04-30 14:16:04 -07:00
Gary Lowell
7ad63d23d7 ceph-disk: OSD hotplug fixes for Centos
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>
2013-04-22 22:30:39 -07:00
Alexandre Marangone
56619ab917 Fix journal partition creation
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>
2013-04-19 15:11:09 -07:00
Gary Lowell
a793853850 ceph-disk: CalledProcessError has no output keyword on 2.6
Signed-off-by: Gary Lowell  <gary.lowell@inktank.com>
2013-04-02 23:01:12 -07:00
Danny Al-Gaaf
c4eb7e6ddd ceph-disk: fix some (local) variable names
Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
2013-04-02 17:54:53 +02:00
Danny Al-Gaaf
3dd8b46121 ceph-disk: fix naming of local variable in is_mounted()
Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
2013-04-02 17:36:37 +02:00
Danny Al-Gaaf
eaf31bf9f9 ceph-disk: merge twice defined function is_mounted(dev)
Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
2013-04-02 17:33:08 +02:00
Danny Al-Gaaf
4c6d6442a8 ceph-disk: define exception type
Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
2013-04-02 17:26:12 +02:00
Danny Al-Gaaf
058eb923c5 ceph-disk: fix Redefining name 'uuid' from outer scope
Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
2013-04-02 17:17:38 +02:00
Danny Al-Gaaf
0080d1df7c ceph-disk: add missing space after comma
Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
2013-04-02 17:14:23 +02:00
Sage Weil
e9b3f2e6e9 ceph-disk list: say 'unknown cluster $UUID' when cluster is unknown
This makes it clearer that an old osd is in fact old.

Signed-off-by: Sage Weil <sage@inktank.com>
2013-03-29 17:30:28 -07:00
Sage Weil
562e1716bd ceph-disk: handle missing journal_uuid field gracefully
Only lower if we know it's not None.

Signed-off-by: Sage Weil <sage@inktank.com>
2013-03-29 13:59:04 -07:00
Sage Weil
43e451f6ee Merge pull request #166 from ceph/wip-disk-list
Wip disk list

Reviewed-by: Dan Mick <dan.mick@inktank.com>
2013-03-29 12:24:47 -07:00
Sage Weil
6a65b9131c ceph-disk: implement 'list'
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>
2013-03-28 20:49:24 -07:00
Sage Weil
d3e49047ff ceph-disk: reimplement list_all_partitions
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>
2013-03-27 18:44:38 -07:00
Sage Weil
20d594a889 ceph-disk: reimplement is_partition
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>
2013-03-27 18:44:38 -07:00
Sage Weil
4362934a94 ceph-disk: conditionally remove mount path
umount removes it on success; only remove it here if it is still there.

Signed-off-by: Sage Weil <sage@inktank.com>
2013-03-27 16:30:48 -07:00
Sage Weil
2ae297ccb8 ceph-disk: ignore udevadm settle return code
If we time out, just continue and let the next step fail.

Signed-off-by: Sage Weil <sage@inktank.com>
2013-03-27 16:30:48 -07:00
Sage Weil
b8160018bd Merge pull request #144 from dalgaaf/wip-da-ceph-disk
Fix some issues in ceph-dsk

Reviewed-by: Sage Weil <sage@inktank.com>
2013-03-26 12:06:41 -07:00
Gary Lowell
9eda8e5d5a ceph-disk: udevadm settle before partprobe
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>
2013-03-26 11:31:16 -07:00
Danny Al-Gaaf
b7d7e6894c ceph-disk: rename some local variabels in list_*partitions
Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
2013-03-25 17:45:32 +01:00
Danny Al-Gaaf
0b5fcfffe6 ceph-disk: fix naming of a local variable in find_cluster_by_uuid
Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
2013-03-25 16:24:00 +01:00
Danny Al-Gaaf
8a999ded08 ceph-disk: rename some constants to upper case variable names
Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
2013-03-25 16:18:17 +01:00
Danny Al-Gaaf
86e55f5448 ceph-disk: add some more docstrings
Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
2013-03-25 16:15:29 +01:00
Danny Al-Gaaf
543327b1f2 ceph-disk: print subprocess.CalledProcessError on error
Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
2013-03-25 14:36:41 +01:00
Danny Al-Gaaf
2d26bcc071 ceph-disk: fix indention
Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
2013-03-25 13:55:56 +01:00
Sage Weil
6d63752c8f ceph-disk: re-add python 2.7 dependency comment
FIXME!

Signed-off-by: Sage Weil <sage@inktank.com>
2013-03-22 10:09:55 -07:00
Danny Al-Gaaf
87691dc46e ceph-disk: cast output of subprocess.Popen() to str()
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>
2013-03-20 14:36:58 +01:00
Danny Al-Gaaf
3575feb7d2 ceph-disk: fix adjust_symlink() replace 'journal' with 'target'
Replace 'journal' variable with 'target' since journal doesn't
exist in this function.

Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
2013-03-20 14:02:28 +01:00
Danny Al-Gaaf
a27cb85b21 ceph-disk: fix adjust_symlink() replace 'canonical' with 'path'
Replace 'canonical' variable with 'path' since canonical doesn't
exist in this function.

Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
2013-03-20 14:01:02 +01:00
Danny Al-Gaaf
6d3247b5c0 ceph-disk: there is no os.path.lstat use os.lstat
Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
2013-03-20 13:56:23 +01:00
Danny Al-Gaaf
97b4f8d66b ceph-disk: remove unused variable key from prepare_journal_dev()
Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
2013-03-20 13:30:21 +01:00
Danny Al-Gaaf
9daf6cfce2 ceph-disk: fix except to catch OSError
Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
2013-03-20 13:27:27 +01:00
Danny Al-Gaaf
0ada43f79d ceph-disk: add missing space after >> operator
Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
2013-03-20 13:15:36 +01:00
Danny Al-Gaaf
d3c60dc8ca fix: Redefining name 'uuid' from outer scope (line 14)
Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
2013-03-20 12:33:09 +01:00
Danny Al-Gaaf
6a8120d4b0 ceph-disk: remove unused variables from list_partitions()
Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
2013-03-20 12:17:45 +01:00
Danny Al-Gaaf
3af7a1ac5b ceph-disk: fix /dev/dm-[0-9] handling list_all_partitions()
Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
2013-03-20 12:10:22 +01:00
Danny Al-Gaaf
9bcf5b64f4 ceph-disk: rename local variable shadowing builtin
Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
2013-03-19 22:07:36 +01:00
Danny Al-Gaaf
4adf088107 ceph-disk: remove twice defined identical function unmount
Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
2013-03-19 22:05:23 +01:00
Danny Al-Gaaf
ea26ea0d81 ceph-disk: remove twice defined function mount
Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
2013-03-19 22:02:49 +01:00
Danny Al-Gaaf
c57daa3c6e ceph-disk: remove double defined function get_conf
Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
2013-03-19 22:00:41 +01:00
Danny Al-Gaaf
57dde5c8b1 ceph-disk: rename local variable shadowing builtin
Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
2013-03-19 21:51:54 +01:00
Sage Weil
f287c6f90a ceph-disk: simplify command dispatch
Signed-off-by: Sage Weil <sage@inktank.com>
2013-03-19 12:52:23 -07:00
Sage Weil
a019753bd3 ceph-disk: consolidate exceptions
Use a single exception type, and catch it at the top level.

Signed-off-by: Sage Weil <sage@inktank.com>
2013-03-19 12:52:23 -07:00
Sage Weil
20e4ba5ceb ceph-disk: consolidate ceph-disk-* into a single binary
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>
2013-03-19 12:52:23 -07:00