request_specs not updated after failed rebuild

Bug #2040986 reported by Pierre Libeau
14
This bug affects 3 people
Affects Status Importance Assigned to Milestone
OpenStack Compute (nova)
In Progress
Undecided
Pierre Libeau

Bug Description

Description
===========
Request_specs is not updated during rebuild if we raise an exception during the scheduling of the instance. we can found update of image_ref but request_specs missing so next action on the instance failed and the instance is put in error state.

Steps to reproduce
==================
* create an instance with image "a"
* set an image "b" with specific properties like hypervisor_type='baremetal'
* rebuild instance with specific image "b" -> instance go in ERROR
* rebuild instance without specific image (instance rebuild with image "a")

$ openstack server create --image 82ef29e2-e49b-4021-96d8-00f161c1a987 --network 851acde6-6c03-43e5-b42b-4058599d0247 --flavor m1.small test-rebuild

$ openstack image set 14ff5912-d98c-43b1-a13a-0617c1de7a09 --property hypervisor_type='baremetal'

$ openstack server rebuild bd94ba1a-1bb6-40bf-905a-43cb49503cdc --image 14ff5912-d98c-43b1-a13a-0617c1de7a09

$ openstack server rebuild bd94ba1a-1bb6-40bf-905a-43cb49503cdc

Expected result
===============
request_specs table in nova_api and instances tables in nova_cell1 need to have same info about image in the DB. The actual bug break the action like live-migration on the instance.

Actual result
=============
request_specs table in nova_api and instances tables in nova_cell1 are unsync

stack@devstack1 ~/devstack % openstack server show bd94ba1a-1bb6-40bf-905a-43cb49503cdc -c image
+-------+--------------------------------------------------+
| Field | Value |
+-------+--------------------------------------------------+
| image | Debian 12 (82ef29e2-e49b-4021-96d8-00f161c1a987) |
+-------+--------------------------------------------------+

MySQL root@127.0.0.1:nova_api> select * from request_specs \G
***************************[ 1. row ]***************************
created_at | 2023-09-26 14:39:48
updated_at | 2023-09-26 15:30:20
id | 1
instance_uuid | bd94ba1a-1bb6-40bf-905a-43cb49503cdc
spec | {"nova_object.name": "RequestSpec", "nova_object.namespace": "nova", "nova_object.version": "1.14", "nova_object.data": {"id": 1, "image": {"nova_object.name": "ImageMeta", "nova_object.namespace": "nova", "nova_object.version": "1.8", "nova_object.data": {"id": "14ff5912-d98c-43b1-a13a-0617c1de7a09", "name": "cirros-0.6.2-x86_64-disk", "status": "active", "checksum": "c8fc807773e5354afe61636071771906", "owner": "ba0a4db0b823489f9c85c9c8e5379dea", "size": 21430272, "container_format": "bare", "disk_format": "qcow2", "created_at": "2023-09-26T13:18:36Z", "updated_at": "2023-09-26T15:28:00Z", "min_ram": 0, "min_disk": 0, "properties": {"nova_object.name": "ImageMetaProps", "nova_object.namespace": "nova", "nova_object.version": "1.34", "nova_object.data": {"hw_rng_model": "virtio", "img_hv_type": "baremetal"}, "nova_object.changes": ["hw_rng_model", "img_hv_type"]}}, "nova_object.changes": ["disk_format", "min_ram", "id", "container_format", "updated_at", "status", "name", "min_disk", "properties", "created_at", "checksum", "owner", "size"]}, "numa_topology": null, "pci_requests": {"nova_object.name": "InstancePCIRequests", "nova_object.namespace": "nova", "nova_object.version": "1.1", "nova_object.data": {"requests": []}, "nova_object.changes": ["requests"]}, "project_id": "26386575ede0452d8c19ac63f3633966", "user_id": "cf2eef961513436fbf256b5ec03863ed", "availability_zone": null, "flavor": {"nova_object.name": "Flavor", "nova_object.namespace": "nova", "nova_object.version": "1.2", "nova_object.data": {"id": 7, "name": "m1.small", "memory_mb": 2048, "vcpus": 1, "root_gb": 20, "ephemeral_gb": 0, "flavorid": "2", "swap": 0, "rxtx_factor": 1.0, "vcpu_weight": 0, "disabled": false, "is_public": true, "extra_specs": {"hw_rng:allowed": "True"}, "description": null, "created_at": "2023-09-26T13:18:30Z", "updated_at": null, "deleted_at": null, "deleted": false}, "nova_object.changes": ["extra_specs"]}, "num_instances": 1, "ignore_hosts": null, "force_hosts": null, "force_nodes": null, "retry": null, "limits": {"nova_object.name": "SchedulerLimits", "nova_object.namespace": "nova", "nova_object.version": "1.0", "nova_object.data": {"numa_topology": null, "vcpu": null, "disk_gb": null, "memory_mb": null}, "nova_object.changes": ["memory_mb", "disk_gb", "vcpu", "numa_topology"]}, "instance_group": null, "scheduler_hints": {}, "instance_uuid": "bd94ba1a-1bb6-40bf-905a-43cb49503cdc", "security_groups": {"nova_object.name": "SecurityGroupList", "nova_object.namespace": "nova", "nova_object.version": "1.1", "nova_object.data": {"objects": [{"nova_object.name": "SecurityGroup", "nova_object.namespace": "nova", "nova_object.version": "1.2", "nova_object.data": {"name": "default"}, "nova_object.changes": ["name"]}]}, "nova_object.changes": ["objects"]}, "is_bfv": false}, "nova_object.changes": ["limits", "flavor", "image", "security_groups", "pci_requests"]}

Environment
===========
on devstack and master branch

Changed in nova:
assignee: nobody → Pierre Libeau (pierre-libeau)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to nova (master)

Fix proposed to branch: master
Review: https://review.opendev.org/c/openstack/nova/+/899379

Changed in nova:
status: New → In Progress
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.