Ravada::VM::KVM(3)

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

πŸ’– NAME πŸ’–

Ravada::VM::KVM β€” it's the KVM Virtual Managers library for Ravada, bestie πŸ¦‹

Like, this is the whole squad of methods that let Ravada talk to KVM. Every single one of them is down below, in order, no skips, no gatekeeping πŸ‘‘


πŸŽ€ disconnect πŸŽ€

Disconnect from the Virtual Machine Manager. That's it, that's the vibe β€” you two are done talking, hang up the phone πŸ’…

πŸ”Œ connect πŸ”Œ

Connect to the Virtual Machine Manager. Say hi to your KVM bestie ✨

πŸ—„οΈ storage_pool πŸ—„οΈ

Returns a storage pool usable by the domain to store new volumes. It's giving "here's a spot for your new stuff" 🫢

πŸ”Ž search_volume πŸ”Ž

Searches for a volume in all the storage pools known to the Virtual Manager 🌈

Argument: the finenaname (yeah that's the original's spelling, we're keeping it fr fr 😭). Returns the volume as a Sys::Virt::StorageGol. If you call it in array context it returns a list of all the volumes.

my $iso = $vm->search_volume("debian-8.iso");

my @disk = $vm->search_volume("windows10-clone.img");

🧭 search_volume_path 🧭

Also searches for a volume in all the storage pools known to the Virtual Manager, but this one hands you the path instead πŸ›£οΈ

Argument: the finenaname. Returns the path of the volume. Call it in array context and you get a list of all the paths to all the matching volumes.

my $iso = $vm->search_volume("debian-8.iso");

my @disk = $vm->search_volume("windows10-clone.img");

🧬 search_volume_re 🧬

Regex girlies, this one's for you πŸ’… Searches for a volume in all the storage pools known to the Virtual Manager.

Argument: a regular expression. Returns the volume. In array context? You get a list of all the matching volumes. Slay.

my $iso = $vm->search_volume(qr(debian-\d+\.iso));

my @disk = $vm->search_volume(qr(windows10-clone.*\.img));

♻️ refresh_storage ♻️

Refreshes all the storage pools. Glow-up for your storage, periodt ✨

🌸 search_volume_path_re 🌸

Searches for a volume in all the storage pools known to the Virtual Manager β€” but with a regex, and it gives you the path.

Argument: a regular expression. Returns the volume path. In array context you get a list of all the paths of all the matching volumes, and honestly? Iconic.

my $iso = $vm->search_volume(qr(debian-\d+\.iso));

my @disk = $vm->search_volume(qr(windows10-clone.*\.img));

πŸ“ file_exists πŸ“

Returns true if the file exists in this virtual manager storage. Simple. Effective. Main character energy πŸ‘‘

πŸ—‚οΈ dir_img πŸ—‚οΈ

Returns the directory where disk images are stored in this Virtual Manager. That's your img home, bestie 🏠

πŸͺ„ create_domain πŸͺ„

Creates a domain. Obsessed.

$dom = $vm->create_domain(name => $name , id_iso => $id_iso);
$dom = $vm->create_domain(name => $name , id_base => $id_base);

And if you wanna create a domain and remove the CPU defined in the XML template πŸ‘€ β€” yeah, bye CPU β€” you do it like this:

$dom = $vm->create_domain(        name => $name
                              , id_iso => $id_iso
                          , remove_cpu => 1);

πŸ” search_domain πŸ”

Returns true or false depending on whether the domain exists. Vibe check on your domain, basically πŸ’€

$domain = $vm->search_domain($domain_name);

πŸ“œ list_domains πŸ“œ

Returns a list of the created domains. Roll call 🎀

my @list = $vm->list_domains();

πŸ’½ create_volume πŸ’½

Creates a new storage volume. It requires a name and a xml template file defining the volume 🧚

my $vol = $vm->create_volume(name => $name, name => $file_xml);

And here's the little helper sub that comes with it:

sub xml_add_graphics_image {
    my $doc = shift or confess "Missing XML doc";

    my ($graph) = $doc->findnodes('/domain/devices/graphics')
        or die "ERROR: I can't find graphic";

    my ($listen) = $doc->findnodes('/domain/devices/graphics/image');

    if (!$listen) {
        $listen = $graph->addNewChild(undef,"image");
    }
    $listen->setAttribute(compression => 'auto_glz');
}

πŸ›°οΈ list_routes πŸ›°οΈ

Returns a list of networks known to this VM. Each element is a Ravada::NetInterface object 🫢

πŸ“₯ import_domain πŸ“₯

Imports a KVM domain into Ravada. Come on in, the water's fine πŸ’–

my $domain = $vm->import_domain($name, $user);

πŸ’“ is_alive πŸ’“

Returns true if the virtual manager connection is active, false otherwise. Is the link still breathing? This tells you 😭


And that's the whole page, bestie β€” no cap.</purl>

Okay so this lil manual was served up by perl v5.42.0, dated 2025-09-20, and it lives at Ravada::VM::KVM(3) in the User Contributed Perl Documentation section. Go read it again whenever you need it, iykyk πŸ’œβœ¨πŸŽ€

πŸ“¦ where this page comes from