[pve-devel] [PATCH qemu-server] fix #1409: do not only check pci bus for net devices

Dominik Csapak d.csapak at proxmox.com
Mon Jun 12 13:30:49 CEST 2017


when changing properties of a netX device which needs a device_del and
device_add (model, queues, mac, etc.) there is a race that qemu
removes the device from the pci bus, but not from its qom tree

we then go forward and add a network device with the same id, and qemu
deletes this device now from the qom tree, and we do not see it anymore

so we do not only check the pci bus, but also the qom-tree, which we
go through anyway

Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
---
 PVE/QemuServer.pm | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/PVE/QemuServer.pm b/PVE/QemuServer.pm
index 0efab21..324a7dc 100644
--- a/PVE/QemuServer.pm
+++ b/PVE/QemuServer.pm
@@ -3404,7 +3404,7 @@ sub vm_devices_list {
     # qom-list path=/machine/peripheral
     my $resperipheral = vm_mon_cmd($vmid, 'qom-list', path => '/machine/peripheral');
     foreach my $per (@$resperipheral) {
-	if ($per->{name} =~ m/^usb\d+$/) {
+	if ($per->{name} =~ m/^(?:usb|net)\d+$/) {
 	    $devices->{$per->{name}} = 1;
 	}
     }
-- 
2.11.0





More information about the pve-devel mailing list