qmp: use 'blockdev-change-medium' instead of generic 'change'

...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@proxmox.com>
This commit is contained in:
Stefan Reiter 2020-02-06 10:53:52 +01:00 committed by Thomas Lamprecht
parent 9e7bce2c88
commit ce9fce7985

View File

@ -5137,8 +5137,14 @@ sub vmconfig_update_disk {
} }
} else { } else {
my $path = get_iso_path($storecfg, $vmid, $drive->{file}); 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; return 1;