Volume attachment may fail after rescuing instance on an image with different hw_disk_bus
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
OpenStack Compute (nova) |
Fix Released
|
Undecided
|
Alexandre arents | ||
Queens |
Fix Released
|
Undecided
|
Alexandre arents | ||
Rocky |
Fix Committed
|
Undecided
|
Alexandre arents | ||
Stein |
Fix Committed
|
Undecided
|
Alexandre arents | ||
Train |
Fix Released
|
Undecided
|
Alexandre arents |
Bug Description
Description
===========
Look likes rescue may update instances.
This introduce a mimatch between device name and driver used for instance:
During instance config generation, nova guess the disk bus driver according table instance_
and get root device name from table instances.
Because of this mismatch, cinder attachment may failed with the following error message in compute log:
unable to execute QEMU command 'device_add': Duplicate ID 'virtio-disk0' for device
Probable solution is to avoid rescue action to update instance.
Steps to reproduce
==================
On a fresh master devstack:
openstack image save cirros-
#create a new image, but an scsi one:
openstack image create --container-format bare --disk-format qcow2 --file /tmp/cirros-
#create instance with default virtio driver:
openstack server create --flavor m1.small --image cirros-
mysql> select root_device_name from instances where uuid='xxx'
/dev/vda
#rescue instance but with the scsi image:
$openstack server rescue xxxx --image cirros-
mysql> select root_device_name from instances where uuid='xxx'
/dev/sda
$openstack server unrescue xxxx
# root_device_name is still on sda should be on vda according instance metadata
mysql> select root_device_name from instances where uuid='xxx'
/dev/sda
$virsh dumpxml instance-00000001 | grep "bus='virtio"
<target dev='vda' bus='virtio'/>
<alias name='virtio-
# at the next hard reboot new xml is generated with scsi device name BUT with virtio driver.
$openstack server reboot --hard xxx
$virsh dumpxml instance-00000001 | grep -A 1 "bus='virtio"
<target dev='sda' bus='virtio'/>
<alias name='virtio-
$openstack volume create --size 10 test
$openstack server add volume 1c9b1582-
$sudo journalctl -u <email address hidden> | grep Duplicate
Jul 05 09:29:54 alex-devstack-
Error probably comes from the fact that nova lookup for next availiable virtio device based on name, which is vda - virtio-disk0 (as root device is currently sda)
but because root device sda is already using virtio-disk0 it failed.
Expected result
===============
instance root_device_name should remain the same as before rescue/unrescue, regardless of image used for rescuing.
Actual result
=============
instance root_device_name is updated according the hw_disk_bus property for the image used during rescue(and never set back to original value)
tags: | added: cinder libvirt volumes |
Fix proposed to branch: master /review. opendev. org/670000
Review: https:/