cloudinit: use detected format in volname parsing

keep the ?, as format is raw if no file ending is there, which we
want to handle too.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
This commit is contained in:
Thomas Lamprecht 2019-04-30 13:24:53 +00:00
parent 84821d1515
commit 92fcaab73a

View File

@ -34,7 +34,7 @@ sub commit_cloudinit_disk {
my $size = eval { PVE::Storage::file_size_info($iso_path) }; my $size = eval { PVE::Storage::file_size_info($iso_path) };
if ($size <= 0) { if ($size <= 0) {
$volname =~ m/(vm-$vmid-cloudinit(.(qcow2|raw))?)/; $volname =~ m/(vm-$vmid-cloudinit(.\Q$format\E)?)/;
my $name = $1; my $name = $1;
$size = 4 * 1024; $size = 4 * 1024;
PVE::Storage::vdisk_alloc($storecfg, $storeid, $vmid, $format, $name, $size); PVE::Storage::vdisk_alloc($storecfg, $storeid, $vmid, $format, $name, $size);