disk reassign: add unused disks directly to config

Using $update_vm_api for unused disks will cause them to end up as a
pending change if the VM is running.

Signed-off-by: Aaron Lauterer <a.lauterer@proxmox.com>
This commit is contained in:
Aaron Lauterer 2021-11-10 18:00:13 +01:00 committed by Fabian Grünbichler
parent f4e4c77984
commit bf67da2bf7

View File

@ -3607,15 +3607,21 @@ __PACKAGE__->register_method({
PVE::QemuConfig->write_config($vmid, $source_conf); PVE::QemuConfig->write_config($vmid, $source_conf);
my $drive_string = PVE::QemuServer::print_drive($drive); my $drive_string = PVE::QemuServer::print_drive($drive);
&$update_vm_api(
{ if ($target_disk =~ /^unused\d+$/) {
node => $node, $target_conf->{$target_disk} = $drive_string;
vmid => $target_vmid, PVE::QemuConfig->write_config($target_vmid, $target_conf);
digest => $target_digest, } else {
$target_disk => $drive_string, &$update_vm_api(
}, {
1, node => $node,
); vmid => $target_vmid,
digest => $target_digest,
$target_disk => $drive_string,
},
1,
);
}
# remove possible replication snapshots # remove possible replication snapshots
if (PVE::Storage::volume_has_feature( if (PVE::Storage::volume_has_feature(