From: Loic Dachary Date: Mon, 29 Feb 2016 11:13:55 +0000 (+0700) Subject: ceph-disk: implement deactivate --once X-Git-Tag: v10.1.0~200^2~5 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=48c21ced5f6849f1e1580367b32ff1cfb987b37c;p=ceph.git ceph-disk: implement deactivate --once It is mostly useful for test purposes. Signed-off-by: Loic Dachary --- diff --git a/src/ceph-disk/ceph_disk/main.py b/src/ceph-disk/ceph_disk/main.py index 8bbbd190f24..79b1041d99f 100755 --- a/src/ceph-disk/ceph_disk/main.py +++ b/src/ceph-disk/ceph_disk/main.py @@ -3451,12 +3451,13 @@ def main_deactivate_locked(args): LOG.info("OSD already out/down. Do not do anything now.") return - # remove 'ready', 'active', and INIT-specific files. - _remove_osd_directory_files(mounted_path, args.cluster) + if not args.once: + # remove 'ready', 'active', and INIT-specific files. + _remove_osd_directory_files(mounted_path, args.cluster) - # Write deactivate to osd directory! - with open(os.path.join(mounted_path, 'deactive'), 'w'): - path_set_context(os.path.join(mounted_path, 'deactive')) + # Write deactivate to osd directory! + with open(os.path.join(mounted_path, 'deactive'), 'w'): + path_set_context(os.path.join(mounted_path, 'deactive')) unmount(mounted_path) LOG.info("Umount `%s` successfully.", mounted_path) @@ -4755,11 +4756,18 @@ def make_deactivate_parser(subparsers): formatter_class=argparse.RawDescriptionHelpFormatter, description=textwrap.fill(textwrap.dedent("""\ Deactivate the OSD located at PATH. It stops the OSD daemon - and optionally marks it out. The content of the OSD is - left untouched but the, ready, active, INIT-specific - files are removed (so that it is not automatically - re-activated by the udev rules) and the file deactive - is created to remember the OSD is deactivated. + and optionally marks it out (with --mark-out). The content of + the OSD is left untouched. + + By default, the, ready, active, INIT-specific files are + removed (so that it is not automatically re-activated by the + udev rules or ceph-disk trigger) and the file deactive is + created to remember the OSD is deactivated. + + If the --once option is given, the ready, active, INIT-specific + files are not removed and the OSD will reactivate whenever + ceph-disk trigger is run on one of the devices (journal, data, + block, lockbox, ...). If the OSD is dmcrypt, remove the data dmcrypt map. When deactivate finishes, the OSD is down. @@ -4787,6 +4795,11 @@ def make_deactivate_parser(subparsers): action='store_true', default=False, help='option to mark the osd out', ) + deactivate_parser.add_argument( + '--once', + action='store_true', default=False, + help='does not need --reactivate to activate again', + ) deactivate_parser.set_defaults( func=main_deactivate, )