Merge "compute: Fix flavor create --id auto"

This commit is contained in:
Zuul
2025-08-18 16:59:33 +00:00
committed by Gerrit Code Review
3 changed files with 21 additions and 2 deletions

View File

@@ -156,12 +156,25 @@ class CreateFlavor(command.ShowOne):
msg = _("--project is only allowed with --private")
raise exceptions.CommandError(msg)
flavor_id = parsed_args.id
if parsed_args.id == 'auto':
# novaclient aliased 'auto' to mean "generate a UUID for me": we
# do the same to avoid breaking existing users
flavor_id = None
msg = _(
"Passing '--id auto' is deprecated. Nova will automatically "
"assign a UUID-like ID if no ID is provided. Omit the '--id' "
"parameter instead."
)
self.log.warning(msg)
args = {
'name': parsed_args.name,
'ram': parsed_args.ram,
'vcpus': parsed_args.vcpus,
'disk': parsed_args.disk,
'id': parsed_args.id,
'id': flavor_id,
'ephemeral': parsed_args.ephemeral,
'swap': parsed_args.swap,
'rxtx_factor': parsed_args.rxtx_factor,

View File

@@ -247,7 +247,7 @@ class TestFlavorCreate(TestFlavor):
'ram': self.flavor.ram,
'vcpus': self.flavor.vcpus,
'disk': self.flavor.disk,
'id': 'auto',
'id': None,
'ephemeral': self.flavor.ephemeral,
'swap': self.flavor.swap,
'rxtx_factor': self.flavor.rxtx_factor,

View File

@@ -0,0 +1,6 @@
---
deprecations:
- |
The ``--id auto`` alias for the ``flavor create`` command is deprecated
for removal. Omit the option entirely to ensure the server creates the
ID for you.