[pve-devel] [PATCH 8/8] template: use read_only arg

Alexandre Derumier aderumier at odiso.com
Tue Dec 4 12:19:11 CET 2012


Signed-off-by: Alexandre Derumier <aderumier at odiso.com>
---
 PVE/API2/Qemu.pm  |    2 ++
 PVE/QemuServer.pm |    4 ++--
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/PVE/API2/Qemu.pm b/PVE/API2/Qemu.pm
index 548987f..d5ce5c3 100644
--- a/PVE/API2/Qemu.pm
+++ b/PVE/API2/Qemu.pm
@@ -447,6 +447,8 @@ __PACKAGE__->register_method({
 		        delete $param->{snapshots};
 		    }
 
+		    delete $param->{template};
+
 		    foreach my $opt (keys %$param) {
 			if ($opt =~ m/^net(\d+)$/) {
 			    # add macaddr
diff --git a/PVE/QemuServer.pm b/PVE/QemuServer.pm
index 48a4392..0c25173 100644
--- a/PVE/QemuServer.pm
+++ b/PVE/QemuServer.pm
@@ -4087,7 +4087,7 @@ sub template_create {
 	my ($storeid, $volname) = PVE::Storage::parse_volume_id($volid, 1);
 	if ($storeid) {
 	     my $scfg = PVE::Storage::storage_config($storecfg, $storeid);
-	     PVE::Storage::volume_protect($storecfg, $volid, $snapname);
+	     PVE::Storage::volume_protect($storecfg, $volid, $snapname, 1);
 	}
     });
 
@@ -4130,7 +4130,7 @@ sub template_delete {
 	my ($storeid, $volname) = PVE::Storage::parse_volume_id($volid, 1);
 	if ($storeid) {
 	    my $scfg = PVE::Storage::storage_config($storecfg, $storeid);
-	    PVE::Storage::volume_unprotect($storecfg, $volid, $snapname);
+	    PVE::Storage::volume_protect($storecfg, $volid, $snapname);
 	}
     });
 
-- 
1.7.10.4




More information about the pve-devel mailing list