[pve-devel] [PATCH V3 qemu-server 1/3] Add LVM and LVMThin to QemuMigration

Wolfgang Link w.link at proxmox.com
Mon Jun 13 15:54:14 CEST 2016


Offline migration on LVM and LVMThin are possible offline.
---
 PVE/QemuMigrate.pm | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)

diff --git a/PVE/QemuMigrate.pm b/PVE/QemuMigrate.pm
index 7b9506f..26744f0 100644
--- a/PVE/QemuMigrate.pm
+++ b/PVE/QemuMigrate.pm
@@ -293,12 +293,15 @@ sub sync_disks {
 	    my $scfg =  PVE::Storage::storage_config($self->{storecfg}, $sid);
 
 	    die "can't migrate '$volid' - storage type '$scfg->{type}' not supported\n"
-		if (!($scfg->{type} eq 'dir' || $scfg->{type} eq 'zfspool') && (!$sharedvm));
-
-	    # if file, check if a backing file exist
-	    if (!($scfg->{type} eq 'dir' || $scfg->{type} eq 'zfspool') && (!$sharedvm)) {
-		my (undef, undef, undef, $parent) = PVE::Storage::volume_size_info($self->{storecfg}, $volid, 1);
-		die "can't migrate '$volid' as it's a clone of '$parent'" if $parent;
+		if (!($scfg->{type} eq 'dir' || $scfg->{type} eq 'zfspool' ||
+		      $scfg->{type} eq 'lvmthin' || $scfg->{type} eq 'lvm') && (!$sharedvm));
+
+	    #if image is a linked clone and local storages exists we can't migrate.
+	    if (($scfg->{type} eq 'dir' || $scfg->{type} eq 'zfspool' || $scfg->{type} eq 'lvmthin') &&
+		(!$sharedvm))  {
+		#if a basename exists there must be a parent.
+		my $basename = (PVE::Storage::parse_volname($self->{storecfg}, $volid))[3];
+		die "can't migrate '$volid' as it's a clone of '$basename'" if $basename;
 	    }
 	}
 
-- 
2.1.4





More information about the pve-devel mailing list