Support multiple volume qos delete
Also make sure that we are using the singular qos_spec when we should and the plural qos_specs otherwise. Change-Id: If4bbeb6fc245d7d80dc3d7dccfe9f949e802653c
This commit is contained in:
parent
bbe71eb9a3
commit
abfb011527
@ -13,10 +13,10 @@ Associate a QoS specification to a volume type
|
|||||||
.. code:: bash
|
.. code:: bash
|
||||||
|
|
||||||
os volume qos associate
|
os volume qos associate
|
||||||
<qos-specs>
|
<qos-spec>
|
||||||
<volume-type>
|
<volume-type>
|
||||||
|
|
||||||
.. describe:: <qos-specs>
|
.. describe:: <qos-spec>
|
||||||
|
|
||||||
QoS specification to modify (name or ID)
|
QoS specification to modify (name or ID)
|
||||||
|
|
||||||
@ -58,11 +58,11 @@ Delete QoS specification
|
|||||||
.. code:: bash
|
.. code:: bash
|
||||||
|
|
||||||
os volume qos delete
|
os volume qos delete
|
||||||
<qos-specs>
|
<qos-spec> [<qos-spec> ...]
|
||||||
|
|
||||||
.. describe:: <qos-specs>
|
.. describe:: <qos-spec>
|
||||||
|
|
||||||
QoS specification to delete (name or ID)
|
QoS specification(s) to delete (name or ID)
|
||||||
|
|
||||||
volume qos disassociate
|
volume qos disassociate
|
||||||
-----------------------
|
-----------------------
|
||||||
@ -74,7 +74,7 @@ Disassociate a QoS specification from a volume type
|
|||||||
|
|
||||||
os volume qos disassociate
|
os volume qos disassociate
|
||||||
--volume-type <volume-type> | --all
|
--volume-type <volume-type> | --all
|
||||||
<qos-specs>
|
<qos-spec>
|
||||||
|
|
||||||
.. option:: --volume-type <volume-type>
|
.. option:: --volume-type <volume-type>
|
||||||
|
|
||||||
@ -84,7 +84,7 @@ Disassociate a QoS specification from a volume type
|
|||||||
|
|
||||||
Disassociate the QoS from every volume type
|
Disassociate the QoS from every volume type
|
||||||
|
|
||||||
.. describe:: <qos-specs>
|
.. describe:: <qos-spec>
|
||||||
|
|
||||||
QoS specification to modify (name or ID)
|
QoS specification to modify (name or ID)
|
||||||
|
|
||||||
@ -108,13 +108,13 @@ Set QoS specification properties
|
|||||||
|
|
||||||
os volume qos set
|
os volume qos set
|
||||||
[--property <key=value> [...] ]
|
[--property <key=value> [...] ]
|
||||||
<qos-specs>
|
<qos-spec>
|
||||||
|
|
||||||
.. option:: --property <key=value>
|
.. option:: --property <key=value>
|
||||||
|
|
||||||
Property to add or modify for this QoS specification (repeat option to set multiple properties)
|
Property to add or modify for this QoS specification (repeat option to set multiple properties)
|
||||||
|
|
||||||
.. describe:: <qos-specs>
|
.. describe:: <qos-spec>
|
||||||
|
|
||||||
QoS specification to modify (name or ID)
|
QoS specification to modify (name or ID)
|
||||||
|
|
||||||
@ -127,9 +127,9 @@ Display QoS specification details
|
|||||||
.. code:: bash
|
.. code:: bash
|
||||||
|
|
||||||
os volume qos show
|
os volume qos show
|
||||||
<qos-specs>
|
<qos-spec>
|
||||||
|
|
||||||
.. describe:: <qos-specs>
|
.. describe:: <qos-spec>
|
||||||
|
|
||||||
QoS specification to display (name or ID)
|
QoS specification to display (name or ID)
|
||||||
|
|
||||||
@ -143,12 +143,12 @@ Unset QoS specification properties
|
|||||||
|
|
||||||
os volume qos unset
|
os volume qos unset
|
||||||
[--property <key>]
|
[--property <key>]
|
||||||
<qos-specs>
|
<qos-spec>
|
||||||
|
|
||||||
.. option:: --property <key>
|
.. option:: --property <key>
|
||||||
|
|
||||||
Property to remove from QoS specification (repeat option to remove multiple properties)
|
Property to remove from QoS specification (repeat option to remove multiple properties)
|
||||||
|
|
||||||
.. describe:: <qos-specs>
|
.. describe:: <qos-spec>
|
||||||
|
|
||||||
QoS specification to modify (name or ID)
|
QoS specification to modify (name or ID)
|
||||||
|
@ -56,7 +56,7 @@ class TestQosAssociate(TestQos):
|
|||||||
volume_fakes.type_id
|
volume_fakes.type_id
|
||||||
]
|
]
|
||||||
verifylist = [
|
verifylist = [
|
||||||
('qos_specs', volume_fakes.qos_id),
|
('qos_spec', volume_fakes.qos_id),
|
||||||
('volume_type', volume_fakes.type_id)
|
('volume_type', volume_fakes.type_id)
|
||||||
]
|
]
|
||||||
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
||||||
@ -210,7 +210,7 @@ class TestQosDelete(TestQos):
|
|||||||
volume_fakes.qos_id
|
volume_fakes.qos_id
|
||||||
]
|
]
|
||||||
verifylist = [
|
verifylist = [
|
||||||
('qos_specs', volume_fakes.qos_id)
|
('qos_specs', [volume_fakes.qos_id])
|
||||||
]
|
]
|
||||||
|
|
||||||
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
||||||
@ -223,7 +223,7 @@ class TestQosDelete(TestQos):
|
|||||||
volume_fakes.qos_name
|
volume_fakes.qos_name
|
||||||
]
|
]
|
||||||
verifylist = [
|
verifylist = [
|
||||||
('qos_specs', volume_fakes.qos_name)
|
('qos_specs', [volume_fakes.qos_name])
|
||||||
]
|
]
|
||||||
|
|
||||||
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
||||||
@ -255,7 +255,7 @@ class TestQosDisassociate(TestQos):
|
|||||||
'--volume-type', volume_fakes.type_id
|
'--volume-type', volume_fakes.type_id
|
||||||
]
|
]
|
||||||
verifylist = [
|
verifylist = [
|
||||||
('qos_specs', volume_fakes.qos_id),
|
('qos_spec', volume_fakes.qos_id),
|
||||||
('volume_type', volume_fakes.type_id)
|
('volume_type', volume_fakes.type_id)
|
||||||
]
|
]
|
||||||
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
||||||
@ -278,7 +278,7 @@ class TestQosDisassociate(TestQos):
|
|||||||
'--all'
|
'--all'
|
||||||
]
|
]
|
||||||
verifylist = [
|
verifylist = [
|
||||||
('qos_specs', volume_fakes.qos_id)
|
('qos_spec', volume_fakes.qos_id)
|
||||||
]
|
]
|
||||||
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
||||||
|
|
||||||
@ -351,7 +351,7 @@ class TestQosSet(TestQos):
|
|||||||
'--property', 'iops=9001'
|
'--property', 'iops=9001'
|
||||||
]
|
]
|
||||||
verifylist = [
|
verifylist = [
|
||||||
('qos_specs', volume_fakes.qos_id),
|
('qos_spec', volume_fakes.qos_id),
|
||||||
('property', volume_fakes.qos_specs)
|
('property', volume_fakes.qos_specs)
|
||||||
]
|
]
|
||||||
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
||||||
@ -386,7 +386,7 @@ class TestQosShow(TestQos):
|
|||||||
volume_fakes.qos_id
|
volume_fakes.qos_id
|
||||||
]
|
]
|
||||||
verifylist = [
|
verifylist = [
|
||||||
('qos_specs', volume_fakes.qos_id)
|
('qos_spec', volume_fakes.qos_id)
|
||||||
]
|
]
|
||||||
|
|
||||||
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
||||||
@ -434,7 +434,7 @@ class TestQosUnset(TestQos):
|
|||||||
]
|
]
|
||||||
|
|
||||||
verifylist = [
|
verifylist = [
|
||||||
('qos_specs', volume_fakes.qos_id),
|
('qos_spec', volume_fakes.qos_id),
|
||||||
('property', ['iops', 'foo'])
|
('property', ['iops', 'foo'])
|
||||||
]
|
]
|
||||||
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
||||||
|
@ -56,7 +56,7 @@ class TestQosAssociate(TestQos):
|
|||||||
volume_fakes.type_id
|
volume_fakes.type_id
|
||||||
]
|
]
|
||||||
verifylist = [
|
verifylist = [
|
||||||
('qos_specs', volume_fakes.qos_id),
|
('qos_spec', volume_fakes.qos_id),
|
||||||
('volume_type', volume_fakes.type_id)
|
('volume_type', volume_fakes.type_id)
|
||||||
]
|
]
|
||||||
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
||||||
@ -210,7 +210,7 @@ class TestQosDelete(TestQos):
|
|||||||
volume_fakes.qos_id
|
volume_fakes.qos_id
|
||||||
]
|
]
|
||||||
verifylist = [
|
verifylist = [
|
||||||
('qos_specs', volume_fakes.qos_id)
|
('qos_specs', [volume_fakes.qos_id])
|
||||||
]
|
]
|
||||||
|
|
||||||
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
||||||
@ -223,7 +223,7 @@ class TestQosDelete(TestQos):
|
|||||||
volume_fakes.qos_name
|
volume_fakes.qos_name
|
||||||
]
|
]
|
||||||
verifylist = [
|
verifylist = [
|
||||||
('qos_specs', volume_fakes.qos_name)
|
('qos_specs', [volume_fakes.qos_name])
|
||||||
]
|
]
|
||||||
|
|
||||||
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
||||||
@ -255,7 +255,7 @@ class TestQosDisassociate(TestQos):
|
|||||||
'--volume-type', volume_fakes.type_id
|
'--volume-type', volume_fakes.type_id
|
||||||
]
|
]
|
||||||
verifylist = [
|
verifylist = [
|
||||||
('qos_specs', volume_fakes.qos_id),
|
('qos_spec', volume_fakes.qos_id),
|
||||||
('volume_type', volume_fakes.type_id)
|
('volume_type', volume_fakes.type_id)
|
||||||
]
|
]
|
||||||
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
||||||
@ -278,7 +278,7 @@ class TestQosDisassociate(TestQos):
|
|||||||
'--all'
|
'--all'
|
||||||
]
|
]
|
||||||
verifylist = [
|
verifylist = [
|
||||||
('qos_specs', volume_fakes.qos_id)
|
('qos_spec', volume_fakes.qos_id)
|
||||||
]
|
]
|
||||||
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
||||||
|
|
||||||
@ -351,7 +351,7 @@ class TestQosSet(TestQos):
|
|||||||
'--property', 'iops=9001'
|
'--property', 'iops=9001'
|
||||||
]
|
]
|
||||||
verifylist = [
|
verifylist = [
|
||||||
('qos_specs', volume_fakes.qos_id),
|
('qos_spec', volume_fakes.qos_id),
|
||||||
('property', volume_fakes.qos_specs)
|
('property', volume_fakes.qos_specs)
|
||||||
]
|
]
|
||||||
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
||||||
@ -386,7 +386,7 @@ class TestQosShow(TestQos):
|
|||||||
volume_fakes.qos_id
|
volume_fakes.qos_id
|
||||||
]
|
]
|
||||||
verifylist = [
|
verifylist = [
|
||||||
('qos_specs', volume_fakes.qos_id)
|
('qos_spec', volume_fakes.qos_id)
|
||||||
]
|
]
|
||||||
|
|
||||||
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
||||||
@ -434,7 +434,7 @@ class TestQosUnset(TestQos):
|
|||||||
]
|
]
|
||||||
|
|
||||||
verifylist = [
|
verifylist = [
|
||||||
('qos_specs', volume_fakes.qos_id),
|
('qos_spec', volume_fakes.qos_id),
|
||||||
('property', ['iops', 'foo'])
|
('property', ['iops', 'foo'])
|
||||||
]
|
]
|
||||||
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
||||||
|
@ -34,8 +34,8 @@ class AssociateQos(command.Command):
|
|||||||
def get_parser(self, prog_name):
|
def get_parser(self, prog_name):
|
||||||
parser = super(AssociateQos, self).get_parser(prog_name)
|
parser = super(AssociateQos, self).get_parser(prog_name)
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
'qos_specs',
|
'qos_spec',
|
||||||
metavar='<qos-specs>',
|
metavar='<qos-spec>',
|
||||||
help='QoS specification to modify (name or ID)',
|
help='QoS specification to modify (name or ID)',
|
||||||
)
|
)
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
@ -48,12 +48,12 @@ class AssociateQos(command.Command):
|
|||||||
def take_action(self, parsed_args):
|
def take_action(self, parsed_args):
|
||||||
self.log.debug('take_action(%s)', parsed_args)
|
self.log.debug('take_action(%s)', parsed_args)
|
||||||
volume_client = self.app.client_manager.volume
|
volume_client = self.app.client_manager.volume
|
||||||
qos_specs = utils.find_resource(volume_client.qos_specs,
|
qos_spec = utils.find_resource(volume_client.qos_specs,
|
||||||
parsed_args.qos_specs)
|
parsed_args.qos_spec)
|
||||||
volume_type = utils.find_resource(volume_client.volume_types,
|
volume_type = utils.find_resource(volume_client.volume_types,
|
||||||
parsed_args.volume_type)
|
parsed_args.volume_type)
|
||||||
|
|
||||||
volume_client.qos_specs.associate(qos_specs.id, volume_type.id)
|
volume_client.qos_specs.associate(qos_spec.id, volume_type.id)
|
||||||
|
|
||||||
return
|
return
|
||||||
|
|
||||||
@ -97,9 +97,9 @@ class CreateQos(show.ShowOne):
|
|||||||
if parsed_args.property:
|
if parsed_args.property:
|
||||||
specs.update(parsed_args.property)
|
specs.update(parsed_args.property)
|
||||||
|
|
||||||
qos_specs = volume_client.qos_specs.create(parsed_args.name, specs)
|
qos_spec = volume_client.qos_specs.create(parsed_args.name, specs)
|
||||||
|
|
||||||
return zip(*sorted(six.iteritems(qos_specs._info)))
|
return zip(*sorted(six.iteritems(qos_spec._info)))
|
||||||
|
|
||||||
|
|
||||||
class DeleteQos(command.Command):
|
class DeleteQos(command.Command):
|
||||||
@ -111,19 +111,18 @@ class DeleteQos(command.Command):
|
|||||||
parser = super(DeleteQos, self).get_parser(prog_name)
|
parser = super(DeleteQos, self).get_parser(prog_name)
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
'qos_specs',
|
'qos_specs',
|
||||||
metavar='<qos-specs>',
|
metavar='<qos-spec>',
|
||||||
help='QoS specification to delete (name or ID)',
|
nargs="+",
|
||||||
|
help='QoS specification(s) to delete (name or ID)',
|
||||||
)
|
)
|
||||||
return parser
|
return parser
|
||||||
|
|
||||||
def take_action(self, parsed_args):
|
def take_action(self, parsed_args):
|
||||||
self.log.debug('take_action(%s)', parsed_args)
|
self.log.debug('take_action(%s)', parsed_args)
|
||||||
volume_client = self.app.client_manager.volume
|
volume_client = self.app.client_manager.volume
|
||||||
qos_specs = utils.find_resource(volume_client.qos_specs,
|
for qos in parsed_args.qos_specs:
|
||||||
parsed_args.qos_specs)
|
qos_spec = utils.find_resource(volume_client.qos_specs, qos)
|
||||||
|
volume_client.qos_specs.delete(qos_spec.id)
|
||||||
volume_client.qos_specs.delete(qos_specs.id)
|
|
||||||
|
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|
||||||
@ -135,8 +134,8 @@ class DisassociateQos(command.Command):
|
|||||||
def get_parser(self, prog_name):
|
def get_parser(self, prog_name):
|
||||||
parser = super(DisassociateQos, self).get_parser(prog_name)
|
parser = super(DisassociateQos, self).get_parser(prog_name)
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
'qos_specs',
|
'qos_spec',
|
||||||
metavar='<qos-specs>',
|
metavar='<qos-spec>',
|
||||||
help='QoS specification to modify (name or ID)',
|
help='QoS specification to modify (name or ID)',
|
||||||
)
|
)
|
||||||
volume_type_group = parser.add_mutually_exclusive_group()
|
volume_type_group = parser.add_mutually_exclusive_group()
|
||||||
@ -157,15 +156,15 @@ class DisassociateQos(command.Command):
|
|||||||
def take_action(self, parsed_args):
|
def take_action(self, parsed_args):
|
||||||
self.log.debug('take_action(%s)', parsed_args)
|
self.log.debug('take_action(%s)', parsed_args)
|
||||||
volume_client = self.app.client_manager.volume
|
volume_client = self.app.client_manager.volume
|
||||||
qos_specs = utils.find_resource(volume_client.qos_specs,
|
qos_spec = utils.find_resource(volume_client.qos_specs,
|
||||||
parsed_args.qos_specs)
|
parsed_args.qos_spec)
|
||||||
|
|
||||||
if parsed_args.volume_type:
|
if parsed_args.volume_type:
|
||||||
volume_type = utils.find_resource(volume_client.volume_types,
|
volume_type = utils.find_resource(volume_client.volume_types,
|
||||||
parsed_args.volume_type)
|
parsed_args.volume_type)
|
||||||
volume_client.qos_specs.disassociate(qos_specs.id, volume_type.id)
|
volume_client.qos_specs.disassociate(qos_spec.id, volume_type.id)
|
||||||
elif parsed_args.all:
|
elif parsed_args.all:
|
||||||
volume_client.qos_specs.disassociate_all(qos_specs.id)
|
volume_client.qos_specs.disassociate_all(qos_spec.id)
|
||||||
|
|
||||||
return
|
return
|
||||||
|
|
||||||
@ -206,8 +205,8 @@ class SetQos(command.Command):
|
|||||||
def get_parser(self, prog_name):
|
def get_parser(self, prog_name):
|
||||||
parser = super(SetQos, self).get_parser(prog_name)
|
parser = super(SetQos, self).get_parser(prog_name)
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
'qos_specs',
|
'qos_spec',
|
||||||
metavar='<qos-specs>',
|
metavar='<qos-spec>',
|
||||||
help='QoS specification to modify (name or ID)',
|
help='QoS specification to modify (name or ID)',
|
||||||
)
|
)
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
@ -222,11 +221,11 @@ class SetQos(command.Command):
|
|||||||
def take_action(self, parsed_args):
|
def take_action(self, parsed_args):
|
||||||
self.log.debug('take_action(%s)', parsed_args)
|
self.log.debug('take_action(%s)', parsed_args)
|
||||||
volume_client = self.app.client_manager.volume
|
volume_client = self.app.client_manager.volume
|
||||||
qos_specs = utils.find_resource(volume_client.qos_specs,
|
qos_spec = utils.find_resource(volume_client.qos_specs,
|
||||||
parsed_args.qos_specs)
|
parsed_args.qos_spec)
|
||||||
|
|
||||||
if parsed_args.property:
|
if parsed_args.property:
|
||||||
volume_client.qos_specs.set_keys(qos_specs.id,
|
volume_client.qos_specs.set_keys(qos_spec.id,
|
||||||
parsed_args.property)
|
parsed_args.property)
|
||||||
else:
|
else:
|
||||||
self.app.log.error("No changes requested\n")
|
self.app.log.error("No changes requested\n")
|
||||||
@ -242,8 +241,8 @@ class ShowQos(show.ShowOne):
|
|||||||
def get_parser(self, prog_name):
|
def get_parser(self, prog_name):
|
||||||
parser = super(ShowQos, self).get_parser(prog_name)
|
parser = super(ShowQos, self).get_parser(prog_name)
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
'qos_specs',
|
'qos_spec',
|
||||||
metavar='<qos-specs>',
|
metavar='<qos-spec>',
|
||||||
help='QoS specification to display (name or ID)',
|
help='QoS specification to display (name or ID)',
|
||||||
)
|
)
|
||||||
return parser
|
return parser
|
||||||
@ -251,19 +250,19 @@ class ShowQos(show.ShowOne):
|
|||||||
def take_action(self, parsed_args):
|
def take_action(self, parsed_args):
|
||||||
self.log.debug('take_action(%s)', parsed_args)
|
self.log.debug('take_action(%s)', parsed_args)
|
||||||
volume_client = self.app.client_manager.volume
|
volume_client = self.app.client_manager.volume
|
||||||
qos_specs = utils.find_resource(volume_client.qos_specs,
|
qos_spec = utils.find_resource(volume_client.qos_specs,
|
||||||
parsed_args.qos_specs)
|
parsed_args.qos_spec)
|
||||||
|
|
||||||
qos_associations = volume_client.qos_specs.get_associations(qos_specs)
|
qos_associations = volume_client.qos_specs.get_associations(qos_spec)
|
||||||
if qos_associations:
|
if qos_associations:
|
||||||
associations = [association.name
|
associations = [association.name
|
||||||
for association in qos_associations]
|
for association in qos_associations]
|
||||||
qos_specs._info.update({
|
qos_spec._info.update({
|
||||||
'associations': utils.format_list(associations)
|
'associations': utils.format_list(associations)
|
||||||
})
|
})
|
||||||
qos_specs._info.update({'specs': utils.format_dict(qos_specs.specs)})
|
qos_spec._info.update({'specs': utils.format_dict(qos_spec.specs)})
|
||||||
|
|
||||||
return zip(*sorted(six.iteritems(qos_specs._info)))
|
return zip(*sorted(six.iteritems(qos_spec._info)))
|
||||||
|
|
||||||
|
|
||||||
class UnsetQos(command.Command):
|
class UnsetQos(command.Command):
|
||||||
@ -274,8 +273,8 @@ class UnsetQos(command.Command):
|
|||||||
def get_parser(self, prog_name):
|
def get_parser(self, prog_name):
|
||||||
parser = super(UnsetQos, self).get_parser(prog_name)
|
parser = super(UnsetQos, self).get_parser(prog_name)
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
'qos_specs',
|
'qos_spec',
|
||||||
metavar='<qos-specs>',
|
metavar='<qos-spec>',
|
||||||
help='QoS specification to modify (name or ID)',
|
help='QoS specification to modify (name or ID)',
|
||||||
)
|
)
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
@ -291,11 +290,11 @@ class UnsetQos(command.Command):
|
|||||||
def take_action(self, parsed_args):
|
def take_action(self, parsed_args):
|
||||||
self.log.debug('take_action(%s)', parsed_args)
|
self.log.debug('take_action(%s)', parsed_args)
|
||||||
volume_client = self.app.client_manager.volume
|
volume_client = self.app.client_manager.volume
|
||||||
qos_specs = utils.find_resource(volume_client.qos_specs,
|
qos_spec = utils.find_resource(volume_client.qos_specs,
|
||||||
parsed_args.qos_specs)
|
parsed_args.qos_spec)
|
||||||
|
|
||||||
if parsed_args.property:
|
if parsed_args.property:
|
||||||
volume_client.qos_specs.unset_keys(qos_specs.id,
|
volume_client.qos_specs.unset_keys(qos_spec.id,
|
||||||
parsed_args.property)
|
parsed_args.property)
|
||||||
else:
|
else:
|
||||||
self.app.log.error("No changes requested\n")
|
self.app.log.error("No changes requested\n")
|
||||||
|
@ -34,8 +34,8 @@ class AssociateQos(command.Command):
|
|||||||
def get_parser(self, prog_name):
|
def get_parser(self, prog_name):
|
||||||
parser = super(AssociateQos, self).get_parser(prog_name)
|
parser = super(AssociateQos, self).get_parser(prog_name)
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
'qos_specs',
|
'qos_spec',
|
||||||
metavar='<qos-specs>',
|
metavar='<qos-spec>',
|
||||||
help='QoS specification to modify (name or ID)',
|
help='QoS specification to modify (name or ID)',
|
||||||
)
|
)
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
@ -48,12 +48,12 @@ class AssociateQos(command.Command):
|
|||||||
def take_action(self, parsed_args):
|
def take_action(self, parsed_args):
|
||||||
self.log.debug('take_action(%s)', parsed_args)
|
self.log.debug('take_action(%s)', parsed_args)
|
||||||
volume_client = self.app.client_manager.volume
|
volume_client = self.app.client_manager.volume
|
||||||
qos_specs = utils.find_resource(volume_client.qos_specs,
|
qos_spec = utils.find_resource(volume_client.qos_specs,
|
||||||
parsed_args.qos_specs)
|
parsed_args.qos_spec)
|
||||||
volume_type = utils.find_resource(volume_client.volume_types,
|
volume_type = utils.find_resource(volume_client.volume_types,
|
||||||
parsed_args.volume_type)
|
parsed_args.volume_type)
|
||||||
|
|
||||||
volume_client.qos_specs.associate(qos_specs.id, volume_type.id)
|
volume_client.qos_specs.associate(qos_spec.id, volume_type.id)
|
||||||
|
|
||||||
return
|
return
|
||||||
|
|
||||||
@ -97,9 +97,9 @@ class CreateQos(show.ShowOne):
|
|||||||
if parsed_args.property:
|
if parsed_args.property:
|
||||||
specs.update(parsed_args.property)
|
specs.update(parsed_args.property)
|
||||||
|
|
||||||
qos_specs = volume_client.qos_specs.create(parsed_args.name, specs)
|
qos_spec = volume_client.qos_specs.create(parsed_args.name, specs)
|
||||||
|
|
||||||
return zip(*sorted(six.iteritems(qos_specs._info)))
|
return zip(*sorted(six.iteritems(qos_spec._info)))
|
||||||
|
|
||||||
|
|
||||||
class DeleteQos(command.Command):
|
class DeleteQos(command.Command):
|
||||||
@ -111,19 +111,18 @@ class DeleteQos(command.Command):
|
|||||||
parser = super(DeleteQos, self).get_parser(prog_name)
|
parser = super(DeleteQos, self).get_parser(prog_name)
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
'qos_specs',
|
'qos_specs',
|
||||||
metavar='<qos-specs>',
|
metavar='<qos-spec>',
|
||||||
help='QoS specification to delete (name or ID)',
|
nargs="+",
|
||||||
|
help='QoS specification(s) to delete (name or ID)',
|
||||||
)
|
)
|
||||||
return parser
|
return parser
|
||||||
|
|
||||||
def take_action(self, parsed_args):
|
def take_action(self, parsed_args):
|
||||||
self.log.debug('take_action(%s)', parsed_args)
|
self.log.debug('take_action(%s)', parsed_args)
|
||||||
volume_client = self.app.client_manager.volume
|
volume_client = self.app.client_manager.volume
|
||||||
qos_specs = utils.find_resource(volume_client.qos_specs,
|
for qos in parsed_args.qos_specs:
|
||||||
parsed_args.qos_specs)
|
qos_spec = utils.find_resource(volume_client.qos_specs, qos)
|
||||||
|
volume_client.qos_specs.delete(qos_spec.id)
|
||||||
volume_client.qos_specs.delete(qos_specs.id)
|
|
||||||
|
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|
||||||
@ -135,8 +134,8 @@ class DisassociateQos(command.Command):
|
|||||||
def get_parser(self, prog_name):
|
def get_parser(self, prog_name):
|
||||||
parser = super(DisassociateQos, self).get_parser(prog_name)
|
parser = super(DisassociateQos, self).get_parser(prog_name)
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
'qos_specs',
|
'qos_spec',
|
||||||
metavar='<qos-specs>',
|
metavar='<qos-spec>',
|
||||||
help='QoS specification to modify (name or ID)',
|
help='QoS specification to modify (name or ID)',
|
||||||
)
|
)
|
||||||
volume_type_group = parser.add_mutually_exclusive_group()
|
volume_type_group = parser.add_mutually_exclusive_group()
|
||||||
@ -157,15 +156,15 @@ class DisassociateQos(command.Command):
|
|||||||
def take_action(self, parsed_args):
|
def take_action(self, parsed_args):
|
||||||
self.log.debug('take_action(%s)', parsed_args)
|
self.log.debug('take_action(%s)', parsed_args)
|
||||||
volume_client = self.app.client_manager.volume
|
volume_client = self.app.client_manager.volume
|
||||||
qos_specs = utils.find_resource(volume_client.qos_specs,
|
qos_spec = utils.find_resource(volume_client.qos_specs,
|
||||||
parsed_args.qos_specs)
|
parsed_args.qos_spec)
|
||||||
|
|
||||||
if parsed_args.volume_type:
|
if parsed_args.volume_type:
|
||||||
volume_type = utils.find_resource(volume_client.volume_types,
|
volume_type = utils.find_resource(volume_client.volume_types,
|
||||||
parsed_args.volume_type)
|
parsed_args.volume_type)
|
||||||
volume_client.qos_specs.disassociate(qos_specs.id, volume_type.id)
|
volume_client.qos_specs.disassociate(qos_spec.id, volume_type.id)
|
||||||
elif parsed_args.all:
|
elif parsed_args.all:
|
||||||
volume_client.qos_specs.disassociate_all(qos_specs.id)
|
volume_client.qos_specs.disassociate_all(qos_spec.id)
|
||||||
|
|
||||||
return
|
return
|
||||||
|
|
||||||
@ -206,8 +205,8 @@ class SetQos(command.Command):
|
|||||||
def get_parser(self, prog_name):
|
def get_parser(self, prog_name):
|
||||||
parser = super(SetQos, self).get_parser(prog_name)
|
parser = super(SetQos, self).get_parser(prog_name)
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
'qos_specs',
|
'qos_spec',
|
||||||
metavar='<qos-specs>',
|
metavar='<qos-spec>',
|
||||||
help='QoS specification to modify (name or ID)',
|
help='QoS specification to modify (name or ID)',
|
||||||
)
|
)
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
@ -222,11 +221,11 @@ class SetQos(command.Command):
|
|||||||
def take_action(self, parsed_args):
|
def take_action(self, parsed_args):
|
||||||
self.log.debug('take_action(%s)', parsed_args)
|
self.log.debug('take_action(%s)', parsed_args)
|
||||||
volume_client = self.app.client_manager.volume
|
volume_client = self.app.client_manager.volume
|
||||||
qos_specs = utils.find_resource(volume_client.qos_specs,
|
qos_spec = utils.find_resource(volume_client.qos_specs,
|
||||||
parsed_args.qos_specs)
|
parsed_args.qos_spec)
|
||||||
|
|
||||||
if parsed_args.property:
|
if parsed_args.property:
|
||||||
volume_client.qos_specs.set_keys(qos_specs.id,
|
volume_client.qos_specs.set_keys(qos_spec.id,
|
||||||
parsed_args.property)
|
parsed_args.property)
|
||||||
else:
|
else:
|
||||||
self.app.log.error("No changes requested\n")
|
self.app.log.error("No changes requested\n")
|
||||||
@ -242,8 +241,8 @@ class ShowQos(show.ShowOne):
|
|||||||
def get_parser(self, prog_name):
|
def get_parser(self, prog_name):
|
||||||
parser = super(ShowQos, self).get_parser(prog_name)
|
parser = super(ShowQos, self).get_parser(prog_name)
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
'qos_specs',
|
'qos_spec',
|
||||||
metavar='<qos-specs>',
|
metavar='<qos-spec>',
|
||||||
help='QoS specification to display (name or ID)',
|
help='QoS specification to display (name or ID)',
|
||||||
)
|
)
|
||||||
return parser
|
return parser
|
||||||
@ -251,19 +250,19 @@ class ShowQos(show.ShowOne):
|
|||||||
def take_action(self, parsed_args):
|
def take_action(self, parsed_args):
|
||||||
self.log.debug('take_action(%s)', parsed_args)
|
self.log.debug('take_action(%s)', parsed_args)
|
||||||
volume_client = self.app.client_manager.volume
|
volume_client = self.app.client_manager.volume
|
||||||
qos_specs = utils.find_resource(volume_client.qos_specs,
|
qos_spec = utils.find_resource(volume_client.qos_specs,
|
||||||
parsed_args.qos_specs)
|
parsed_args.qos_spec)
|
||||||
|
|
||||||
qos_associations = volume_client.qos_specs.get_associations(qos_specs)
|
qos_associations = volume_client.qos_specs.get_associations(qos_spec)
|
||||||
if qos_associations:
|
if qos_associations:
|
||||||
associations = [association.name
|
associations = [association.name
|
||||||
for association in qos_associations]
|
for association in qos_associations]
|
||||||
qos_specs._info.update({
|
qos_spec._info.update({
|
||||||
'associations': utils.format_list(associations)
|
'associations': utils.format_list(associations)
|
||||||
})
|
})
|
||||||
qos_specs._info.update({'specs': utils.format_dict(qos_specs.specs)})
|
qos_spec._info.update({'specs': utils.format_dict(qos_spec.specs)})
|
||||||
|
|
||||||
return zip(*sorted(six.iteritems(qos_specs._info)))
|
return zip(*sorted(six.iteritems(qos_spec._info)))
|
||||||
|
|
||||||
|
|
||||||
class UnsetQos(command.Command):
|
class UnsetQos(command.Command):
|
||||||
@ -274,8 +273,8 @@ class UnsetQos(command.Command):
|
|||||||
def get_parser(self, prog_name):
|
def get_parser(self, prog_name):
|
||||||
parser = super(UnsetQos, self).get_parser(prog_name)
|
parser = super(UnsetQos, self).get_parser(prog_name)
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
'qos_specs',
|
'qos_spec',
|
||||||
metavar='<qos-specs>',
|
metavar='<qos-spec>',
|
||||||
help='QoS specification to modify (name or ID)',
|
help='QoS specification to modify (name or ID)',
|
||||||
)
|
)
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
@ -291,11 +290,11 @@ class UnsetQos(command.Command):
|
|||||||
def take_action(self, parsed_args):
|
def take_action(self, parsed_args):
|
||||||
self.log.debug('take_action(%s)', parsed_args)
|
self.log.debug('take_action(%s)', parsed_args)
|
||||||
volume_client = self.app.client_manager.volume
|
volume_client = self.app.client_manager.volume
|
||||||
qos_specs = utils.find_resource(volume_client.qos_specs,
|
qos_spec = utils.find_resource(volume_client.qos_specs,
|
||||||
parsed_args.qos_specs)
|
parsed_args.qos_spec)
|
||||||
|
|
||||||
if parsed_args.property:
|
if parsed_args.property:
|
||||||
volume_client.qos_specs.unset_keys(qos_specs.id,
|
volume_client.qos_specs.unset_keys(qos_spec.id,
|
||||||
parsed_args.property)
|
parsed_args.property)
|
||||||
else:
|
else:
|
||||||
self.app.log.error("No changes requested\n")
|
self.app.log.error("No changes requested\n")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user