]> git.proxmox.com Git - qemu-server.git/commitdiff
fix #1829: Cloudinit ignore format parameter
authorWolfgang Link <w.link@proxmox.com>
Tue, 16 Apr 2019 07:58:22 +0000 (09:58 +0200)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Tue, 16 Apr 2019 08:14:22 +0000 (08:14 +0000)
When a Cloudinit image is created, we allow choosing
the format as parameter.
So, the parameter should also be taken into account.

The default for Cloudinit will stay qcow2 on directory storages.

PVE/API2/Qemu.pm

index 651f64f58b7dafcea2a045c524b706e0af661b91..be2551010c8672b89548cee6de40e71377738d24 100644 (file)
@@ -149,13 +149,15 @@ my $create_disks = sub {
            die "no storage ID specified (and no default storage)\n" if !$storeid;
            my $scfg = PVE::Storage::storage_config($storecfg, $storeid);
            my $name = "vm-$vmid-cloudinit";
            die "no storage ID specified (and no default storage)\n" if !$storeid;
            my $scfg = PVE::Storage::storage_config($storecfg, $storeid);
            my $name = "vm-$vmid-cloudinit";
+
            my $fmt = undef;
            if ($scfg->{path}) {
            my $fmt = undef;
            if ($scfg->{path}) {
-               $name .= ".qcow2";
-               $fmt = 'qcow2';
-           }else{
-               $fmt = 'raw';
+               $fmt = $disk->{format} ? $disk->{format} : "qcow2";
+               $name .= ".$fmt";
+           } else {
+               $fmt = $disk->{format};
            }
            }
+
            # Initial disk created with 4MB, every time it is regenerated the disk is aligned to 4MB again.
            my $cloudinit_iso_size = 4; # in MB
            my $volid = PVE::Storage::vdisk_alloc($storecfg, $storeid, $vmid, 
            # Initial disk created with 4MB, every time it is regenerated the disk is aligned to 4MB again.
            my $cloudinit_iso_size = 4; # in MB
            my $volid = PVE::Storage::vdisk_alloc($storecfg, $storeid, $vmid,