Wrong instance xml for a volume booted instances when created using REST API

Bug #2065599 reported by Abhijeet Patra
12
This bug affects 2 people
Affects Status Importance Assigned to Milestone
OpenStack Compute (nova)
New
Undecided
Unassigned

Bug Description

Description
===========
The instance XML shows that the instance is nova booted while it is volume booted when created using the below-mentioned steps.

Steps to reproduce
==================
- I used the below curl command to create a volume booted instance which worked fine and the instance got created:

```
(overcloudtraindev2) [stack@undercloud16dev2 ~]$ curl -g -i -X POST https://overcloudtraindev2.trilio.local:13774/v2.1/servers \
> -H "Accept: application/json" \
> -H "Content-Type: application/json" \
> -H "OpenStack-API-Version: compute 2.79" \
> -H "User-Agent: python-novaclient" \
> -H "X-Auth-Token: gAAAAABmQhTkc8YppuCkQZ0A7Vf75FYCwuoM3QVNH46pMDf8QqkZ9YaBmYmCdRNU4_QNVBoLRSV4RFm425qwVk4x--sQwlbjwLaiiSzLmd4spYmnI9MmLqifTt3YDVp_2XjiR0xdnkF8zmdkzfxwX_9Nc2lN77dfqiXXa1zbiiNiZzyr_kx5Fs4" \
> -H "X-OpenStack-Nova-API-Version: 2.79" \
> -d '
> {
> "server": {
> "name": "temp_vol_booted_curl",
> "imageRef": "f2285517-a996-40d3-b331-c8214ec66b77",
> "flavorRef": "a483e589-f191-42be-9890-2d7a5e97ba78",
> "min_count": 1,
> "max_count": 1,
> "block_device_mapping_v2": [
> {
> "uuid": "f2285517-a996-40d3-b331-c8214ec66b77",
> "boot_index": "0",
> "source_type": "image",
> "destination_type": "volume",
> "volume_size": 10
> }
> ],
> "networks": [
> {
> "uuid": "6021f51f-568a-4f8e-b5a9-cfdf92c495eb"
> }
> ]
> }
> }'
HTTP/1.1 202 Accepted
Date: Mon, 13 May 2024 13:54:24 GMT
Server: Apache
Content-Length: 418
location: https://overcloudtraindev2.trilio.local:13774/v2.1/servers/8cae4622-042a-4db3-a508-6b93d8deb4b7
OpenStack-API-Version: compute 2.79
X-OpenStack-Nova-API-Version: 2.79
Vary: OpenStack-API-Version,X-OpenStack-Nova-API-Version
x-openstack-request-id: req-17facfdb-d0c7-4304-86a3-80af01b81c42
x-compute-request-id: req-17facfdb-d0c7-4304-86a3-80af01b81c42
Content-Type: application/json

{"server": {"id": "8cae4622-042a-4db3-a508-6b93d8deb4b7", "links": [{"rel": "self", "href": "https://overcloudtraindev2.trilio.local:13774/v2.1/servers/8cae4622-042a-4db3-a508-6b93d8deb4b7"}, {"rel": "bookmark", "href": "https://overcloudtraindev2.trilio.local:13774/servers/8cae4622-042a-4db3-a508-6b93d8deb4b7"}], "OS-DCF:diskConfig": "MANUAL", "security_groups": [{"name": "default"}], "adminPass": "zXBbyJanp2FH"}}(overcloudtraindev2) [stack@undercloud16dev2 ~]$
(overcloudtraindev2) [stack@undercloud16dev2 ~]$
(overcloudtraindev2) [stack@undercloud16dev2 ~]$ openstack server show 8cae4622-042a-4db3-a508-6b93d8deb4b7
+-------------------------------------+----------------------------------------------------------------------------------+
| Field | Value |
+-------------------------------------+----------------------------------------------------------------------------------+
| OS-DCF:diskConfig | MANUAL |
| OS-EXT-AZ:availability_zone | nova |
| OS-EXT-SRV-ATTR:host | overcloudtraindev2-novacompute-0.trilio.local |
| OS-EXT-SRV-ATTR:hostname | temp-vol-booted-curl |
| OS-EXT-SRV-ATTR:hypervisor_hostname | overcloudtraindev2-novacompute-0.trilio.local |
| OS-EXT-SRV-ATTR:instance_name | instance-000001a7 |
| OS-EXT-SRV-ATTR:kernel_id | |
| OS-EXT-SRV-ATTR:launch_index | 0 |
| OS-EXT-SRV-ATTR:ramdisk_id | |
| OS-EXT-SRV-ATTR:reservation_id | r-jrlmxqsw |
| OS-EXT-SRV-ATTR:root_device_name | /dev/vda |
| OS-EXT-SRV-ATTR:user_data | None |
| OS-EXT-STS:power_state | Running |
| OS-EXT-STS:task_state | None |
| OS-EXT-STS:vm_state | active |
| OS-SRV-USG:launched_at | 2024-05-13T13:54:39.000000 |
| OS-SRV-USG:terminated_at | None |
| accessIPv4 | |
| accessIPv6 | |
| addresses | internal=10.10.10.130 |
| config_drive | |
| created | 2024-05-13T13:54:25Z |
| description | None |
| flavor | disk='1', ephemeral='0', , original_name='cirros', ram='64', swap='0', vcpus='1' |
| hostId | 366f2ccb62c960efb28dc6035bb77b5719dbb1ed35e75fafb34da83a |
| host_status | UP |
| id | 8cae4622-042a-4db3-a508-6b93d8deb4b7 |
| image | cirros (f2285517-a996-40d3-b331-c8214ec66b77) |
| key_name | None |
| locked | False |
| locked_reason | None |
| name | temp_vol_booted_curl |
| progress | 0 |
| project_id | 3df2e8acc97846a591048a5b54cade51 |
| properties | |
| security_groups | name='default' |
| server_groups | [] |
| status | ACTIVE |
| tags | [] |
| trusted_image_certificates | None |
| updated | 2024-05-13T13:54:39Z |
| user_id | 27be5b757cea44fda73b7381e5144425 |
| volumes_attached | delete_on_termination='False', id='6340c7e6-08db-4554-b871-95339ddb1acc' |
+-------------------------------------+----------------------------------------------------------------------------------+
(overcloudtraindev2) [stack@undercloud16dev2 ~]$
```

Expected result
===============
The metadata from the instance XML should not have
```
<nova:root type="image" uuid="f2285517-a996-40d3-b331-c8214ec66b77"/>
```

Actual result
=============
The metadata from the instance XML says the instance is image booted

```
<metadata>
    <nova:instance xmlns:nova="http://openstack.org/xmlns/libvirt/nova/1.0">
      <nova:package version="20.6.2-2.20230814165223.el8ost"/>
      <nova:name>temp_vol_booted_curl</nova:name>
      <nova:creationTime>2024-05-13 13:54:35</nova:creationTime>
      <nova:flavor name="cirros">
        <nova:memory>64</nova:memory>
        <nova:disk>1</nova:disk>
        <nova:swap>0</nova:swap>
        <nova:ephemeral>0</nova:ephemeral>
        <nova:vcpus>1</nova:vcpus>
      </nova:flavor>
      <nova:owner>
        <nova:user uuid="27be5b757cea44fda73b7381e5144425">admin</nova:user>
        <nova:project uuid="3df2e8acc97846a591048a5b54cade51">admin</nova:project>
      </nova:owner>
      <nova:root type="image" uuid="f2285517-a996-40d3-b331-c8214ec66b77"/>
    </nova:instance>
  </metadata>

```

Environment
===========
1. Openstack : Train
```
[root@overcloudtraindev2-novacompute-0 /]# rpm -qa | grep nova
python3-novaclient-15.1.1-2.20220111010504.79959ab.el8ost.noarch
openstack-nova-migration-20.6.2-2.20230814165223.el8ost.noarch
openstack-nova-common-20.6.2-2.20230814165223.el8ost.noarch
openstack-nova-compute-20.6.2-2.20230814165223.el8ost.noarch
python3-nova-20.6.2-2.20230814165223.el8ost.noarch
[root@overcloudtraindev2-novacompute-0 /]#
```

2. Which hypervisor did you use?
   libvirt-daemon-kvm-7.0.0-14.8.module+el8.4.0+15255+f7eff4dd.x86_64

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.