1Ravada::VM(3)         User Contributed Perl Documentation        Ravada::VM(3)
2
3
4

NAME

6       Ravada::VM - Virtual Managers library for Ravada
7

Constructors

9   open
10       Opens a Virtual Machine Manager (VM)
11
12       Arguments: id of the VM
13

Methods

15   domain_remove
16       Remove the domain. Returns nothing.
17
18   name
19       Returns the name of this Virtual Machine Manager
20
21           my $name = $vm->name();
22
23   search_domain_by_id
24       Returns a domain searching by its id
25
26           $domain = $vm->search_domain_by_id($id);
27
28   ip
29       Returns the external IP this for this VM
30
31   nat_ip
32       Returns the IP of the VM when it is in a NAT environment
33
34   display_ip
35       Returns the display IP of the Virtual Manager
36
37   listen_ip
38       Returns the IP where virtual machines must be bound to
39
40       Arguments: optional remote ip
41
42   id
43       Returns the id value of the domain. This id is used in the database
44       tables and is not related to the virtual machine engine.
45
46   default_storage_pool_name
47       Set the default storage pool name for this Virtual Machine Manager
48
49           $vm->default_storage_pool_name('default');
50
51   base_storage_pool
52       Set the storage pool for bases in this Virtual Machine Manager
53
54           $vm->base_storage_pool('pool2');
55
56   clone_storage_pool
57       Set the storage pool for clones in this Virtual Machine Manager
58
59           $vm->clone_storage_pool('pool3');
60
61   min_free_memory
62       Returns the minimun free memory necessary to start a new virtual
63       machine
64
65   max_load
66       Returns the maximum cpu load that the host can handle.
67
68   active_limit
69       Returns the value of 'active_limit' in the BBDD
70
71   list_drivers
72       Lists the drivers available for this Virtual Machine Manager
73
74       Arguments: Optional driver type
75
76       Returns a list of strings with the nams of the drivers.
77
78           my @drivers = $vm->list_drivers();
79           my @drivers = $vm->list_drivers('image');
80
81   is_local
82       Returns wether this virtual manager is in the local host
83
84   is_locked
85       This node has requests running or waiting to be run
86
87   list_nodes
88       Returns a list of virtual machine manager nodes of the same type as
89       this.
90
91           my @nodes = $self->list_nodes();
92
93   list_bases
94       Returns a list of domains that are base in this node
95
96   ping
97       Returns if the virtual manager connection is available
98
99   is_active
100       Returns if the domain is active. The active state is cached for some
101       seconds.  Pass an optional true value to perform a real check.
102
103       Arguments: optional force mode
104
105           if ($node->is_active) {
106           }
107
108
109           if ($node->is_active(1)) {
110           }
111
112   enabled
113       Returns if the domain is enabled.
114
115   public_ip
116       Returns the public IP of the virtual manager if defined
117
118   remove
119       Remove the virtual machine manager.
120
121   run_command
122       Run a command on the node
123
124           my @ls = $self->run_command("ls");
125
126   run_command_nowait
127       Run a command on the node
128
129           $self->run_command_nowait("/sbin/poweroff");
130
131           my $chan = $self->_ssh_channel() or die "ERROR: No SSH channel to host ".$self->host;
132
133           my $command = join(" ",@command);
134           $chan->exec($command);# or $self->{_ssh}->die_with_error;
135
136           $chan->send_eof();
137
138           return;
139
140   write_file
141       Writes a file to the node
142
143           $self->write_file("filename.extension", $contents);
144
145   read_file
146       Reads a file in memory from the storage of the virtual manager
147
148   remove_file
149       Removes a file from the storage of the virtual manager
150
151   create_iptables_chain
152       Creates a new chain in the system iptables
153
154   iptables
155       Runs an iptables command in the virtual manager
156
157       Example:
158
159           $vm->iptables( A => 'INPUT', p => 22, j => 'ACCEPT');
160
161   iptables_unique
162       Runs an iptables command in the virtual manager only if it wasn't
163       already there
164
165       Example:
166
167           $vm->iptables_unique( A => 'INPUT', p => 22, j => 'ACCEPT');
168
169   iptables_list
170       Returns the list of the system iptables
171
172   balance_vm
173       Returns a Virtual Manager from all the nodes to run a virtual machine.
174       When the optional base argument is passed it returns a node from the
175       list of VMs where the base is prepared.
176
177       Arguments
178
179       uid
180       base [optional]
181       id_domain [optional]
182
183   shutdown_domains
184       Shuts down all the virtual machines in the node
185
186   shared_storage
187       Returns true if there is shared storage among to nodes
188
189       Arguments:
190
191       •   node
192
193       •   directory
194
195   start
196       Starts the node
197
198   shutdown
199       Shuts down the node
200
201   list_network_interfaces
202       Returns a list of all the known interface
203
204       Argument: type ( nat or bridge )
205
206   add_host_device
207       Add a new host device configuration to this Virtual Machines Manager
208       from a previous template
209
210          $vm->add_host_device(template => 'name');
211
212   list_host_devices
213       List all the configured host devices in this node
214
215   list_machine_types
216       Placeholder for list machine types that returns an empty list by
217       default.  It can be overloaded in each backend module.
218
219   dir_backup
220       Directory where virtual machines backup will be stored. It can be
221       changed from the frontend nodes page management.
222

POD ERRORS

224       Hey! The above document had some coding errors, which are explained
225       below:
226
227       Around line 1833:
228           You forgot a '=back' before '=head2'
229
230
231
232perl v5.36.0                      2023-03-19                     Ravada::VM(3)
Impressum