nova api returns 500 when resizing an instance with memory encryption enabled
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
OpenStack Compute (nova) |
New
|
Undecided
|
Unassigned |
Bug Description
Description
===========
When a user attempts to resize an instance with memory encryption enabled, API returns 500 error consistently.
Looking into nova-api.log, it seems the issue is caused by a mechanism similar to https:/
Steps to reproduce
==================
* Create an image with hw_mem_
$ openstack image create encrypted ...
$ openstack image set encrypted --property hw_mem_
* Create an instance
$ openstack server create testinstance --image encrypted --flavor flavor1 ...
* Resize the instance
$ openstack server resize testinstance --flavor flavor2
Expected result
===============
Instance resize is accepted and processed by nova, without errors
Actual result
=============
Nova api returns 500 error and does not accept the request
Environment
===========
1. Exact version of OpenStack you are running. See the following
list for all releases: http://
Ubuntu 22.04 and UCA bobcat.
# dpkg -l | grep nova
ii nova-api 3:28.0.
ii nova-common 3:28.0.
ii nova-compute 3:28.0.
ii nova-compute-kvm 3:28.0.
ii nova-compute-
ii nova-conductor 3:28.0.
ii nova-novncproxy 3:28.0.
ii nova-scheduler 3:28.0.
ii python3-nova 3:28.0.
ii python3-novaclient 2:18.4.
2. Which hypervisor did you use?
Libvirt + KVM
3. Which storage type did you use?
LVM
4. Which networking type did you use?
ml2 + ovs
Logs & Configs
==============
The following traceback is found in nova-api.log
```
2023-12-26 08:02:19.371 30791 ERROR nova.api.
2023-12-26 08:02:19.371 30791 ERROR nova.api.
2023-12-26 08:02:19.371 30791 ERROR nova.api.
2023-12-26 08:02:19.371 30791 ERROR nova.api.
2023-12-26 08:02:19.371 30791 ERROR nova.api.
2023-12-26 08:02:19.371 30791 ERROR nova.api.
2023-12-26 08:02:19.371 30791 ERROR nova.api.
2023-12-26 08:02:19.371 30791 ERROR nova.api.
2023-12-26 08:02:19.371 30791 ERROR nova.api.
2023-12-26 08:02:19.371 30791 ERROR nova.api.
2023-12-26 08:02:19.371 30791 ERROR nova.api.
2023-12-26 08:02:19.371 30791 ERROR nova.api.
2023-12-26 08:02:19.371 30791 ERROR nova.api.
2023-12-26 08:02:19.371 30791 ERROR nova.api.
2023-12-26 08:02:19.371 30791 ERROR nova.api.
2023-12-26 08:02:19.371 30791 ERROR nova.api.
2023-12-26 08:02:19.371 30791 ERROR nova.api.
2023-12-26 08:02:19.371 30791 ERROR nova.api.
2023-12-26 08:02:19.371 30791 ERROR nova.api.
2023-12-26 08:02:19.371 30791 ERROR nova.api.
2023-12-26 08:02:19.371 30791 ERROR nova.api.
2023-12-26 08:02:19.371 30791 ERROR nova.api.
2023-12-26 08:02:19.371 30791 ERROR nova.api.
2023-12-26 08:02:19.371 30791 ERROR nova.api.
2023-12-26 08:02:19.371 30791 ERROR nova.api.
2023-12-26 08:02:19.371 30791 ERROR nova.api.
2023-12-26 08:02:19.371 30791 ERROR nova.api.
2023-12-26 08:02:19.371 30791 ERROR nova.api.
2023-12-26 08:02:19.371 30791 ERROR nova.api.
2023-12-26 08:02:19.371 30791 ERROR nova.api.
2023-12-26 08:02:19.371 30791 ERROR nova.api.
2023-12-26 08:02:19.371 30791 ERROR nova.api.
2023-12-26 08:02:19.371 30791 ERROR nova.api.
2023-12-26 08:02:19.371 30791 ERROR nova.api.
2023-12-26 08:02:19.371 30791 ERROR nova.api.
2023-12-26 08:02:19.371 30791 ERROR nova.api.
```
In nova/compute/api.py resize() function, `image = utils.get_ image_from_ system_ metadata( instance. system_ metadata) ` will lead to `image` has no `id` key.
Therefore, when calling `self._ validate_ flavor_ image_nostatus( )→API._ validate_ flavor_ image_numa_ pci()→hardware. get_mem_ encryption_ constraint( )`, using `image_meta.id` will will cause an error.
See https:/ /bugs.launchpad .net/nova/ +bug/2041511, the similar issue.