Comment 3 for bug 2023211

Revision history for this message
Felipe Reyes (freyes) wrote :

The issue here seems to be that the nova.objects.fields.Architecture class[0] doesn't have registered RISCV64, so the list defined in os-traits[1] doesn't seem to be enough to have support for an emulated architecture.

Here I'm attaching a diff that can be used as a starting point.

Reproducer:

```
test -f ubuntu-22.04-server-cloudimg-riscv64.img && wget http://cloud-images.ubuntu.com/server/releases/jammy/release-20220420/ubuntu-22.04-server-cloudimg-riscv64.img
openstack image create \
    --disk-format qcow2 \
    --file ./ubuntu-22.04-server-cloudimg-riscv64.img \
    --public \
    --property architecture=riscv64 \
    --property item_name=disk1.img \
    --property os_distro=ubuntu \
    --property os_version=22.04 \
    riscv64-test
openstack image set --property hw_emulation_architecture=riscv64 riscv64-test
openstack image set --property hw_machine_type=virt riscv64-test
openstack server create \
    --image riscv64-test \
    --network freyes_admin_net \
    --flavor m1.medium \
    --key-name freyes \
    my-riscv64-test
```

Output:

```
Invalid image metadata. Error: Architecture name 'riscv64' is not valid (HTTP 400) (Request-ID: req-7a2d48d1-4457-40fc-b26a-7906ce929532)
```

In the logs:

```
2023-06-24 03:32:43.912 2238785 INFO nova.api.openstack.wsgi [req-7a2d48d1-4457-40fc-b26a-7906ce929532 a3ee17ed103a4cbbabdb215d9dca0482 - - 1bf127c9b631435984600ac72fa5374f 1bf127c9b631435984600ac72fa5374f] HTTP exception thrown: Invalid image metadata. Error: Architecture name 'riscv64' is not valid
2023-06-24 03:32:43.913 2238785 DEBUG nova.api.openstack.wsgi [req-7a2d48d1-4457-40fc-b26a-7906ce929532 a3ee17ed103a4cbbabdb215d9dca0482 - - 1bf127c9b631435984600ac72fa5374f 1bf127c9b631435984600ac72fa5374f] Returning 400 to user: Invalid image metadata. Error: Architecture name 'riscv64' is not valid __call__ /usr/lib/python3/dist-packages/nova/api/openstack/wsgi.py:936
```

[0] https://opendev.org/openstack/nova/src/branch/master/nova/objects/fields.py#L120
[1] https://opendev.org/openstack/os-traits/src/branch/master/os_traits/compute/arch.py