From 21c8854e616810eb0a6e9b902306175405f00f4a Mon Sep 17 00:00:00 2001 From: Alfredo Deza Date: Mon, 17 Jul 2017 15:42:09 -0400 Subject: [PATCH] ceph-volume: devices.lvm: update print and import for py3 support Signed-off-by: Alfredo Deza --- .../ceph_volume/devices/lvm/activate.py | 13 +++--- .../ceph_volume/devices/lvm/prepare.py | 43 ++----------------- 2 files changed, 11 insertions(+), 45 deletions(-) diff --git a/src/ceph-volume/ceph_volume/devices/lvm/activate.py b/src/ceph-volume/ceph_volume/devices/lvm/activate.py index 666c2b45f01ff..51f120391c8b5 100644 --- a/src/ceph-volume/ceph_volume/devices/lvm/activate.py +++ b/src/ceph-volume/ceph_volume/devices/lvm/activate.py @@ -1,10 +1,11 @@ +from __future__ import print_function import argparse import os from textwrap import dedent from ceph_volume import process from ceph_volume.util import activate as activate_utils from ceph_volume.systemd import systemctl -import api +from . import api def activate_filestore(lvs): @@ -54,9 +55,9 @@ class Activate(object): def activate(self, args): lvs = api.Volumes() # filter them down for the OSD ID and FSID we need to activate - lvs.filter(lv_tags={'ceph.osd_id': args.id, 'ceph.osd_fsid': args.fsid}) + lvs.filter(lv_tags={'ceph.osd_id': args.osd_id, 'ceph.osd_fsid': args.osd_fsid}) if not lvs: - raise RuntimeError('could not find osd.%s with fsid %s' % (args.id, args.fsid)) + raise RuntimeError('could not find osd.%s with fsid %s' % (args.osd_id, args.osd_fsid)) activate_filestore(lvs) def main(self): @@ -77,13 +78,13 @@ class Activate(object): ) parser.add_argument( - 'id', + 'osd_id', metavar='ID', nargs='?', help='The ID of the OSD, usually an integer, like 0' ) parser.add_argument( - 'fsid', + 'osd_fsid', metavar='FSID', nargs='?', help='The FSID of the OSD, similar to a SHA1' @@ -99,7 +100,7 @@ class Activate(object): help='filestore objectstore (current default)', ) if len(self.argv) == 0: - print sub_command_help + print(sub_command_help) return args = parser.parse_args(self.argv) self.activate(args) diff --git a/src/ceph-volume/ceph_volume/devices/lvm/prepare.py b/src/ceph-volume/ceph_volume/devices/lvm/prepare.py index e8369bbac2b42..8ec18b21aa90d 100644 --- a/src/ceph-volume/ceph_volume/devices/lvm/prepare.py +++ b/src/ceph-volume/ceph_volume/devices/lvm/prepare.py @@ -1,10 +1,11 @@ -import argparse +from __future__ import print_function import os from textwrap import dedent from ceph_volume.util import prepare as prepare_utils from ceph_volume.util import system from ceph_volume import conf from . import api +from .common import prepare_parser def canonical_device_path(device): @@ -166,48 +167,12 @@ class Prepare(object): ceph-volume lvm prepare --data {volume group} """) - parser = argparse.ArgumentParser( + parser = prepare_parser( prog='ceph-volume lvm prepare', - formatter_class=argparse.RawDescriptionHelpFormatter, description=sub_command_help, ) - required_args = parser.add_argument_group('required arguments') - parser.add_argument( - '--journal', - help='A logical group name, path to a logical volume, or path to a device', - ) - required_args.add_argument( - '--data', - required=True, - help='A logical group name or a path to a logical volume', - ) - parser.add_argument( - '--journal-size', - default=5, - metavar='GB', - type=int, - help='Size (in GB) A logical group name or a path to a logical volume', - ) - parser.add_argument( - '--bluestore', - action='store_true', default=False, - help='Use the bluestore objectstore (not currently supported)', - ) - parser.add_argument( - '--filestore', - action='store_true', default=True, - help='Use the filestore objectstore (currently the only supported object store)', - ) - parser.add_argument( - '--osd-id', - help='Reuse an existing OSD id', - ) - parser.add_argument( - '--osd-fsid', - help='Reuse an existing OSD fsid', - ) if len(self.argv) == 0: - print sub_command_help + print(sub_command_help) return args = parser.parse_args(self.argv) self.prepare(args) -- 2.39.5