[pve-devel] [PATCH container] copy_volume: get the real volume size

Wolfgang Bumiller w.bumiller at proxmox.com
Mon May 7 14:52:47 CEST 2018


Since we're not supposed to rely on this property being
there or even correct.

Signed-off-by: Wolfgang Bumiller <w.bumiller at proxmox.com>
---
 src/PVE/LXC.pm | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/PVE/LXC.pm b/src/PVE/LXC.pm
index 423ce21..de3c91f 100644
--- a/src/PVE/LXC.pm
+++ b/src/PVE/LXC.pm
@@ -1679,6 +1679,8 @@ sub copy_volume {
     # (not-mounted) directory.
     my $new_volid;
     eval {
+	# Make sure $mp contains a correct size.
+	$mp->{size} = PVE::Storage::volume_size_info($storage_cfg, $mp->{volume});
 	my $needs_chown;
 	($new_volid, $needs_chown) = alloc_disk($storage_cfg, $vmid, $storage, $mp->{size}/1024, $rootuid, $rootgid);
 	if ($needs_chown) {
-- 
2.11.0




More information about the pve-devel mailing list