]> git.proxmox.com Git - qemu-server.git/commitdiff
qm importdisk: tell user to what VM disk we actually imported
authorThomas Lamprecht <t.lamprecht@proxmox.com>
Tue, 29 Oct 2019 18:09:07 +0000 (19:09 +0100)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Tue, 29 Oct 2019 18:11:21 +0000 (19:11 +0100)
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>
PVE/CLI/qm.pm
PVE/QemuServer/ImportDisk.pm

index 9eadedd2be3eef5a9d67e576f6c8d93e0c0eaf28..75e27044929f22eecae29803a65a6e5a08c78877 100755 (executable)
@@ -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;
     }});
index bae380c4eb93e2b2f496878d27a3b3e251597529..51ad52eab43ebad24a104de116dc5eea88587c7a 100755 (executable)
@@ -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;