[pve-devel] [PATCH pve-zsync 05/11] regex deduplication

Wolfgang Bumiller w.bumiller at proxmox.com
Mon Sep 28 11:40:06 CEST 2015


---
 pve-zsync | 15 +++------------
 1 file changed, 3 insertions(+), 12 deletions(-)

diff --git a/pve-zsync b/pve-zsync
index dfb383b..dfb3050 100644
--- a/pve-zsync
+++ b/pve-zsync
@@ -696,18 +696,9 @@ sub parse_disks {
 
 	my $disk = undef;
 	my $stor = undef;
-	if($line =~ m/^(virtio\d+: )(.+:)([A-Za-z0-9\-]+),(.*)$/) {
-	    $disk = $3;
-	    $stor = $2;
-	} elsif($line =~ m/^(ide\d+: )(.+:)([A-Za-z0-9\-]+),(.*)$/) {
-	    $disk = $3;
-	    $stor = $2;
-	} elsif($line =~ m/^(scsi\d+: )(.+:)([A-Za-z0-9\-]+),(.*)$/) {
-	    $disk = $3;
-	    $stor = $2;
-	} elsif($line =~ m/^(sata\d+: )(.+:)([A-Za-z0-9\-]+),(.*)$/) {
-	    $disk = $3;
-	    $stor = $2;
+	if($line =~ m/^(?:virtio|ide|scsi|sata)\d+: (.+:)([A-Za-z0-9\-]+),(.*)$/) {
+	    $disk = $2;
+	    $stor = $1;
 	} else {
 	    die "disk is not on ZFS Storage\n";
 	}
-- 
2.1.4





More information about the pve-devel mailing list