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