How can I determine the boot volume for a server

asked 2019-03-12 13:50:31 -0500

spbarbieri gravatar image

When creating a server I can specify an image or a block_device_mapping. Once the server is active is there any way to determine which was used? When using an image the Server API returns the image ID. When using block_device_mapping, no image ID is returned. From this can I infer that a block_device_mapping was used to set the boot volume? If so, how can I determine which volume was used as the boot volume? The Server API returns attached volumes, but I'm not sure how to determine which attached volume is the boot volume. I could have several attached volumes and some could be marked bootable. Is there a way to query the attached volumes to determine which one is the actual boot volume?

Thanks, Steve

edit retag flag offensive close merge delete


As admin, you can see OS-EXT-SRV-ATTR:root_device_name, for example /dev/vda. I don’t know whether server details contain the device name of each attached volume, but the volume details do include it.

So, it’s a bit involved: Obtain the root device, then check each attached volume’s details.

Bernd Bausch gravatar imageBernd Bausch ( 2019-03-12 18:48:15 -0500 )edit

Alternatively, perhaps you find the volumes’ boot orders either in the server details or the volume details. They would at least be a very strong indication from where the instance was booted.

Bernd Bausch gravatar imageBernd Bausch ( 2019-03-12 18:49:52 -0500 )edit

Thanks for the pointers. I don't see the OS-EXT-SRV-ATTR:root_device_name property so I don't have a way to map it to the device names of the attached volumes. The boot index sounds promising, but I don't know how to get it. It's not returned on the volume details API.

spbarbieri gravatar imagespbarbieri ( 2019-03-13 16:52:02 -0500 )edit

You need to be admin to see the root device. I can’t test it right now; perhaps the openstack client doesn’t display the field.

Displaying the boot device is obviously not considered a priority. For better results, you may want to raise your case on the openstack distribution list.

Bernd Bausch gravatar imageBernd Bausch ( 2019-03-13 19:50:48 -0500 )edit