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 pause_domain
51 Requests to pause a domain
52
53 my $req = Ravada::Request->pause_domain( name => 'name', uid => $user->id );
54
55 resume_domain
56 Requests to pause a domain
57
58 my $req = Ravada::Request->resume_domain( name => 'name', uid => $user->id );
59
60 force_shutdown_domain
61 Requests to stop a domain now !
62
63 my $req = Ravada::Request->shutdown_domain( name => 'name' , uid => $user->id );
64
65 shutdown_domain
66 Requests to stop a domain
67
68 my $req = Ravada::Request->shutdown_domain( name => 'name' , uid => $user->id );
69 my $req = Ravada::Request->shutdown_domain( name => 'name' , uid => $user->id
70 ,timeout => $timeout );
71
72 prepare_base
73 Returns a new request for preparing a domain base
74
75 my $req = Ravada::Request->prepare_base( $name );
76
77 remove_base
78 Returns a new request for making a base regular domain. It marks it as
79 'non base' and removes the files.
80
81 It must have not clones. All clones must be removed before calling this
82 method.
83
84 my $req = Ravada::Request->remove_base( $name );
85
86 ping_backend
87 Returns wether the backend is alive or not
88
89 domdisplay
90 Returns the domdisplay of a domain
91
92 Arguments:
93
94 * domain name
95
96 status
97 Returns or sets the status of a request
98
99 $req->status('done');
100
101 my $status = $req->status();
102
103 result
104 Returns the result of the request if any
105
106 my $result = $req->result;
107
108 command
109 Returns the requested command
110
111 args
112 Returns the requested command
113
114 my $command = $req->command;
115
116 args
117 Returns the arguments of a request or the value of one argument field
118
119 my $args = $request->args();
120 print $args->{name};
121
122 print $request->args('name');
123
124 defined_arg
125 Returns if an argument is defined
126
127 screenshot_domain
128 Request the screenshot of a domain.
129
130 Arguments:
131
132 - optional filename , defaults to "storage_path/$id_domain.png"
133
134 Returns a Ravada::Request;
135
136 copy_screenshot
137 Request to copy a screenshot from a domain to another
138
139 open_iptables
140 Request to open iptables for a remote client
141
142 rename_domain
143 Request to rename a domain
144
145 set_driver
146 Sets a driver to a domain
147
148 $domain->set_driver(
149 id_domain => $domain->id
150 ,uid => $USER->id
151 ,id_driver => $driver->id
152 );
153
154 add_hardware
155 Sets hardware to a VM
156
157 $domain->add_hardware(
158 id_domain => $domain->id
159 ,uid => $USER->id
160 ,hardware => 'usb'
161 );
162
163 remove_hardware
164 Removes hardware to a VM
165
166 $domain->remove_hardware(
167 id_domain => $domain->id
168 ,uid => $USER->id
169 ,name_hardware => 'usb'
170 );
171
172 hybernate
173 Hybernates a domain.
174
175 Ravada::Request->hybernate(
176 id_domain => $domain->id
177 ,uid => $user->id
178 );
179
180 download
181 Downloads a file. Actually used only to download iso images for KVM
182 domains.
183
184 refresh_storage
185 Refreshes a storage pool
186
187 clone
188 Copies a virtual machine
189
190 my $req = Ravada::Request->clone(
191 ,uid => $user->id
192 id_domain => $domain->id
193 );
194
195 change_owner
196 Changes the owner of a machine
197
198 my $req = Ravada::Request->change_owner(
199 ,uid => $user->id
200 ,id_domain => $domain->id
201 );
202
203 change_max_memory
204 Changes the maximum memory of a virtual machine.
205
206 my $req = Ravada::Request->change_max_memory (
207 ,uid => $user->id
208 ,ram => $ram_in_kb
209 ,id_domain => $domain->id
210 );
211
212 change_curr_memory
213 Changes the current memory used by a virtual machine.
214
215 my $req = Ravada::Request->change_curr_memory (
216 ,uid => $user->id
217 ,ram => $ram_in_kb
218 ,id_domain => $domain->id
219 );
220
221 domain_autostart
222 Sets the autostart flag on a domain
223
224 autostart_domain
225 Deprecated for domain_autostart
226
227 refresh_vms
228 Refreshes cached information of the VMs.
229
230 my $req = Ravada::Request->refresh_vms();
231
232 enforce_limits
233 Enforces virtual machine limits, ie: an user can only run one virtual
234 machine at a time, so the older ones are shut down.
235
236 my $req = Ravada::Request->enforce_limits(
237 timeout => $timeout
238 );
239
240 Arguments:
241
242 · timeout: seconds that are given to a virtual machine to shutdown
243 itself. After this time, it gets powered off. Defaults to 120
244 seconds.
245
246 It is advisable configure virtual machines so they shut down easily if
247 asked to. Just a few hints:
248
249 · install ACPI services
250
251 · Set default action for power off to shutdown, do not ask the user
252
253 done_recently
254 Returns wether this command has been requested successfully recently.
255
256 if ($request->done_recently($seconds)) {
257 ... skips work ...
258 } else {
259 ... does work ...
260 }
261
262 This method is used for commands that take long to run as garbage
263 collection.
264
266 Hey! The above document had some coding errors, which are explained
267 below:
268
269 Around line 1202:
270 You forgot a '=back' before '=head2'
271
272
273
274perl v5.28.1 2019-04-12 Ravada::Request(3)