]> git.proxmox.com Git - qemu-server.git/commitdiff
do not allow template creation if there are snapshots.
authorDietmar Maurer <dietmar@proxmox.com>
Mon, 22 Apr 2013 05:05:54 +0000 (07:05 +0200)
committerDietmar Maurer <dietmar@proxmox.com>
Mon, 22 Apr 2013 05:05:54 +0000 (07:05 +0200)
PVE/API2/Qemu.pm
PVE/QemuServer.pm

index 81970706c00d915d357806af424b3e9c853b41fa..3cc35a223d34f626dae0aeb9b89eb7151ca8b5d3 100644 (file)
@@ -2392,8 +2392,12 @@ __PACKAGE__->register_method({
 
            PVE::QemuServer::check_lock($conf);
 
-           die "you can't convert a template to a template" 
+           die "unable to create template, because VM contains snapshots\n" 
+               if $conf->{snapshots};
+
+           die "you can't convert a template to a template\n" 
                if PVE::QemuServer::is_template($conf) && !$disk;
+
            my $realcmd = sub {
                PVE::QemuServer::template_create($vmid, $conf, $disk);
            };
index afc9976df670bccffe7aa510a5ede24d178292f2..ba75975246707a0284e3b90a9a13a0019dcc2f15 100644 (file)
@@ -4462,11 +4462,6 @@ sub template_create {
        PVE::QemuServer::update_config_nolock($vmid, $conf, 1);
 
     });
-    if($conf->{snapshots}){
-       delete $conf->{parent};
-       delete $conf->{snapshots};
-       #fixme : do we need to delete disks snapshots ?
-    }
     $conf->{template} = 1;
     PVE::QemuServer::update_config_nolock($vmid, $conf, 1);
 }