[pve-devel] [PATCH] vm_devices_list : also list block devices

Alexandre Derumier aderumier at odiso.com
Fri Aug 29 15:04:15 CEST 2014


This allow scsi disk to be plug|unplug

Signed-off-by: Alexandre Derumier <aderumier at odiso.com>
---
 PVE/QemuServer.pm |    9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/PVE/QemuServer.pm b/PVE/QemuServer.pm
index b4358b0..2058131 100644
--- a/PVE/QemuServer.pm
+++ b/PVE/QemuServer.pm
@@ -2876,7 +2876,14 @@ sub vm_devices_list {
     foreach my $pcibus (@$res) {
 	foreach my $device (@{$pcibus->{devices}}) {
 	    next if !$device->{'qdev_id'};
-	    $devices->{$device->{'qdev_id'}} = $device;
+	    $devices->{$device->{'qdev_id'}} = 1;
+	}
+    }
+
+    my $resblock = vm_mon_cmd($vmid, 'query-block');
+    foreach my $block (@$resblock) {
+	if($block->{device} =~ m/^drive-(\S+)/){
+		$devices->{$1} = 1;
 	}
     }
 
-- 
1.7.10.4




More information about the pve-devel mailing list