Merge "volume: Add alias for volume type AZs"
This commit is contained in:
commit
5883bcecd4
@ -130,6 +130,8 @@ class TestTypeCreate(TestType):
|
|||||||
'--multiattach',
|
'--multiattach',
|
||||||
'--cacheable',
|
'--cacheable',
|
||||||
'--replicated',
|
'--replicated',
|
||||||
|
'--availability-zone',
|
||||||
|
'az1',
|
||||||
self.new_volume_type.name,
|
self.new_volume_type.name,
|
||||||
]
|
]
|
||||||
verifylist = [
|
verifylist = [
|
||||||
@ -137,6 +139,7 @@ class TestTypeCreate(TestType):
|
|||||||
('multiattach', True),
|
('multiattach', True),
|
||||||
('cacheable', True),
|
('cacheable', True),
|
||||||
('replicated', True),
|
('replicated', True),
|
||||||
|
('availability_zones', ['az1']),
|
||||||
('name', self.new_volume_type.name),
|
('name', self.new_volume_type.name),
|
||||||
]
|
]
|
||||||
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
||||||
@ -151,6 +154,7 @@ class TestTypeCreate(TestType):
|
|||||||
'multiattach': '<is> True',
|
'multiattach': '<is> True',
|
||||||
'cacheable': '<is> True',
|
'cacheable': '<is> True',
|
||||||
'replication_enabled': '<is> True',
|
'replication_enabled': '<is> True',
|
||||||
|
'RESKEY:availability_zones': 'az1',
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -440,6 +444,8 @@ class TestTypeList(TestType):
|
|||||||
"--multiattach",
|
"--multiattach",
|
||||||
"--cacheable",
|
"--cacheable",
|
||||||
"--replicated",
|
"--replicated",
|
||||||
|
"--availability-zone",
|
||||||
|
"az1",
|
||||||
]
|
]
|
||||||
verifylist = [
|
verifylist = [
|
||||||
("encryption_type", False),
|
("encryption_type", False),
|
||||||
@ -450,6 +456,7 @@ class TestTypeList(TestType):
|
|||||||
("multiattach", True),
|
("multiattach", True),
|
||||||
("cacheable", True),
|
("cacheable", True),
|
||||||
("replicated", True),
|
("replicated", True),
|
||||||
|
("availability_zones", ["az1"]),
|
||||||
]
|
]
|
||||||
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
||||||
|
|
||||||
@ -461,6 +468,7 @@ class TestTypeList(TestType):
|
|||||||
"multiattach": "<is> True",
|
"multiattach": "<is> True",
|
||||||
"cacheable": "<is> True",
|
"cacheable": "<is> True",
|
||||||
"replication_enabled": "<is> True",
|
"replication_enabled": "<is> True",
|
||||||
|
"RESKEY:availability_zones": "az1",
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
is_public=None,
|
is_public=None,
|
||||||
@ -605,6 +613,8 @@ class TestTypeSet(TestType):
|
|||||||
'--multiattach',
|
'--multiattach',
|
||||||
'--cacheable',
|
'--cacheable',
|
||||||
'--replicated',
|
'--replicated',
|
||||||
|
'--availability-zone',
|
||||||
|
'az1',
|
||||||
self.volume_type.id,
|
self.volume_type.id,
|
||||||
]
|
]
|
||||||
verifylist = [
|
verifylist = [
|
||||||
@ -614,6 +624,7 @@ class TestTypeSet(TestType):
|
|||||||
('multiattach', True),
|
('multiattach', True),
|
||||||
('cacheable', True),
|
('cacheable', True),
|
||||||
('replicated', True),
|
('replicated', True),
|
||||||
|
('availability_zones', ['az1']),
|
||||||
('volume_type', self.volume_type.id),
|
('volume_type', self.volume_type.id),
|
||||||
]
|
]
|
||||||
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
||||||
@ -627,6 +638,7 @@ class TestTypeSet(TestType):
|
|||||||
'multiattach': '<is> True',
|
'multiattach': '<is> True',
|
||||||
'cacheable': '<is> True',
|
'cacheable': '<is> True',
|
||||||
'replication_enabled': '<is> True',
|
'replication_enabled': '<is> True',
|
||||||
|
'RESKEY:availability_zones': 'az1',
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
self.volume_type_access_mock.add_project_access.assert_not_called()
|
self.volume_type_access_mock.add_project_access.assert_not_called()
|
||||||
|
@ -176,6 +176,16 @@ class CreateVolumeType(command.ShowOne):
|
|||||||
"(requires driver support)"
|
"(requires driver support)"
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
|
parser.add_argument(
|
||||||
|
'--availability-zone',
|
||||||
|
action='append',
|
||||||
|
dest='availability_zones',
|
||||||
|
help=_(
|
||||||
|
"Set an availability zone for this volume type "
|
||||||
|
"(this is an alias for '--property RESKEY:availability_zones:<az>') " # noqa: E501
|
||||||
|
"(repeat option to set multiple availabilty zones)"
|
||||||
|
),
|
||||||
|
)
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
'--project',
|
'--project',
|
||||||
metavar='<project>',
|
metavar='<project>',
|
||||||
@ -274,6 +284,10 @@ class CreateVolumeType(command.ShowOne):
|
|||||||
properties['cacheable'] = '<is> True'
|
properties['cacheable'] = '<is> True'
|
||||||
if parsed_args.replicated:
|
if parsed_args.replicated:
|
||||||
properties['replication_enabled'] = '<is> True'
|
properties['replication_enabled'] = '<is> True'
|
||||||
|
if parsed_args.availability_zones:
|
||||||
|
properties['RESKEY:availability_zones'] = ','.join(
|
||||||
|
parsed_args.availability_zones
|
||||||
|
)
|
||||||
if properties:
|
if properties:
|
||||||
result = volume_type.set_keys(properties)
|
result = volume_type.set_keys(properties)
|
||||||
volume_type._info.update(
|
volume_type._info.update(
|
||||||
@ -435,6 +449,16 @@ class ListVolumeType(command.Lister):
|
|||||||
"(supported by --os-volume-api-version 3.52 or above)"
|
"(supported by --os-volume-api-version 3.52 or above)"
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
|
parser.add_argument(
|
||||||
|
'--availability-zone',
|
||||||
|
action='append',
|
||||||
|
dest='availability_zones',
|
||||||
|
help=_(
|
||||||
|
"List only volume types with this availability configured "
|
||||||
|
"(this is an alias for '--property RESKEY:availability_zones:<az>') " # noqa: E501
|
||||||
|
"(repeat option to filter on multiple availabilty zones)"
|
||||||
|
),
|
||||||
|
)
|
||||||
return parser
|
return parser
|
||||||
|
|
||||||
def take_action(self, parsed_args):
|
def take_action(self, parsed_args):
|
||||||
@ -472,6 +496,10 @@ class ListVolumeType(command.Lister):
|
|||||||
properties['cacheable'] = '<is> True'
|
properties['cacheable'] = '<is> True'
|
||||||
if parsed_args.replicated:
|
if parsed_args.replicated:
|
||||||
properties['replication_enabled'] = '<is> True'
|
properties['replication_enabled'] = '<is> True'
|
||||||
|
if parsed_args.availability_zones:
|
||||||
|
properties['RESKEY:availability_zones'] = ','.join(
|
||||||
|
parsed_args.availability_zones
|
||||||
|
)
|
||||||
if properties:
|
if properties:
|
||||||
if volume_client.api_version < api_versions.APIVersion('3.52'):
|
if volume_client.api_version < api_versions.APIVersion('3.52'):
|
||||||
msg = _(
|
msg = _(
|
||||||
@ -590,6 +618,16 @@ class SetVolumeType(command.Command):
|
|||||||
"(requires driver support)"
|
"(requires driver support)"
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
|
parser.add_argument(
|
||||||
|
'--availability-zone',
|
||||||
|
action='append',
|
||||||
|
dest='availability_zones',
|
||||||
|
help=_(
|
||||||
|
"Set an availability zone for this volume type "
|
||||||
|
"(this is an alias for '--property RESKEY:availability_zones:<az>') " # noqa: E501
|
||||||
|
"(repeat option to set multiple availabilty zones)"
|
||||||
|
),
|
||||||
|
)
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
'--project',
|
'--project',
|
||||||
metavar='<project>',
|
metavar='<project>',
|
||||||
@ -706,6 +744,10 @@ class SetVolumeType(command.Command):
|
|||||||
properties['cacheable'] = '<is> True'
|
properties['cacheable'] = '<is> True'
|
||||||
if parsed_args.replicated:
|
if parsed_args.replicated:
|
||||||
properties['replication_enabled'] = '<is> True'
|
properties['replication_enabled'] = '<is> True'
|
||||||
|
if parsed_args.availability_zones:
|
||||||
|
properties['RESKEY:availability_zones'] = ','.join(
|
||||||
|
parsed_args.availability_zones
|
||||||
|
)
|
||||||
if properties:
|
if properties:
|
||||||
try:
|
try:
|
||||||
volume_type.set_keys(properties)
|
volume_type.set_keys(properties)
|
||||||
|
@ -2,6 +2,6 @@
|
|||||||
features:
|
features:
|
||||||
- |
|
- |
|
||||||
The ``volume type create``, ``volume type set``, ``volume type list``
|
The ``volume type create``, ``volume type set``, ``volume type list``
|
||||||
commands now accept three new options - ``--multiattach``, ``--cacheable``,
|
commands now accept four new options - ``--multiattach``, ``--cacheable``,
|
||||||
and ``--replicated`` - which are short cuts for setting or filtering on
|
``--replicated``, and ``--availability-zone`` - which are short cuts for
|
||||||
the relevant properties on the volume type.
|
setting or filtering on the relevant properties on the volume type.
|
||||||
|
Loading…
Reference in New Issue
Block a user