qm importdisk: tell user to what VM disk we actually imported

as else one has no idea what the imported disk is, especially if
multiple unused disks are already present..

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
This commit is contained in:
Thomas Lamprecht 2019-10-29 19:09:07 +01:00
parent 5600c5b22f
commit c75bf16117
2 changed files with 7 additions and 4 deletions

View File

@ -483,12 +483,13 @@ __PACKAGE__->register_method ({
my $storecfg = PVE::Storage::config();
PVE::Storage::storage_check_enabled($storecfg, $storeid);
my $target_storage_config =
PVE::Storage::storage_config($storecfg, $storeid);
my $target_storage_config = PVE::Storage::storage_config($storecfg, $storeid);
die "storage $storeid does not support vm images\n"
if !$target_storage_config->{content}->{images};
PVE::QemuServer::ImportDisk::do_import($source, $vmid, $storeid, { format => $format });
print "importing disk '$source' to VM $vmid ...\n";
my ($drive_id, $volid) = PVE::QemuServer::ImportDisk::do_import($source, $vmid, $storeid, { format => $format });
print "Successfully imported disk as '$drive_id:$volid'\n";
return undef;
}});

View File

@ -55,7 +55,7 @@ sub do_import {
PVE::QemuServer::vmconfig_apply_pending($vmid, $vm_conf, $storecfg);
}
} else {
PVE::QemuConfig->add_unused_volume($vm_conf, $dst_volid);
$drive_name = PVE::QemuConfig->add_unused_volume($vm_conf, $dst_volid);
PVE::QemuConfig->write_config($vmid, $vm_conf);
}
};
@ -78,6 +78,8 @@ sub do_import {
warn "cleanup of $dst_volid failed: $@\n" if $@;
die $err;
}
return ($drive_name, $dst_volid);
}
1;