[pve-devel] [PATCH qemu-server] fix #2217: don't copy cloudinit disk on clone

Mira Limbeck m.limbeck at proxmox.com
Wed Sep 25 18:12:17 CEST 2019


This removes the cloudinit disk from the list of drives to clone. As the
cloudinit disk is recreated on every VM start, it's not necessary to
clone it.

Signed-off-by: Mira Limbeck <m.limbeck at proxmox.com>
---
 PVE/API2/Qemu.pm  | 4 ++--
 PVE/QemuServer.pm | 8 --------
 2 files changed, 2 insertions(+), 10 deletions(-)

diff --git a/PVE/API2/Qemu.pm b/PVE/API2/Qemu.pm
index 1e8d350..267a08e 100644
--- a/PVE/API2/Qemu.pm
+++ b/PVE/API2/Qemu.pm
@@ -2840,10 +2840,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, 1)) {
+		    if (PVE::QemuServer::drive_is_cdrom($drive)) {
 			$newconf->{$opt} = $value; # simply copy configuration
 		    } else {
-			if ($full || PVE::QemuServer::drive_is_cloudinit($drive)) {
+			if ($full) {
 			    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 ad6902f..8e8445a 100644
--- a/PVE/QemuServer.pm
+++ b/PVE/QemuServer.pm
@@ -7152,14 +7152,6 @@ 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";
-	    $snapname = undef;
-	    # we only get here if it's supported by QEMU_FORMAT_RE, so just accept
-	    if ($dst_format ne 'raw') {
-		$name .= ".$dst_format";
-	    }
-	}
 	$newvolid = PVE::Storage::vdisk_alloc($storecfg, $storeid, $newvmid, $dst_format, $name, ($size/1024));
 	push @$newvollist, $newvolid;
 
-- 
2.20.1





More information about the pve-devel mailing list