]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
ceph-disk: add `--mark-out` option on deactivate feature.
authorVicente Cheng <freeze.bilsted@gmail.com>
Fri, 11 Sep 2015 03:33:13 +0000 (11:33 +0800)
committerVicente Cheng <freeze.bilsted@gmail.com>
Tue, 17 Nov 2015 01:24:43 +0000 (09:24 +0800)
  - Using `--mark-out` option to mark osd out when
    deactivate this osd instead of always mark osd out.

Signed-off-by: Vicente Cheng <freeze.bilsted@gmail.com>
src/ceph-disk

index 19be89f0650dbd2be539fcce7f631740a9d57e6f..54c3fe04ba8680494a4e9f021649b543a0e81333 100755 (executable)
@@ -61,7 +61,7 @@ Activate:
  - triggered on ceph service startup with 'ceph-disk activate-all'
 
 Deactivate:
- - stop ceph-osd service if needed (If osd still in osd map, make it out first)
+ - stop ceph-osd service if needed (make osd out with option --mark-out)
  - remove 'ready', 'active', and INIT-specific files
  - remove gpt partition type and change partition name (prevent triggered by udev)
  - create deactive flag
@@ -2743,10 +2743,12 @@ def main_deactivate(args):
     # Do not do anything if osd is already down.
     status_code = _check_osd_status(args.cluster, args.osd_id)
     if status_code == OSD_STATUS_IN_UP:
-        _mark_osd_out(args.cluster, args.osd_id)
+        if args.mark_out is True:
+            _mark_osd_out(args.cluster, args.osd_id)
         stop_daemon(args.cluster, args.osd_id)
     elif status_code == OSD_STATUS_IN_DOWN:
-        _mark_osd_out(args.cluster, args.osd_id)
+        if args.mark_out is True:
+            _mark_osd_out(args.cluster, args.osd_id)
     elif status_code == OSD_STATUS_OUT_UP:
         stop_daemon(args.cluster, args.osd_id)
     elif status_code == OSD_STATUS_OUT_DOWN:
@@ -3958,6 +3960,11 @@ def make_deactivate_parser(subparsers):
         metavar='OSDID',
         help='ID of OSD to deactivate'
         )
+    deactivate_parser.add_argument(
+        '--mark-out',
+        action='store_true', default=False,
+        help='option to mark this osd out',
+        )
     deactivate_parser.set_defaults(
         func=main_deactivate,
         )