]> git.proxmox.com Git - qemu-server.git/commitdiff
introduce one global CLOUDINIT_DISK_SIZE constant
authorMira Limbeck <m.limbeck@proxmox.com>
Thu, 16 May 2019 12:07:00 +0000 (14:07 +0200)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Thu, 16 May 2019 14:29:02 +0000 (16:29 +0200)
The variable is used instead of the literal value so we have one single
place to change the actual value of every use.

Signed-off-by: Mira Limbeck <m.limbeck@proxmox.com>
PVE/API2/Qemu.pm
PVE/QemuServer/Cloudinit.pm

index 62e654906cfcfccf3f731ae64b13fcc1c71b6f68..a628a20cd51a530cdeaae1e336c1ebaa5b021f6c 100644 (file)
@@ -159,8 +159,8 @@ my $create_disks = sub {
            }
 
            # Initial disk created with 4 MB and aligned to 4MB on regeneration
-           my $ci_size = 4 * 1024;
-           my $volid = PVE::Storage::vdisk_alloc($storecfg, $storeid, $vmid, $fmt, $name, $ci_size);
+           my $ci_size = PVE::QemuServer::Cloudinit::CLOUDINIT_DISK_SIZE;
+           my $volid = PVE::Storage::vdisk_alloc($storecfg, $storeid, $vmid, $fmt, $name, $ci_size/1024);
            $disk->{file} = $volid;
            $disk->{media} = 'cdrom';
            push @$vollist, $volid;
index 0e4bfd5ff8a8571f9f8136897e97acca99a714f3..45176eaaa5a90fc9b02a0c278f175810a2d0cc00 100644 (file)
@@ -11,6 +11,8 @@ use PVE::Tools qw(run_command file_set_contents);
 use PVE::Storage;
 use PVE::QemuServer;
 
+use constant CLOUDINIT_DISK_SIZE => 4 * 1024 * 1024; # 4MiB in bytes
+
 sub commit_cloudinit_disk {
     my ($conf, $vmid, $drive, $volname, $storeid, $files, $label) = @_;