mirror of
https://git.proxmox.com/git/qemu-server
synced 2025-08-04 16:38:16 +00:00
importdisk: convert imported volume disks to base images for templates
Automatically converts any imported volume disk to a base volume image if the VM is a template and the volume was imported using the "target-disk" option, as "unused" disks are not needed to be converted as they won't be cloned with either linked nor full clones. Signed-off-by: Daniel Kral <d.kral@proxmox.com>
This commit is contained in:
parent
585ec70a2b
commit
60d7d9c748
@ -624,7 +624,13 @@ __PACKAGE__->register_method ({
|
||||
},
|
||||
);
|
||||
|
||||
print "Successfully imported disk as '$drive_id:$volid'\n";
|
||||
$vm_conf = PVE::QemuConfig->load_config($vmid);
|
||||
|
||||
# change imported _used_ disk to a base volume in case the VM is a template
|
||||
PVE::QemuServer::template_create($vmid, $vm_conf, $drive_id)
|
||||
if is_valid_drivename($drive_id) && PVE::QemuConfig->is_template($vm_conf);
|
||||
|
||||
print "$drive_id: successfully imported disk '$vm_conf->{$drive_id}'\n";
|
||||
|
||||
return;
|
||||
}});
|
||||
|
Loading…
Reference in New Issue
Block a user