do not allow template creation if there are snapshots.

This commit is contained in:
Dietmar Maurer 2013-04-22 07:05:54 +02:00
parent bef4463b61
commit 0402a80b77
2 changed files with 5 additions and 6 deletions

View 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);
};

View 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);
}