summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSage Weil <sage@inktank.com>2013-06-14 13:34:40 -0700
committerSage Weil <sage@inktank.com>2013-06-17 09:49:53 -0700
commit5c7a23687a1a21bec5cca7b302ac4ba47c78e041 (patch)
treed13f28c68f8f8c20abc81882800019d1bd867de7
parentd512dc9eddef3299167d4bf44e2018b3b6031a22 (diff)
downloadceph-5c7a23687a1a21bec5cca7b302ac4ba47c78e041.tar.gz
ceph-disk: add 'activate-all'
Scan /dev/disk/by-parttypeuuid for ceph OSDs and activate them all. This is useful when the event didn't trigger on the initial udev event for some reason. Signed-off-by: Sage Weil <sage@inktank.com>
-rwxr-xr-xsrc/ceph-disk52
1 files changed, 52 insertions, 0 deletions
diff --git a/src/ceph-disk b/src/ceph-disk
index 127d809902d..cd3b6cce3d5 100755
--- a/src/ceph-disk
+++ b/src/ceph-disk
@@ -1689,6 +1689,39 @@ def main_activate_journal(args):
###########################
+def main_activate_all(args):
+ dir = '/dev/disk/by-parttypeuuid'
+ LOG.debug('Scanning %s', dir)
+ if not os.path.exists(dir):
+ return
+ for name in os.listdir(dir):
+ if name.find('.') < 0:
+ continue
+ (tag, uuid) = name.split('.')
+ if tag == OSD_UUID:
+ path = os.path.join(dir, name)
+ LOG.info('Activating %s', path)
+ activate_lock.acquire()
+ try:
+ (cluster, osd_id) = mount_activate(
+ dev=path,
+ activate_key_template=args.activate_key_template,
+ init=args.mark_init,
+ )
+ start_daemon(
+ cluster=cluster,
+ osd_id=osd_id,
+ )
+
+ except:
+ raise
+
+ finally:
+ activate_lock.release()
+
+
+###########################
+
def is_swap(dev):
dev = os.path.realpath(dev)
with file('/proc/swaps', 'rb') as proc_swaps:
@@ -2090,6 +2123,25 @@ def parse_args():
func=main_activate_journal,
)
+ activate_all_parser = subparsers.add_parser('activate-all', help='Activate all tagged OSD partitions')
+ activate_all_parser.add_argument(
+ '--activate-key',
+ metavar='PATH',
+ help='bootstrap-osd keyring path template (%(default)s)',
+ dest='activate_key_template',
+ )
+ activate_all_parser.add_argument(
+ '--mark-init',
+ metavar='INITSYSTEM',
+ help='init system to manage this dir',
+ default='auto',
+ choices=INIT_SYSTEMS,
+ )
+ activate_all_parser.set_defaults(
+ activate_key_template='/var/lib/ceph/bootstrap-osd/{cluster}.keyring',
+ func=main_activate_all,
+ )
+
list_parser = subparsers.add_parser('list', help='List disks, partitions, and Ceph OSDs')
list_parser.set_defaults(
func=main_list,