[pve-devel] [PATCH pve-zsync] fix #1301 Do not allow file path as mp.

Wolfgang Link w.link at proxmox.com
Wed Mar 15 08:58:52 CET 2017


If a file path is used as mp in lxc, you get a error message that it is not include in the sync.
---
 pve-zsync | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/pve-zsync b/pve-zsync
index 4993bed..3ea4b47 100644
--- a/pve-zsync
+++ b/pve-zsync
@@ -769,20 +769,20 @@ sub parse_disks {
     my $num = 0;
     while ($text && $text =~ s/^(.*?)(\n|$)//) {
 	my $line = $1;
-	my $error = $vm_type eq 'qemu' ? 1 : 0 ;
+	my $expose_error = $vm_type eq 'qemu' ? 1 : 0 ;
 
 	next if $line =~ /cdrom|none/;
 	next if $line !~ m/^(?:((?:virtio|ide|scsi|sata|mp)\d+)|rootfs): /;
 
 	#QEMU if backup is not set include in  sync
-	next if $vm_type eq 'qemu && ($line =~ m/backup=(?i:0|no|off|false)/)';
+	next if $vm_type eq 'qemu' && ($line =~ m/backup=(?i:0|no|off|false)/);
 
 	#LXC if backup is not set do no in sync
-	$error = ($line =~ m/backup=(?i:1|yes|on|true)/) if $vm_type eq 'lxc';
+	$expose_error = ($line =~ m/backup=(?i:1|yes|on|true)/) if $vm_type eq 'lxc';
 
 	my $disk = undef;
 	my $stor = undef;
-	if($line =~ m/^(?:(?:(?:virtio|ide|scsi|sata|mp)\d+)|rootfs): (.*)$/) {
+	if($line =~ m@^(?:(?:(?:virtio|ide|scsi|sata|mp)\d+)|rootfs): ([^/].*)$@) {
 	    my @parameter = split(/,/,$1);
 
 	    foreach my $opt (@parameter) {
@@ -794,7 +794,7 @@ sub parse_disks {
 	    }
 
 	} else {
-	    print "Disk: \"$line\" will not include in pve-sync\n" if $get_err || $error;
+	    print "Disk: \"$line\" will not include in pve-sync\n" if $get_err || $expose_error;
 	    next;
 	}
 
-- 
2.1.4





More information about the pve-devel mailing list