set template flag earlier

This commit is contained in:
Dietmar Maurer 2013-04-22 07:08:51 +02:00
parent 0402a80b77
commit 75e7e997e7
2 changed files with 3 additions and 5 deletions

View File

@ -2401,9 +2401,11 @@ __PACKAGE__->register_method({
my $realcmd = sub {
PVE::QemuServer::template_create($vmid, $conf, $disk);
};
return $rpcenv->fork_worker('qmtemplate', $vmid, $authuser, $realcmd);
$conf->{template} = 1;
PVE::QemuServer::update_config_nolock($vmid, $conf, 1);
return $rpcenv->fork_worker('qmtemplate', $vmid, $authuser, $realcmd);
};
PVE::QemuServer::lock_config($vmid, $updatefn);

View File

@ -4445,7 +4445,6 @@ sub template_create {
die "you can't convert a vm to template if vm is running vm\n" if $running;
my $storecfg = PVE::Storage::config();
my $i = 0;
foreach_drive($conf, sub {
my ($ds, $drive) = @_;
@ -4460,10 +4459,7 @@ sub template_create {
$drive->{file} = $voliddst;
$conf->{$ds} = PVE::QemuServer::print_drive($vmid, $drive);
PVE::QemuServer::update_config_nolock($vmid, $conf, 1);
});
$conf->{template} = 1;
PVE::QemuServer::update_config_nolock($vmid, $conf, 1);
}
sub is_template {