[pve-devel] [PATCH qemu-server] fix #2100: skip local cloudinit image on offline migrate

Mira Limbeck m.limbeck at proxmox.com
Wed Feb 27 09:52:36 CET 2019


check for cdrom and 'vm-<id>-cloudinit' to see if a cloudinit drive is
configured and delete it from local_volumes so it isn't copied.

Signed-off-by: Mira Limbeck <m.limbeck at proxmox.com>
---
 PVE/QemuMigrate.pm | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/PVE/QemuMigrate.pm b/PVE/QemuMigrate.pm
index ee605d8..aedc40f 100644
--- a/PVE/QemuMigrate.pm
+++ b/PVE/QemuMigrate.pm
@@ -353,6 +353,7 @@ sub sync_disks {
 
 	    $local_volumes->{$volid}->{ref} = $attr->{referenced_in_config} ? 'config' : 'snapshot';
 
+	    return if ($attr->{cdrom} && ($volid =~ /vm-\d+-cloudinit/));
 	    die "local cdrom image\n" if $attr->{cdrom};
 
 	    my ($path, $owner) = PVE::Storage::path($self->{storecfg}, $volid);
@@ -384,6 +385,13 @@ sub sync_disks {
 	    }
         });
 
+	foreach my $vol (keys %$local_volumes) {
+	    if ($vol =~ /vm-\d+-cloudinit/) {
+		delete $local_volumes->{$vol};
+	    }
+	}
+
 	foreach my $vol (sort keys %$local_volumes) {
 	    my $ref = $local_volumes->{$vol}->{ref};
 	    if ($ref eq 'storage') {
-- 
2.11.0





More information about the pve-devel mailing list