[pve-devel] [PATCH V3 qemu-server 2/3] clean up

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


make code more readable.
---
 PVE/QemuMigrate.pm | 30 +++++++++++++++---------------
 1 file changed, 15 insertions(+), 15 deletions(-)

diff --git a/PVE/QemuMigrate.pm b/PVE/QemuMigrate.pm
index 26744f0..ef5d9e6 100644
--- a/PVE/QemuMigrate.pm
+++ b/PVE/QemuMigrate.pm
@@ -287,21 +287,21 @@ sub sync_disks {
 	    die "can't do online migration - VM uses local disks\n";
 	}
 
-	# do some checks first
-	foreach my $volid (keys %$volhash) {
-	    my ($sid, $volname) = PVE::Storage::parse_volume_id($volid);
-	    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' ||
-		      $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;
+	if (!$sharedvm) {
+	    foreach my $volid (keys %$volhash) {
+		my ($sid, $volname) = PVE::Storage::parse_volume_id($volid);
+		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' ||
+			  $scfg->{type} eq 'lvmthin' || $scfg->{type} eq 'lvm'));
+
+		#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') {
+		    #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