move assertion so that we have all checks at the same place.

This commit is contained in:
Dietmar Maurer 2013-04-22 07:10:58 +02:00
parent 75e7e997e7
commit 35c5fdefce
2 changed files with 3 additions and 3 deletions

View File

@ -2398,6 +2398,9 @@ __PACKAGE__->register_method({
die "you can't convert a template to a template\n"
if PVE::QemuServer::is_template($conf) && !$disk;
die "you can't convert a VM to template if VM is running\n"
if check_running($vmid);
my $realcmd = sub {
PVE::QemuServer::template_create($vmid, $conf, $disk);
};

View File

@ -4441,9 +4441,6 @@ sub has_feature {
sub template_create {
my ($vmid, $conf, $disk) = @_;
my $running = check_running($vmid);
die "you can't convert a vm to template if vm is running vm\n" if $running;
my $storecfg = PVE::Storage::config();
foreach_drive($conf, sub {