mirror of
https://git.proxmox.com/git/qemu-server
synced 2025-05-03 19:57:54 +00:00
fix #5301: convert added volume disks to base image for templates
This will automatically convert imported volume disks and newly allocated VM volume disks (i.e. no efidisks, tpmstate disks, cloudinit images, etc.) to a base volume, if the VM is a template. Previously, this required a user to manually convert the imported/allocated disk with `qm template --disk <disk>`. Signed-off-by: Daniel Kral <d.kral@proxmox.com>
This commit is contained in:
parent
60d7d9c748
commit
37a1f42acf
@ -461,6 +461,11 @@ my sub create_disks : prototype($$$$$$$$$$) {
|
||||
'skip-config-update' => 1,
|
||||
},
|
||||
);
|
||||
|
||||
# change imported disk to a base volume in case the VM is a template
|
||||
$dst_volid = PVE::Storage::vdisk_create_base($storecfg, $dst_volid)
|
||||
if PVE::QemuConfig->is_template($conf);
|
||||
|
||||
push @$vollist, $dst_volid;
|
||||
}
|
||||
}
|
||||
@ -490,6 +495,10 @@ my sub create_disks : prototype($$$$$$$$$$) {
|
||||
$volid = PVE::Storage::vdisk_alloc($storecfg, $storeid, $vmid, "raw", undef, $size);
|
||||
} else {
|
||||
$volid = PVE::Storage::vdisk_alloc($storecfg, $storeid, $vmid, $fmt, undef, $size);
|
||||
|
||||
# change created disk to a base volume in case the VM is a template
|
||||
$volid = PVE::Storage::vdisk_create_base($storecfg, $volid)
|
||||
if PVE::QemuConfig->is_template($conf);
|
||||
}
|
||||
push @$vollist, $volid;
|
||||
$disk->{file} = $volid;
|
||||
|
Loading…
Reference in New Issue
Block a user