While we may not want to copy the cloudinit disk/drive, we still need to create+allocate the volume, else the next start complains about a missing CI drive..
fixes commit 7d6c99f0a0026ce07fa0eb858db7b6b7756ae021. Signed-off-by: Thomas Lamprecht <[email protected]> --- PVE/API2/Qemu.pm | 4 ++-- PVE/QemuServer.pm | 11 +++++++++++ 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/PVE/API2/Qemu.pm b/PVE/API2/Qemu.pm index a04ff21..8fcd3ab 100644 --- a/PVE/API2/Qemu.pm +++ b/PVE/API2/Qemu.pm @@ -2801,10 +2801,10 @@ __PACKAGE__->register_method({ } elsif (PVE::QemuServer::is_valid_drivename($opt)) { my $drive = PVE::QemuServer::parse_drive($opt, $value); die "unable to parse drive options for '$opt'\n" if !$drive; - if (PVE::QemuServer::drive_is_cdrom($drive)) { + if (PVE::QemuServer::drive_is_cdrom($drive, 1)) { $newconf->{$opt} = $value; # simply copy configuration } else { - if ($full) { + if ($full || PVE::QemuServer::drive_is_cloudinit($drive)) { die "Full clone feature is not supported for drive '$opt'\n" if !PVE::Storage::volume_has_feature($storecfg, 'copy', $drive->{file}, $snapname, $running); $fullclone->{$opt} = 1; diff --git a/PVE/QemuServer.pm b/PVE/QemuServer.pm index d661afe..11e7169 100644 --- a/PVE/QemuServer.pm +++ b/PVE/QemuServer.pm @@ -7108,11 +7108,21 @@ sub clone_disk { print "create full clone of drive $drivename ($drive->{file})\n"; my $name = undef; + if (drive_is_cloudinit($drive)) { + $name = "vm-$newvmid-cloudinit"; + $name .= ".$dst_format" if $dst_format ne 'raw'; + $snapname = undef; + $size = PVE::QemuServer::Cloudinit::CLOUDINIT_DISK_SIZE; + } $newvolid = PVE::Storage::vdisk_alloc($storecfg, $storeid, $newvmid, $dst_format, $name, ($size/1024)); push @$newvollist, $newvolid; PVE::Storage::activate_volumes($storecfg, [$newvolid]); + if (drive_is_cloudinit($drive)) { + goto no_data_clone; + } + my $sparseinit = PVE::Storage::volume_has_feature($storecfg, 'sparseinit', $newvolid); if (!$running || $snapname) { # TODO: handle bwlimits @@ -7129,6 +7139,7 @@ sub clone_disk { } } +no_data_clone: my ($size) = PVE::Storage::volume_size_info($storecfg, $newvolid, 3); my $disk = $drive; -- 2.20.1 _______________________________________________ pve-devel mailing list [email protected] https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
