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 set_base_vm
139 Enables a base in a Virtual Manager
140
141 remove_base_vm
142 Disables a base in a Virtual Manager
143
144 type
145 Returns the type of the request
146
147 count_requests
148 Returns the number of working requests of the same type
149
150 my $n = $request->working_requests();
151
152 requests_limit
153 Returns the limit of requests of a type.
154
155 domain_autostart
156 Sets the autostart flag on a domain
157
158 autostart_domain
159 Deprecated for domain_autostart
160
161 enforce_limits
162 Enforces virtual machine limits, ie: an user can only run one virtual
163 machine at a time, so the older ones are shut down.
164
165 my $req = Ravada::Request->enforce_limits(
166 timeout => $timeout
167 );
168
169 Arguments:
170
171 • timeout: seconds that are given to a virtual machine to shutdown
172 itself. After this time, it gets powered off. Defaults to 120
173 seconds.
174
175 It is advisable configure virtual machines so they shut down easily if
176 asked to. Just a few hints:
177
178 • install ACPI services
179
180 • Set default action for power off to shutdown, do not ask the user
181
182 refresh_machine
183 Refresh a machine information
184
185 done_recently
186 Returns wether this command has been requested successfully recently.
187
188 if ($request->done_recently($seconds)) {
189 ... skips work ...
190 } else {
191 ... does work ...
192 }
193
194 This method is used for commands that take long to run as garbage
195 collection.
196
197 stop
198 Stops a request killing the process.
199
200 $request->stop();
201
202 priority
203 Returns the priority of the request
204
205 requirements_done
206 Returns wether a request requirements have been fulfilled
207
208 ie when a request must execute after another request completes.
209
210 redo
211 Set the request to be executed again
212
214 Hey! The above document had some coding errors, which are explained
215 below:
216
217 Around line 1519:
218 You forgot a '=back' before '=head2'
219
220
221
222perl v5.38.0 2023-07-21 Ravada::Request(3)