Ravada::VM(3)

πŸ“¦
version 2.4.1 Β· 2 versions
, in fedora 43

πŸ’– Ravada::VM πŸ’–

okay so bestie, welcome to the Ravada::VM page πŸ’… this is the Virtual Managers library for Ravada, and it lives in the User Contributed Perl Documentation part of the manual-verse. it's giving backend queen energy, and we are going through every single thing on it, no skips, no cap. grab a strawberry πŸ“ and let's go.


🌸 Constructors 🌸

open

Opens a Virtual Machine Manager (VM) ✨

Arguments: id of the VM


πŸ’« Methods πŸ’«

timeout_down_cache

Returns the time in seconds that nodes get kept cached down for. like how long we let them nap 😴

domain_remove

Removes the domain. Returns nothing β€” literally nothing, it's a void, don't come looking for a return value πŸ™ˆ

name

Returns the name of this Virtual Machine Manager 🏷️

my $name = $vm->name();

search_domain_by_id

Returns a domain, but you find it by its id πŸ”

$domain = $vm->search_domain_by_id($id);

ip

Returns the external IP for this VM 🌐

nat_ip

Returns the IP of the VM when it's chilling in a NAT environment

display_ip

Returns the display IP of the Virtual Manager πŸ–₯️

listen_ip

Returns the IP where virtual machines must be bound to πŸ“Œ

Arguments: optional remote ip

id

Returns the id value of the domain. This id is used in the database tables and is not related to the virtual machine engine. so like, it's a database thing, not a hypervisor thing, keep them separate bestie πŸ’€

default_storage_pool_name

Set the default storage pool name for this Virtual Machine Manager πŸ—„οΈ

$vm->default_storage_pool_name('default');

base_storage_pool

Set the storage pool for bases in this Virtual Machine Manager 🧺

$vm->base_storage_pool('pool2');

clone_storage_pool

Set the storage pool for clones in this Virtual Machine Manager 🧬

$vm->clone_storage_pool('pool3');

dir_clone

Returns the directory where clone images are stored in this Virtual Manager πŸ“‚

dir_base

Returns the directory where base images are stored in this Virtual Manager πŸ“

min_free_memory

Returns the minimum free memory necessary to start a new virtual machine 🧠

max_load

Returns the maximum cpu load that the host can handle. she has limits, respect them πŸ”₯

active_limit

Returns the value of active_limit in the BBDD

list_drivers

Lists the drivers available for this Virtual Machine Manager πŸš—

Arguments: optional driver type

Returns a list of strings with the names of the drivers.

my @drivers = $vm->list_drivers();
my @drivers = $vm->list_drivers('image');

is_local

Returns whether this virtual manager is on the local host 🏠

is_locked

This node has requests running or waiting to be run. she's busy, she's booked, she's in her locked era πŸ”’

list_nodes

Returns a list of virtual machine manager nodes of the same type as this one.

my @nodes = $self->list_nodes();

list_bases

Returns a list of domains that are base in this node 🧱

ping

Returns if the virtual manager connection is available. are you there? hello? πŸ‘‹

list_virtual_networks_data

Returns a list of information of the virtual networks in this virtual machines manager (VM) from the database πŸ•ΈοΈ

Arguments:

Pass either the VM object or an id_vm

is_active

Returns if the domain is active. The active state is cached for some seconds, so heads up. Pass an optional true value to perform a real check if you want the truth-truth πŸ’…

Arguments: optional force mode

if ($node->is_active) {
}

if ($node->is_active(1)) {
}

enabled

Returns if the domain is enabled βœ…

public_ip

Returns the public IP of the virtual manager if defined

remove

Remove the virtual machine manager. bye bestie πŸ‘‹πŸ’”

run_command

Run a command on the node πŸƒ

my ($out,$err) = $self->run_command_cache("ls");

run_command_cache

Run a command on the node πŸƒβ€β™€οΈ

my ($out,$err) = $self->run_command_cache("ls");

run_command_nowait

Run a command on the node, but don't wait for it πŸƒβ€β™€οΈπŸ’¨

$self->run_command_nowait("/sbin/poweroff");

warn "1 ".localtime(time) if $self->_data('hostname') =~ /192.168.122./;
my $chan = $self->_ssh_channel() or die "ERROR: No SSH channel to host ".$self->host;
warn "2 ".localtime(time) if $self->_data('hostname') =~ /192.168.122./;

my $command = join(" ",@command);
$chan->exec($command);# or $self->{_ssh}->die_with_error;

$chan->send_eof();

return;

write_file

Writes a file to the node ✍️

$self->write_file("filename.extension", $contents);

read_file

Reads a file in memory from the storage of the virtual manager πŸ§ πŸ“–

create_iptables_chain

Creates a new chain in the system iptables ⛓️

iptables

Runs an iptables command in the virtual manager πŸ”₯

Example:

$vm->iptables( A => 'INPUT', p => 22, j => 'ACCEPT');

iptables_unique

Runs an iptables command in the virtual manager only if it wasn't already there. no duplicates, we don't do repeats 🚫

Example:

$vm->iptables_unique( A => 'INPUT', p => 22, j => 'ACCEPT');

iptables_list

Returns the list of the system iptables πŸ“‹

balance_vm

Returns a Virtual Manager from all the nodes to run a virtual machine. When the optional base argument is passed, it returns a node from the list of VMs where the base is prepared. it's the matchmaker of nodes πŸ’˜

Arguments

  • uid
  • base [optional]
  • id_domain [optional]

shutdown_domains

Shuts down all the virtual machines in the node πŸ›‘

shared_storage

Returns true if there is shared storage among the nodes 🀝

Arguments:

  • node
  • directory

copy_file_storage

Copies a volume file to another storage πŸ“¦βž‘οΈπŸ“¦

Args:

  • file
  • storage

start

Starts the node πŸš€

shutdown

Shuts down the node πŸ›‘

list_network_interfaces

Returns a list of all the known interfaces πŸ•ΈοΈ

Argument: type ( nat or bridge )

add_host_device

Add a new host device configuration to this Virtual Machines Manager from a previous template 🧩

$vm->add_host_device(template => 'name');

list_host_devices

List all the configured host devices in this node πŸ”Œ

list_machine_types

Placeholder for list machine types that returns an empty list by default. It can be overloaded in each backend module. so like, it's a vibe placeholder, fill it in yourself bestie πŸŽ€

dir_backup

Directory where virtual machines backup will be stored. It can be changed from the frontend nodes page management πŸ—‚οΈ

list_unused_volumes

Returns a list of unused volume files πŸ‘»

can_list_cpu_models

Default for Virtual Managers that can list cpu models is 0

list_files

List files in a Virtual Manager πŸ“„

Arguments: dir , optional regexp pattern


🚨 POD ERRORS 🚨

Hey! The above document had some coding errors, which are explained below:

Around line 2374:

You forgot a '=back' before '=head2'
not the pod parser catching strays 😭 it's literally just a missing =back bestie, the docs are fine, breathe 🫢

and that's the whole page, you ate it, you understood it, iconic behavior honestly πŸ‘‘

this lil masterpiece is perl v5.42.0, dated 2025-09-20 β€” remember the date, it's giving vintage πŸ’…βœ¨πŸ¦‹

πŸ“¦ where this page comes from