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 screenshot_domain
109 Request the screenshot of a domain.
110
111 Arguments:
112
113 - optional filename , defaults to "storage_path/$id_domain.png"
114
115 Returns a Ravada::Request;
116
117 copy_screenshot
118 Request to copy a screenshot from a domain to another
119
120 refresh_vms
121 Refreshes the Virtual Mangers
122
123 set_base_vm
124 Enables a base in a Virtual Manager
125
126 remove_base_vm
127 Disables a base in a Virtual Manager
128
129 type
130 Returns the type of the request
131
132 working_requests
133 Returns the number of working requests of the same type
134
135 my $n = $request->working_requests();
136
137 requests_limit
138 Returns the limit of requests of a type.
139
140 domain_autostart
141 Sets the autostart flag on a domain
142
143 autostart_domain
144 Deprecated for domain_autostart
145
146 enforce_limits
147 Enforces virtual machine limits, ie: an user can only run one virtual
148 machine at a time, so the older ones are shut down.
149
150 my $req = Ravada::Request->enforce_limits(
151 timeout => $timeout
152 );
153
154 Arguments:
155
156 · timeout: seconds that are given to a virtual machine to shutdown
157 itself. After this time, it gets powered off. Defaults to 120
158 seconds.
159
160 It is advisable configure virtual machines so they shut down easily if
161 asked to. Just a few hints:
162
163 · install ACPI services
164
165 · Set default action for power off to shutdown, do not ask the user
166
167 refresh_machine
168 Refresh a machine information
169
170 done_recently
171 Returns wether this command has been requested successfully recently.
172
173 if ($request->done_recently($seconds)) {
174 ... skips work ...
175 } else {
176 ... does work ...
177 }
178
179 This method is used for commands that take long to run as garbage
180 collection.
181
183 Hey! The above document had some coding errors, which are explained
184 below:
185
186 Around line 1037:
187 You forgot a '=back' before '=head2'
188
189
190
191perl v5.30.0 2019-08-08 Ravada::Request(3)