[pve-devel] [PATCH pve-container] Convert to disksize to GB after reading the config file

Emmanuel Kasper e.kasper at proxmox.com
Wed Sep 2 16:18:00 CEST 2015


This fixes a bug when calling pct restore a vzdump backup:
we store the rootfs size in KB, but create_disks expects that a GB parameter.
So the restore was failing trying to create something of a Petabyte image.

Formatting '/var/lib/vz/images/110/vm-110-disk-1.raw', fmt=raw size=4503599627370496
unable to create image: qemu-img: /var/lib/vz/images/110/vm-110-disk-1.raw: The image size is too large for file format 'raw'
---
 src/PVE/API2/LXC.pm | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/PVE/API2/LXC.pm b/src/PVE/API2/LXC.pm
index 0595e35..3d45a15 100644
--- a/src/PVE/API2/LXC.pm
+++ b/src/PVE/API2/LXC.pm
@@ -329,6 +329,7 @@ __PACKAGE__->register_method({
 		if (!defined($param->{rootfs})) {
 		    if ($restore) {
 			my (undef, $disksize) = PVE::LXC::Create::recover_config($archive);
+			$disksize /= 1024 * 1024; # create_disks expects GB as unit size
 			die "unable to detect disk size - please specify rootfs (size)\n"
 			    if !$disksize;
 			$param->{rootfs} = "$storage:$disksize";
-- 
2.1.4




More information about the pve-devel mailing list