1Ravada::Request(3) User Contributed Perl Documentation Ravada::Request(3)
2
3
4
6 Ravada::Request - Requests library for Ravada
7
8 Request a command to the ravada backend
9
10 BUILD
11 Internal object builder, do not call
12
13 open
14 Opens the information of a previous request by id
15
16 my $req = Ravada::Request->open($id);
17
18 info
19 Returns information of the request
20
21 create_domain
22 my $req = Ravada::Request->create_domain(
23 name => 'bla'
24 , id_iso => 1
25 );
26
27 remove_domain
28 my $req = Ravada::Request->remove_domain(
29 name => 'bla'
30 , uid => $user->id
31 );
32
33 start_domain
34 Requests to start a domain
35
36 my $req = Ravada::Request->start_domain(
37 name => 'name'
38 , uid => $user->id
39 );
40
41 Mandatory arguments: one of those must be passed:
42
43 · name or id_domain
44
45 · uid: user id
46
47 · remote_ip: [optional] IP of the remote client that requested to
48 start the domain
49
50 start_clones
51 Requests to start the clones of a base
52
53 my $req = Ravada::Request->start_clones( name => 'name', uid => $user->id );
54
55 pause_domain
56 Requests to pause a domain
57
58 my $req = Ravada::Request->pause_domain( name => 'name', uid => $user->id );
59
60 resume_domain
61 Requests to pause a domain
62
63 my $req = Ravada::Request->resume_domain( name => 'name', uid => $user->id );
64
65 force_shutdown_domain
66 Requests to stop a domain now !
67
68 my $req = Ravada::Request->shutdown_domain( name => 'name' , uid => $user->id );
69
70 shutdown_domain
71 Requests to stop a domain
72
73 my $req = Ravada::Request->shutdown_domain( name => 'name' , uid => $user->id );
74 my $req = Ravada::Request->shutdown_domain( name => 'name' , uid => $user->id
75 ,timeout => $timeout );
76
77 status
78 Returns or sets the status of a request
79
80 $req->status('done');
81
82 my $status = $req->status();
83
84 result
85 Returns the result of the request if any
86
87 my $result = $req->result;
88
89 command
90 Returns the requested command
91
92 args
93 Returns the requested command
94
95 my $command = $req->command;
96
97 args
98 Returns the arguments of a request or the value of one argument field
99
100 my $args = $request->args();
101 print $args->{name};
102
103 print $request->args('name');
104
105 defined_arg
106 Returns if an argument is defined
107
108 copy_screenshot
109 Request to copy a screenshot from a domain to another
110
111 refresh_vms
112 Refreshes the Virtual Mangers
113
114 set_base_vm
115 Enables a base in a Virtual Manager
116
117 remove_base_vm
118 Disables a base in a Virtual Manager
119
120 type
121 Returns the type of the request
122
123 working_requests
124 Returns the number of working requests of the same type
125
126 my $n = $request->working_requests();
127
128 requests_limit
129 Returns the limit of requests of a type.
130
131 domain_autostart
132 Sets the autostart flag on a domain
133
134 autostart_domain
135 Deprecated for domain_autostart
136
137 enforce_limits
138 Enforces virtual machine limits, ie: an user can only run one virtual
139 machine at a time, so the older ones are shut down.
140
141 my $req = Ravada::Request->enforce_limits(
142 timeout => $timeout
143 );
144
145 Arguments:
146
147 · timeout: seconds that are given to a virtual machine to shutdown
148 itself. After this time, it gets powered off. Defaults to 120
149 seconds.
150
151 It is advisable configure virtual machines so they shut down easily if
152 asked to. Just a few hints:
153
154 · install ACPI services
155
156 · Set default action for power off to shutdown, do not ask the user
157
158 refresh_machine
159 Refresh a machine information
160
161 done_recently
162 Returns wether this command has been requested successfully recently.
163
164 if ($request->done_recently($seconds)) {
165 ... skips work ...
166 } else {
167 ... does work ...
168 }
169
170 This method is used for commands that take long to run as garbage
171 collection.
172
174 Hey! The above document had some coding errors, which are explained
175 below:
176
177 Around line 1091:
178 You forgot a '=back' before '=head2'
179
180
181
182perl v5.30.1 2020-02-21 Ravada::Request(3)