diff options
author | Zuul <zuul@review.opendev.org> | 2020-09-03 09:04:37 +0000 |
---|---|---|
committer | Gerrit Code Review <review@openstack.org> | 2020-09-03 09:04:37 +0000 |
commit | 08bddbd064b05bd4be9d7b42adb70ba2c8197bb0 (patch) | |
tree | 6b598c11467359a60e48d771c3cde503fa7197aa /nova/compute | |
parent | 779fd5ea3b0cf5be341b74a21dbb2512c0bcb920 (diff) | |
parent | 97267fc05c60b60761ebe8ec2773e8920148ae06 (diff) | |
download | nova-08bddbd064b05bd4be9d7b42adb70ba2c8197bb0.tar.gz |
Merge "Reject resize operation for accelerator"
Diffstat (limited to 'nova/compute')
-rw-r--r-- | nova/compute/api.py | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/nova/compute/api.py b/nova/compute/api.py index a9bbe196d9..1f62864750 100644 --- a/nova/compute/api.py +++ b/nova/compute/api.py @@ -3945,8 +3945,6 @@ class API(base.Base): # TODO(stephenfin): This logic would be so much easier to grok if we # finally split resize and cold migration into separate code paths - # TODO(stephenfin): The 'block_accelerators' decorator doesn't take into - # account the accelerators requested in the new flavor @block_accelerators() @check_instance_lock @check_instance_state(vm_state=[vm_states.ACTIVE, vm_states.STOPPED]) @@ -3982,6 +3980,12 @@ class API(base.Base): else: new_instance_type = flavors.get_flavor_by_flavor_id( flavor_id, read_deleted="no") + # NOTE(wenping): We use this instead of the 'block_accelerator' + # decorator since the operation can differ depending on args, + # and for resize we have two flavors to worry about, we should + # reject resize with new flavor with accelerator. + if new_instance_type.extra_specs.get('accel:device_profile'): + raise exception.ForbiddenWithAccelerators() # Check to see if we're resizing to a zero-disk flavor which is # only supported with volume-backed servers. if (new_instance_type.get('root_gb') == 0 and |