Signed-off-by: Daniel Kral <[email protected]>
---
changes since v1:
- new!
src/PVE/LXC.pm | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/src/PVE/LXC.pm b/src/PVE/LXC.pm
index 51457ec..1152131 100644
--- a/src/PVE/LXC.pm
+++ b/src/PVE/LXC.pm
@@ -2157,6 +2157,7 @@ sub alloc_disk {
# fixme: use better naming ct-$vmid-disk-X.raw?
eval {
+ my $format = 'raw';
my $do_format = 0;
die "storage '$storage' does not support content type 'rootdir'\n"
@@ -2164,19 +2165,20 @@ sub alloc_disk {
if ($scfg->{path}) {
if ($size_kb > 0 && !($scfg->{type} eq 'btrfs' && $scfg->{quotas}))
{
- $volid = PVE::Storage::vdisk_alloc($storecfg, $storage, $vmid,
'raw', undef, $size_kb);
$do_format = 1;
} else {
- $volid = PVE::Storage::vdisk_alloc($storecfg, $storage, $vmid,
'subvol', undef, $size_kb);
+ $format = 'subvol';
$needs_chown = 1;
}
} elsif ($scfg->{type} eq 'zfspool') {
- $volid = PVE::Storage::vdisk_alloc($storecfg, $storage, $vmid,
'subvol', undef, $size_kb);
+ $format = 'subvol';
$needs_chown = 1;
} else {
- $volid = PVE::Storage::vdisk_alloc($storecfg, $storage, $vmid,
'raw', undef, $size_kb);
$do_format = 1;
}
+
+ $volid = PVE::Storage::vdisk_alloc($storecfg, $storage, $vmid, $format,
undef, $size_kb);
+
format_disk($storecfg, $volid, $root_uid, $root_gid) if $do_format;
};
if (my $err = $@) {
--
2.39.5
_______________________________________________
pve-devel mailing list
[email protected]
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel