mirror of
https://git.proxmox.com/git/pve-manager
synced 2025-05-30 15:17:56 +00:00
run openvz destroy_vm as background task
This commit is contained in:
parent
7ca813e6fd
commit
a42f6acbcb
@ -454,7 +454,9 @@ __PACKAGE__->register_method({
|
|||||||
vmid => get_standard_option('pve-vmid'),
|
vmid => get_standard_option('pve-vmid'),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
returns => { type => 'null' },
|
returns => {
|
||||||
|
type => 'string',
|
||||||
|
},
|
||||||
code => sub {
|
code => sub {
|
||||||
my ($param) = @_;
|
my ($param) = @_;
|
||||||
|
|
||||||
@ -467,11 +469,13 @@ __PACKAGE__->register_method({
|
|||||||
# test if VM exists
|
# test if VM exists
|
||||||
my $conf = PVE::OpenVZ::load_config($param->{vmid});
|
my $conf = PVE::OpenVZ::load_config($param->{vmid});
|
||||||
|
|
||||||
|
my $realcmd = sub {
|
||||||
my $cmd = ['vzctl', 'destroy', $vmid ];
|
my $cmd = ['vzctl', 'destroy', $vmid ];
|
||||||
|
|
||||||
PVE::Tools::run_command($cmd);
|
PVE::Tools::run_command($cmd);
|
||||||
|
};
|
||||||
|
|
||||||
return undef;
|
return $rpcenv->fork_worker('vzdestroy', $vmid, $user, $realcmd);
|
||||||
}});
|
}});
|
||||||
|
|
||||||
my $sslcert;
|
my $sslcert;
|
||||||
|
Loading…
Reference in New Issue
Block a user