I have openstack
based cloud environment. I have kvm/qemu
based hypervisors. I created Windows
guest OS vm on one of the hypervisors. And I attached volume(vhd) to vm. I changed disk status to online
in guest OS. Then I attached (hotplugged) network interface to vm. I could see added network interface in vm's xml file on hypervisor. I restarted vm and I can still see all disks and network interfaces in xml file. But the slots of them are rearranged. Then I check disk status on guest OS and it shows Offline
. I don't understand where the issue is. If I just restart vm without attaching extra network interface, then disk status is preserved. Does anybody know why it is happening? It does not happen on Linux guest OS so I am assuming this is guest OS level issue, could be virtIO
driver related issue. The issue does not have any relation with hotplugging because it still happens even if I attach network interface after shutting off vm.
windows guest OS over kvm hypervisor does not preserve disk status after attaching network interface

- 175
- 2
- 9
1 Answers
Nova intentionally makes no guarantees about PCI slots assigned to devices. They are dynamically assigned every time the guest and so if you add/remove devices, especially with hotplug, they are pretty much guaranteed to change on each boot.
The precise behaviour you see is simply due to the way in which device addresses are assigned. IIRC, PCI addresses are first assigned to all listed NIC, then assigned to disks / disk controllers. So if you add extra NICs, then all disks will get their PCI slot increased to make room for this extra NIC on next reboot.
Given this, you should not rely on PCI slots for identifying devices in OpenStack. For disks you should ideally identify devices by looking at the filesystem label or UUID, or for NICs use their MAC address to identity.

- 1,618
- 7
- 7
-
I can find and identify disks and NICs in guest but I don't understand why disk status is getting changed when I add NIC and reboot vm. And surprisingly, it does not happen in Linux guest OS but happens on Windows guest OS. – Rohanil Apr 05 '17 at 00:22
-
1Linux guest OS are generally setup to identify disks to mount based on the filesystem UUID or label. As such Linux doesn't care about what PCI address or device name a disk has. Windows is generally more fussy about hardware changes and I'd guess it identifies drives based on their physical address, rather than filesystem contents. So when the PCI address changes, Windows may not recognise the disk as being the same as the one you previously used. This is just one of those things Linux does well and Windows does badly. – DanielB Apr 05 '17 at 17:36
-
Is there any way to change this behavior in Windows guest OS? And is it possible to get root cause of this behavior? – Rohanil Apr 06 '17 at 00:30
-
Not that i know of. – DanielB Apr 06 '17 at 16:31