return 1 if current is template
return 2 if a snapshot is a template
Signed-off-by: Alexandre Derumier <[email protected]>
---
PVE/QemuServer.pm | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/PVE/QemuServer.pm b/PVE/QemuServer.pm
index 1e70c3a..21e4827 100644
--- a/PVE/QemuServer.pm
+++ b/PVE/QemuServer.pm
@@ -4489,4 +4489,20 @@ sub template_delete {
}
+sub is_template {
+ my ($conf, $snapname, $checkall) = @_;
+
+ return 2 if $snapname &&
defined($conf->{snapshots}->{$snapname}->{template});
+ return 1 if ($conf->{template} && !$snapname);
+
+ if($checkall){
+ my $snaphash = $conf->{snapshots} || {};
+ foreach my $snapname (keys %$snaphash) {
+ return 2 if defined($snaphash->{$snapname}->{template});
+ }
+ }
+
+ return undef;
+}
+
1;
--
1.7.10.4
_______________________________________________
pve-devel mailing list
[email protected]
http://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel