[pve-devel] r5259 - qemu-server/trunk

svn-commits at proxmox.com svn-commits at proxmox.com
Mon Oct 11 13:47:06 CEST 2010


Author: dietmar
Date: 2010-10-11 11:47:06 +0000 (Mon, 11 Oct 2010)
New Revision: 5259

Modified:
   qemu-server/trunk/Makefile
   qemu-server/trunk/QemuServer.pm
   qemu-server/trunk/VZDump::QemuServer.pm
   qemu-server/trunk/changelog.Debian
   qemu-server/trunk/qm
   qemu-server/trunk/qmrestore
Log:


Modified: qemu-server/trunk/Makefile
===================================================================
--- qemu-server/trunk/Makefile	2010-10-11 09:56:13 UTC (rev 5258)
+++ qemu-server/trunk/Makefile	2010-10-11 11:47:06 UTC (rev 5259)
@@ -2,7 +2,7 @@
 
 VERSION=1.1
 PACKAGE=qemu-server
-PKGREL=19
+PKGREL=20
 
 DESTDIR=
 PREFIX=/usr

Modified: qemu-server/trunk/QemuServer.pm
===================================================================
--- qemu-server/trunk/QemuServer.pm	2010-10-11 09:56:13 UTC (rev 5258)
+++ qemu-server/trunk/QemuServer.pm	2010-10-11 11:47:06 UTC (rev 5259)
@@ -491,7 +491,7 @@
 }
 
 # ideX = [volume=]volume-id[,media=d][,cyls=c,heads=h,secs=s[,trans=t]]
-#        [,snapshot=on|off][,cache=on|off][,format=f]
+#        [,snapshot=on|off][,cache=on|off][,format=f][,backup=yes|no]
 
 sub parse_drive {
     my ($key, $data) = @_;
@@ -508,7 +508,7 @@
     foreach my $p (split (/,/, $data)) {
 	next if $p =~ m/^\s*$/;
 
-	if ($p =~ m/^(file|volume|cyls|heads|secs|trans|media|snapshot|cache|format|rerror|werror)=(.+)$/) {
+	if ($p =~ m/^(file|volume|cyls|heads|secs|trans|media|snapshot|cache|format|rerror|werror|backup)=(.+)$/) {
 	    my ($k, $v) = ($1, $2);
 
 	    $k = 'file' if $k eq 'volume';
@@ -538,6 +538,7 @@
     return undef if $res->{format} && $res->{format} !~ m/^(raw|cow|qcow|qcow2|vmdk|cloop)$/;
     return undef if $res->{rerror} && $res->{rerror} !~ m/^(ignore|report|stop)$/;
     return undef if $res->{werror} && $res->{werror} !~ m/^(enospc|ignore|report|stop)$/;
+    return undef if $res->{backup} && $res->{backup} !~ m/^(yes|no)$/;
 
     if ($res->{media} && ($res->{media} eq 'cdrom')) {
 	return undef if $res->{snapshot} || $res->{trans} || $res->{format};
@@ -552,31 +553,28 @@
 
     return $res;
 }
+   
+my @qemu_drive_options = qw(heads secs cyls trans media format cache snapshot rerror werror);
 
-sub get_qemu_drive_options {
-    my ($drive) = @_;
-
-    my $res = '';
-    foreach my $o (qw(heads secs cyls trans media format cache snapshot rerror werror)) {
-	$res .= ",$o=$drive->{$o}" if $drive->{$o};
-    }
-
-    return $res;
-}
-
 sub print_drive {
     my ($vmid, $drive) = @_;
 
-    my $opts = get_qemu_drive_options ($drive);
-
+    my $opts = '';
+    foreach my $o (@qemu_drive_options, 'backup') {
+	$opts .= ",$o=$drive->{$o}" if $drive->{$o};
+    }
+    
     return "$drive->{file}$opts";
 }
 
 sub print_drive_full {
     my ($self, $vmid, $drive) = @_;
 
-    my $opts = get_qemu_drive_options ($drive);
-
+    my $opts = '';
+    foreach my $o (@qemu_drive_options) {
+	$opts .= ",$o=$drive->{$o}" if $drive->{$o};
+    }
+ 
     my $path;
     my $volid = $drive->{file};
     if (drive_is_cdrom ($drive)) {

Modified: qemu-server/trunk/VZDump::QemuServer.pm
===================================================================
--- qemu-server/trunk/VZDump::QemuServer.pm	2010-10-11 09:56:13 UTC (rev 5258)
+++ qemu-server/trunk/VZDump::QemuServer.pm	2010-10-11 11:47:06 UTC (rev 5259)
@@ -81,6 +81,12 @@
     foreach my $ds (sort keys %$di) {
 	next if PVE::QemuServer::drive_is_cdrom ($di->{$ds});
 
+	if (defined($di->{$ds}->{backup}) && $di->{$ds}->{backup} eq "no") {
+	    my $currentmedia = $di->{$ds}->{interface}.$di->{$ds}->{index};
+	    $self->loginfo("exclude disk '$ds' (backup=no)");
+	    next;
+	}
+	   
 	my $volid = $di->{$ds}->{file};
 
 	my $path;

Modified: qemu-server/trunk/changelog.Debian
===================================================================
--- qemu-server/trunk/changelog.Debian	2010-10-11 09:56:13 UTC (rev 5258)
+++ qemu-server/trunk/changelog.Debian	2010-10-11 11:47:06 UTC (rev 5259)
@@ -1,3 +1,10 @@
+qemu-server (1.1-20) unstable; urgency=low
+
+  * new backup=yes|no option for drives. VZDump ignores drives with option
+    backup=no (many thanks to draguz) 
+
+ -- Proxmox Support Team <support at proxmox.com>  Mon, 11 Oct 2010 13:46:14 +0200
+
 qemu-server (1.1-19) unstable; urgency=low
 
   * new qmrestore option '--unique' : create unique MAC address on

Modified: qemu-server/trunk/qm
===================================================================
--- qemu-server/trunk/qm	2010-10-11 09:56:13 UTC (rev 5258)
+++ qemu-server/trunk/qm	2010-10-11 11:47:06 UTC (rev 5259)
@@ -56,6 +56,7 @@
     print STDERR "\t                      [,snapshot=on|off][,cache=on|off][,format=f]\n";
     print STDERR "\t                      [,werror=enospc|ignore|report|stop]\n";
     print STDERR "\t                      [,rerror=ignore|report|stop]\n";
+    print STDERR "\t                      [,backup=no|yes]\n";
     print STDERR "\t--ide<N> <GBYTES>     create new disk\n";
     print STDERR "\t--ide<N> delete       remove drive - destroy image\n";
     print STDERR "\t--ide<N> undef        remove drive - keep image\n";
@@ -68,6 +69,7 @@
     print STDERR "\t                      [,snapshot=on|off][,format=f]\n";
     print STDERR "\t                      [,cache=none|writethrough|writeback]\n";
     print STDERR "\t                      [,werror=enospc|ignore|report|stop]\n";
+    print STDERR "\t                      [,backup=no|yes]\n";
     print STDERR "\t--scsi<N> <GBYTES>    create new disk\n";
     print STDERR "\t--scsi<N> delete      remove drive - destroy image\n";
     print STDERR "\t--scsi<N> undef       remove drive - keep image\n";
@@ -79,6 +81,7 @@
     print STDERR "\t                      [,cache=none|writethrough|writeback]\n";
     print STDERR "\t                      [,werror=enospc|ignore|report|stop]\n";
     print STDERR "\t                      [,rerror=ignore|report|stop]\n";
+    print STDERR "\t                      [,backup=no|yes]\n";
     print STDERR "\t--virtio<N> <GBYTES>  create new disk\n";
     print STDERR "\t--virtio<N> delete    remove drive - destroy image\n";
     print STDERR "\t--virtio<N> undef     remove drive - keep image\n";
@@ -970,15 +973,15 @@
 
 Default is read from global configuration file.
 
-=item ide0 - ide3: [volume=]volume,][,media=cdrom|disk] [,cyls=c,heads=h,secs=s[,trans=t]] [,snapshot=on|off] [,cache=none|writethrough"|writeback] [,format=f]
+=item ide0 - ide3: [volume=]volume,][,media=cdrom|disk] [,cyls=c,heads=h,secs=s[,trans=t]] [,snapshot=on|off] [,cache=none|writethrough"|writeback] [,format=f][,backup=yes|no]
 
 Use volume as IDE hard disk or CD-ROM.
 
-=item scsi0 - scsi15: [volume=]volume,][,media=cdrom|disk] [,cyls=c,heads=h,secs=s[,trans=t]] [,snapshot=on|off] [,cache=none|writethrough"|writeback] [,format=f]
+=item scsi0 - scsi15: [volume=]volume,][,media=cdrom|disk] [,cyls=c,heads=h,secs=s[,trans=t]] [,snapshot=on|off] [,cache=none|writethrough"|writeback] [,format=f][,backup=yes|no]
 
 Use volume as SCSI hard disk or CD-ROM.
 
-=item virtio0 - virtio15: [volume=]volume,][,media=cdrom|disk] [,cyls=c,heads=h,secs=s[,trans=t]] [,snapshot=on|off] [,cache=none|writethrough"|writeback] [,format=f]
+=item virtio0 - virtio15: [volume=]volume,][,media=cdrom|disk] [,cyls=c,heads=h,secs=s[,trans=t]] [,snapshot=on|off] [,cache=none|writethrough"|writeback] [,format=f][,backup=yes|no]
 
 Use file as VIRTIO hard disk.
 

Modified: qemu-server/trunk/qmrestore
===================================================================
--- qemu-server/trunk/qmrestore	2010-10-11 09:56:13 UTC (rev 5258)
+++ qemu-server/trunk/qmrestore	2010-10-11 11:47:06 UTC (rev 5259)
@@ -304,7 +304,9 @@
 	    } elsif ($line =~ m/^((ide|scsi|virtio)\d+):(.*)$/) {
 		my $virtdev = $1;
 		my $value = $2;
-		if ($virtdev && $map->{$virtdev}) {
+		if ($line =~ m/backup=no/) {
+		    print $outfd "#$line";
+		} elsif ($virtdev && $map->{$virtdev}) {
 		    my $di = PVE::QemuServer::parse_drive ($virtdev, $value);
 		    $di->{file} = $map->{$virtdev};
 		    $value = PVE::QemuServer::print_drive ($vmid, $di);




More information about the pve-devel mailing list