@@ -176,6 +176,16 @@ def get_parser(self, prog_name):
176176 "(requires driver support)"
177177 ),
178178 )
179+ parser .add_argument (
180+ '--availability-zone' ,
181+ action = 'append' ,
182+ dest = 'availability_zones' ,
183+ help = _ (
184+ "Set an availability zone for this volume type "
185+ "(this is an alias for '--property RESKEY:availability_zones:<az>') " # noqa: E501
186+ "(repeat option to set multiple availabilty zones)"
187+ ),
188+ )
179189 parser .add_argument (
180190 '--project' ,
181191 metavar = '<project>' ,
@@ -274,6 +284,10 @@ def take_action(self, parsed_args):
274284 properties ['cacheable' ] = '<is> True'
275285 if parsed_args .replicated :
276286 properties ['replication_enabled' ] = '<is> True'
287+ if parsed_args .availability_zones :
288+ properties ['RESKEY:availability_zones' ] = ',' .join (
289+ parsed_args .availability_zones
290+ )
277291 if properties :
278292 result = volume_type .set_keys (properties )
279293 volume_type ._info .update (
@@ -435,6 +449,16 @@ def get_parser(self, prog_name):
435449 "(supported by --os-volume-api-version 3.52 or above)"
436450 ),
437451 )
452+ parser .add_argument (
453+ '--availability-zone' ,
454+ action = 'append' ,
455+ dest = 'availability_zones' ,
456+ help = _ (
457+ "List only volume types with this availability configured "
458+ "(this is an alias for '--property RESKEY:availability_zones:<az>') " # noqa: E501
459+ "(repeat option to filter on multiple availabilty zones)"
460+ ),
461+ )
438462 return parser
439463
440464 def take_action (self , parsed_args ):
@@ -472,6 +496,10 @@ def take_action(self, parsed_args):
472496 properties ['cacheable' ] = '<is> True'
473497 if parsed_args .replicated :
474498 properties ['replication_enabled' ] = '<is> True'
499+ if parsed_args .availability_zones :
500+ properties ['RESKEY:availability_zones' ] = ',' .join (
501+ parsed_args .availability_zones
502+ )
475503 if properties :
476504 if volume_client .api_version < api_versions .APIVersion ('3.52' ):
477505 msg = _ (
@@ -590,6 +618,16 @@ def get_parser(self, prog_name):
590618 "(requires driver support)"
591619 ),
592620 )
621+ parser .add_argument (
622+ '--availability-zone' ,
623+ action = 'append' ,
624+ dest = 'availability_zones' ,
625+ help = _ (
626+ "Set an availability zone for this volume type "
627+ "(this is an alias for '--property RESKEY:availability_zones:<az>') " # noqa: E501
628+ "(repeat option to set multiple availabilty zones)"
629+ ),
630+ )
593631 parser .add_argument (
594632 '--project' ,
595633 metavar = '<project>' ,
@@ -706,6 +744,10 @@ def take_action(self, parsed_args):
706744 properties ['cacheable' ] = '<is> True'
707745 if parsed_args .replicated :
708746 properties ['replication_enabled' ] = '<is> True'
747+ if parsed_args .availability_zones :
748+ properties ['RESKEY:availability_zones' ] = ',' .join (
749+ parsed_args .availability_zones
750+ )
709751 if properties :
710752 try :
711753 volume_type .set_keys (properties )
0 commit comments