[pve-devel] [PATCH qemu-server 2/5] qmp: use 'blockdev-change-medium' instead of generic 'change'
Stefan Reiter
s.reiter at proxmox.com
Thu Feb 6 10:53:52 CET 2020
...and cleanup surrounding code a bit.
'change' is deprecated, and according to the qapi definition in QEMU it
is 'strongly recommended' to avoid using it.
Signed-off-by: Stefan Reiter <s.reiter at proxmox.com>
---
PVE/QemuServer.pm | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)
diff --git a/PVE/QemuServer.pm b/PVE/QemuServer.pm
index 9e00c8a..ff2e3ee 100644
--- a/PVE/QemuServer.pm
+++ b/PVE/QemuServer.pm
@@ -5131,14 +5131,20 @@ sub vmconfig_update_disk {
} else { # cdrom
if ($drive->{file} eq 'none') {
- mon_cmd($vmid, "eject",force => JSON::true,device => "drive-$opt");
+ mon_cmd($vmid, "eject", force => JSON::true, device => "drive-$opt");
if (drive_is_cloudinit($old_drive)) {
vmconfig_register_unused_drive($storecfg, $vmid, $conf, $old_drive);
}
} else {
my $path = get_iso_path($storecfg, $vmid, $drive->{file});
- mon_cmd($vmid, "eject", force => JSON::true,device => "drive-$opt"); # force eject if locked
- mon_cmd($vmid, "change", device => "drive-$opt",target => "$path") if $path;
+
+ # force eject if locked
+ mon_cmd($vmid, "eject", force => JSON::true, device => "drive-$opt");
+
+ if ($path) {
+ mon_cmd($vmid, "blockdev-change-medium",
+ device => "drive-$opt", filename => "$path");
+ }
}
return 1;
--
2.20.1
More information about the pve-devel
mailing list