Commit 888dcee4 authored by Francesc Guasch's avatar Francesc Guasch
Browse files

[#589] request to set autostart

parent d9e2e9a2
......@@ -2091,6 +2091,15 @@ sub _cmd_refresh_storage($self, $request) {
$vm->refresh_storage();
}
sub _cmd_domain_autostart($self, $request ) {
my $uid = $request->args('uid');
my $id_domain = $request->args('id_domain') or die "ERROR: Missing id_domain";
my $user = Ravada::Auth::SQL->search_by_id($uid);
my $domain = $self->search_domain_by_id($id_domain);
$domain->autostart($request->args('value'), $user);
}
sub _req_method {
my $self = shift;
my $cmd = shift;
......@@ -2118,6 +2127,7 @@ sub _req_method {
,list_vm_types => \&_cmd_list_vm_types
,force_shutdown => \&_cmd_force_shutdown
,refresh_storage => \&_cmd_refresh_storage
,domain_autostart=> \&_cmd_domain_autostart
);
return $methods{$cmd};
......
......@@ -55,6 +55,7 @@ our %VALID_ARG = (
,shutdown_domain => { name => 2, id_domain => 2, uid => 1, timeout => 2, at => 2 }
,force_shutdown_domain => { id_domain => 1, uid => 1, at => 2 }
,screenshot_domain => { id_domain => 1, filename => 2 }
,autostart_domain => { id_domain => 1 , uid => 1, value => 2 }
,copy_screenshot => { id_domain => 1, filename => 2 }
,start_domain => {%$args_manage, remote_ip => 1 }
,rename_domain => { uid => 1, name => 1, id_domain => 1}
......@@ -891,6 +892,26 @@ sub clone {
);
}
=head2 domain_autostart
Sets the autostart flag on a domain
=cut
sub domain_autostart {
my $proto = shift;
my $class = ref($proto) || $proto;
my $args = _check_args('autostart_domain', @_ );
my $self = {};
bless($self, $class);
return _new_request($self
, command => 'domain_autostart'
, args => $args
);
}
sub AUTOLOAD {
my $self = shift;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment