5
0
mirror of git://git.proxmox.com/git/qemu-server.git synced 2025-02-01 05:47:18 +03:00

api: reassign disk: drop moved disk from boot order

Reported-by: Matthias Heiserer <m.heiserer@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
This commit is contained in:
Thomas Lamprecht 2022-05-02 13:28:03 +02:00
parent 0182efa7a0
commit 96670745a6

View File

@ -3879,6 +3879,13 @@ __PACKAGE__->register_method({
$drive->{file} = $new_volid;
my $boot_order = PVE::QemuServer::device_bootorder($source_conf);
if (defined(delete $boot_order->{$disk})) {
print "removing disk '$disk' from boot order config\n";
my $boot_devs = [ sort { $boot_order->{$a} <=> $boot_order->{$b} } keys %$boot_order ];
$source_conf->{boot} = PVE::QemuServer::print_bootorder($boot_devs);
}
delete $source_conf->{$disk};
print "removing disk '${disk}' from VM '${vmid}' config\n";
PVE::QemuConfig->write_config($vmid, $source_conf);