Skip to content

Commit d8749f9

Browse files
author
Jens Rosenboom
committed
Fix creating a private flavor with ID auto
When a private flavor is created with ID auto (=default) and a project is specified for it, instead of trying to add the project to the flavor called "auto" the ID of the newly created project should be used. Change-Id: I19f7a0ec26bd5d147f00ecba3312240e3601567e Closes-Bug: 1654221
1 parent 82e6942 commit d8749f9

3 files changed

Lines changed: 9 additions & 4 deletions

File tree

openstackclient/compute/v2/flavor.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ def take_action(self, parsed_args):
167167
parsed_args.project_domain,
168168
).id
169169
compute_client.flavor_access.add_tenant_access(
170-
parsed_args.id, project_id)
170+
flavor.id, project_id)
171171
except Exception as e:
172172
msg = _("Failed to add project %(project)s access to "
173173
"flavor: %(e)s")

openstackclient/tests/unit/compute/v2/test_flavor.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ def test_flavor_create_other_options(self):
160160

161161
self.flavor.is_public = False
162162
arglist = [
163-
'--id', self.flavor.id,
163+
'--id', 'auto',
164164
'--ram', str(self.flavor.ram),
165165
'--disk', str(self.flavor.disk),
166166
'--ephemeral', str(self.flavor.ephemeral),
@@ -174,7 +174,6 @@ def test_flavor_create_other_options(self):
174174
self.flavor.name,
175175
]
176176
verifylist = [
177-
('id', self.flavor.id),
178177
('ram', self.flavor.ram),
179178
('disk', self.flavor.disk),
180179
('ephemeral', self.flavor.ephemeral),
@@ -193,7 +192,7 @@ def test_flavor_create_other_options(self):
193192
self.flavor.ram,
194193
self.flavor.vcpus,
195194
self.flavor.disk,
196-
self.flavor.id,
195+
'auto',
197196
self.flavor.ephemeral,
198197
self.flavor.swap,
199198
self.flavor.rxtx_factor,
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
fixes:
3+
- |
4+
Fix ``--project`` option for ``flavor create`` command when the
5+
ID for the new flavor is auto generated.
6+
[Bug `1654221 <https://bugs.launchpad.net/bugs/1654221>`_]

0 commit comments

Comments
 (0)