[pve-devel] [PATCH] don't try to hotplug disk if a disk already exist.
Alexandre Derumier
aderumier at odiso.com
Wed Aug 27 16:29:05 CEST 2014
Currenly it's working with virtio-blk because we check in QemuServer::vm_deviceplug
if the virtio pci controller virtioX exist. (listing pci devices wih qmp)
But it don't work with scsi disk, because hotplugged devices are disks,
and not pci controller
This break update for disk throttle for example.
Signed-off-by: Alexandre Derumier <aderumier at odiso.com>
---
PVE/API2/Qemu.pm | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/PVE/API2/Qemu.pm b/PVE/API2/Qemu.pm
index 985a9f8..1c64ca7 100644
--- a/PVE/API2/Qemu.pm
+++ b/PVE/API2/Qemu.pm
@@ -759,12 +759,16 @@ my $vmconfig_update_disk = sub {
$rpcenv->check_vm_perm($authuser, $vmid, undef, ['VM.Config.Disk']);
}
+ my $old_volid = undef;
+
if ($conf->{$opt}) {
if (my $old_drive = PVE::QemuServer::parse_drive($opt, $conf->{$opt})) {
my $media = $drive->{media} || 'disk';
my $oldmedia = $old_drive->{media} || 'disk';
+ $old_volid = $drive->{file};
+
die "unable to change media type\n" if $media ne $oldmedia;
if (!PVE::QemuServer::drive_is_cdrom($old_drive) &&
@@ -822,8 +826,7 @@ my $vmconfig_update_disk = sub {
}
}
- } else { # hotplug new disks
-
+ } elsif (!$old_volid) { # hotplug new disks
die "error hotplug $opt" if !PVE::QemuServer::vm_deviceplug($storecfg, $conf, $vmid, $opt, $drive);
}
};
--
1.7.10.4
More information about the pve-devel
mailing list