openstack server add volume -device can not assign an internal device name for volume

Bug #2045746 reported by Chuan Li
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Compute (nova)
Invalid
Undecided
Unassigned

Bug Description

Jammy+ Yoga nova 3:25.2.0-0ubuntu1

Even though I specified the name as vdd, the device-mapping is still vdb

$ openstack server add volume d261479e-b840-4f62-8542-332e18e63692 9dc530f2-845e-43dd-b67c-1dbe779baa39 --device /dev/vdd

$ openstack volume show 9dc530f2-845e-43dd-b67c-1dbe779baa39 -fvalue -c attachments

[{'id': '9dc530f2-845e-43dd-b67c-1dbe779baa39', 'attachment_id': '00613632-90bb-450d-a7fd-daa424972c4e', 'volume_id': '9dc530f2-845e-43dd-b67c-1dbe779baa39', 'server_id': 'd261479e-b840-4f62-8542-332e18e63692', 'host_name': 'juju-fd7226-q2-11.cloud.sts', 'device': '/dev/vdb', 'attached_at': '2023-12-06T06:45:40.000000'}]

$ virsh domblklist 1
 Target Source
-----------------------------------------------------------------------------
 vda /var/lib/nova/instances/d261479e-b840-4f62-8542-332e18e63692/disk
 vdb cinder-ceph/volume-9dc530f2-845e-43dd-b67c-1dbe779baa39

nova-compute.log

2023-12-06 06:45:36.991 348863 INFO nova.virt.libvirt.driver [req-37e0ba55-9246-486e-9483-dd2be3ba715d fa7cf5da63d04a1b89bac811f36f1b71 0a46d2dc99dd4cd584910e0dfa704ad5 - 3c6c3936f8674130a25155cc22f8b78d 3c6c3936f8674130a25155cc22f8b78d] [instance: d261479e-b840-4f62-8542-332e18e63692] Ignoring supplied device name: /dev/vdd

2023-12-06 06:45:37.322 348863 INFO nova.compute.manager [req-37e0ba55-9246-486e-9483-dd2be3ba715d fa7cf5da63d04a1b89bac811f36f1b71 0a46d2dc99dd4cd584910e0dfa704ad5 - 3c6c3936f8674130a25155cc22f8b78d 3c6c3936f8674130a25155cc22f8b78d] [instance: d261479e-b840-4f62-8542-332e18e63692] Attaching volume 9dc530f2-845e-43dd-b67c-1dbe779baa39 to /dev/vdb

In code [1] we can see that whatever name we specify is simply ignored, and the generated name is used.
Even the latest version of the code [2] is still the same.

It seems that the current code doesn't support specifying a device name when attaching a volume.
I'm not sure if it's true that all attached volumes can only be assigned an alphabetical device name inside the vm.
Is there any other way to assign a device name inside the vm?

[1] https://github.com/openstack/nova/blob/stable/yoga/nova/virt/libvirt/driver.py#L12001-L12015
[2] https://github.com/openstack/nova/blob/master/nova/virt/libvirt/driver.py#L12296-L12310

Chuan Li (lccn)
summary: - openstack server add volume -device can not assign a internal device
+ openstack server add volume -device can not assign an internal device
name for volume
Revision history for this message
Artom Lifshitz (notartom) wrote :

I'm afraid this is expected behaviour, and we call it out in our API reference [1]:

device (Optional)

body

string

Name of the device such as, /dev/vdb. Omit or set this parameter to null for auto-assignment, if supported. If you specify this parameter, the device must not exist in the guest operating system. Note that as of the 12.0.0 Liberty release, the Nova libvirt driver no longer honors a user-supplied device name. This is the same behavior as if the device name parameter is not supplied on the request.

I agree that it's not necessarily clear or obvious, and we should perhaps consider removing this API parameter altogether (though other hypervisors besides libvirt might still support it), but that's the current state of things.

[1] https://docs.openstack.org/api-ref/compute/#attach-a-volume-to-an-instance

Changed in nova:
status: New → Invalid
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.