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->force_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 force_reboot_domain
78 Requests to stop a domain now !
79
80 my $req = Ravada::Request->force_reboot_domain( name => 'name' , uid => $user->id );
81
82 reboot_domain
83 Requests to reboot a domain
84
85 my $req = Ravada::Request->reboot_domain( name => 'name' , uid => $user->id );
86 my $req = Ravada::Request->reboot_domain( name => 'name' , uid => $user->id
87 ,timeout => $timeout );
88
89 new_request
90 Creates a new request
91
92 $req = Ravada::Request->new_request(
93 start_domain
94 ,uid => $user->id
95 ,id_domain => $domain->id
96 );
97
98 status
99 Returns or sets the status of a request
100
101 $req->status('done');
102
103 my $status = $req->status();
104
105 at
106 Sets the time when the request will be scheduled
107
108 result
109 Returns the result of the request if any
110
111 my $result = $req->result;
112
113 command
114 Returns the requested command
115
116 args
117 Returns the requested command
118
119 my $command = $req->command;
120
121 args
122 Returns the arguments of a request or the value of one argument field
123
124 my $args = $request->args();
125 print $args->{name};
126
127 print $request->args('name');
128
129 arg
130 Sets or gets de value of an argument of a Request
131
132 defined_arg
133 Returns if an argument is defined
134
135 copy_screenshot
136 Request to copy a screenshot from a domain to another
137
138 refresh_vms
139 Refreshes the Virtual Mangers
140
141 set_base_vm
142 Enables a base in a Virtual Manager
143
144 remove_base_vm
145 Disables a base in a Virtual Manager
146
147 type
148 Returns the type of the request
149
150 count_requests
151 Returns the number of working requests of the same type
152
153 my $n = $request->working_requests();
154
155 requests_limit
156 Returns the limit of requests of a type.
157
158 domain_autostart
159 Sets the autostart flag on a domain
160
161 autostart_domain
162 Deprecated for domain_autostart
163
164 enforce_limits
165 Enforces virtual machine limits, ie: an user can only run one virtual
166 machine at a time, so the older ones are shut down.
167
168 my $req = Ravada::Request->enforce_limits(
169 timeout => $timeout
170 );
171
172 Arguments:
173
174 • timeout: seconds that are given to a virtual machine to shutdown
175 itself. After this time, it gets powered off. Defaults to 120
176 seconds.
177
178 It is advisable configure virtual machines so they shut down easily if
179 asked to. Just a few hints:
180
181 • install ACPI services
182
183 • Set default action for power off to shutdown, do not ask the user
184
185 refresh_machine
186 Refresh a machine information
187
188 done_recently
189 Returns wether this command has been requested successfully recently.
190
191 if ($request->done_recently($seconds)) {
192 ... skips work ...
193 } else {
194 ... does work ...
195 }
196
197 This method is used for commands that take long to run as garbage
198 collection.
199
200 stop
201 Stops a request killing the process.
202
203 $request->stop();
204
205 priority
206 Returns the priority of the request
207
208 requirements_done
209 Returns wether a request requirements have been fulfilled
210
211 ie when a request must execute after another request completes.
212
214 Hey! The above document had some coding errors, which are explained
215 below:
216
217 Around line 1239:
218 You forgot a '=back' before '=head2'
219
220
221
222perl v5.34.0 2021-10-03 Ravada::Request(3)