mirror of
https://git.proxmox.com/git/qemu-server
synced 2025-08-06 13:41:54 +00:00
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:
parent
5600c5b22f
commit
c75bf16117
@ -483,12 +483,13 @@ __PACKAGE__->register_method ({
|
|||||||
my $storecfg = PVE::Storage::config();
|
my $storecfg = PVE::Storage::config();
|
||||||
PVE::Storage::storage_check_enabled($storecfg, $storeid);
|
PVE::Storage::storage_check_enabled($storecfg, $storeid);
|
||||||
|
|
||||||
my $target_storage_config =
|
my $target_storage_config = PVE::Storage::storage_config($storecfg, $storeid);
|
||||||
PVE::Storage::storage_config($storecfg, $storeid);
|
|
||||||
die "storage $storeid does not support vm images\n"
|
die "storage $storeid does not support vm images\n"
|
||||||
if !$target_storage_config->{content}->{images};
|
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;
|
return undef;
|
||||||
}});
|
}});
|
||||||
|
@ -55,7 +55,7 @@ sub do_import {
|
|||||||
PVE::QemuServer::vmconfig_apply_pending($vmid, $vm_conf, $storecfg);
|
PVE::QemuServer::vmconfig_apply_pending($vmid, $vm_conf, $storecfg);
|
||||||
}
|
}
|
||||||
} else {
|
} 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);
|
PVE::QemuConfig->write_config($vmid, $vm_conf);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -78,6 +78,8 @@ sub do_import {
|
|||||||
warn "cleanup of $dst_volid failed: $@\n" if $@;
|
warn "cleanup of $dst_volid failed: $@\n" if $@;
|
||||||
die $err;
|
die $err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return ($drive_name, $dst_volid);
|
||||||
}
|
}
|
||||||
|
|
||||||
1;
|
1;
|
||||||
|
Loading…
Reference in New Issue
Block a user