X-Git-Url: https://gerrit.opnfv.org/gerrit/gitweb?a=blobdiff_plain;f=src%2Fceph%2Fsrc%2Fceph-volume%2Fceph_volume%2Fdevices%2Fsimple%2Ftrigger.py;fp=src%2Fceph%2Fsrc%2Fceph-volume%2Fceph_volume%2Fdevices%2Fsimple%2Ftrigger.py;h=0000000000000000000000000000000000000000;hb=7da45d65be36d36b880cc55c5036e96c24b53f00;hp=aeb5cf1aaf15e13bfa7969d08ffddcc91a9a8864;hpb=691462d09d0987b47e112d6ee8740375df3c51b2;p=stor4nfv.git diff --git a/src/ceph/src/ceph-volume/ceph_volume/devices/simple/trigger.py b/src/ceph/src/ceph-volume/ceph_volume/devices/simple/trigger.py deleted file mode 100644 index aeb5cf1..0000000 --- a/src/ceph/src/ceph-volume/ceph_volume/devices/simple/trigger.py +++ /dev/null @@ -1,70 +0,0 @@ -from __future__ import print_function -import argparse -from textwrap import dedent -from ceph_volume.exceptions import SuffixParsingError -from ceph_volume import decorators -from .activate import Activate - - -def parse_osd_id(string): - osd_id = string.split('-', 1)[0] - if not osd_id: - raise SuffixParsingError('OSD id', string) - if osd_id.isdigit(): - return osd_id - raise SuffixParsingError('OSD id', string) - - -def parse_osd_uuid(string): - osd_id = '%s-' % parse_osd_id(string) - # remove the id first - osd_uuid = string.split(osd_id, 1)[-1] - if not osd_uuid: - raise SuffixParsingError('OSD uuid', string) - return osd_uuid - - -class Trigger(object): - - help = 'systemd helper to activate an OSD' - - def __init__(self, argv): - self.argv = argv - - @decorators.needs_root - def main(self): - sub_command_help = dedent(""" - ** DO NOT USE DIRECTLY ** - This tool is meant to help the systemd unit that knows about OSDs. - - Proxy OSD activation to ``ceph-volume simple activate`` by parsing the - input from systemd, detecting the UUID and ID associated with an OSD:: - - ceph-volume simple trigger {SYSTEMD-DATA} - - The systemd "data" is expected to be in the format of:: - - {OSD ID}-{OSD UUID} - - The devices associated with the OSD need to have been scanned previously, - so that all needed metadata can be used for starting the OSD process. - """) - parser = argparse.ArgumentParser( - prog='ceph-volume simple trigger', - formatter_class=argparse.RawDescriptionHelpFormatter, - description=sub_command_help, - ) - - parser.add_argument( - 'systemd_data', - metavar='SYSTEMD_DATA', - nargs='?', - help='Data from a systemd unit containing ID and UUID of the OSD, like 0-asdf-lkjh' - ) - if len(self.argv) == 0: - print(sub_command_help) - return - args = parser.parse_args(self.argv) - osd_id = parse_osd_id(args.systemd_data) - osd_uuid = parse_osd_uuid(args.systemd_data) - Activate([osd_id, osd_uuid], systemd=True).main()