module

Krikri::PluginHelpers::VirshNet

VirshNet - command construction and output parsing for community.libvirt.virt_net (see plugins/virt_net.cr). Pure string plumbing mirroring the real module's LibvirtConnection/VirtNetwork helpers, unit-testable without a libvirt daemon.

Class methods

net_update_command(uri : String, name : String, xml : String, live : Bool) : Array(String) | Nil

modify's virsh net-update mapping for a <host/> DHCP entry - the one section the real module implements (ADD_LAST / IP_DHCP_HOST), applied live+config when the network is active and config-only when it isn't.

Source
parse_dhcp_hosts(xml : String) : Array(DhcpHost)
Source
parse_domain(xml : String) : String | Nil
Source
parse_forward_mode(xml : String) : String | Nil

forward_mode / domain / macaddress come from the network's XML (the real module xpath-scans XMLDesc) - regex equivalents over virsh net-dumpxml output, nil when the element is absent (matching the real module's "skip the fact" behavior).

Source
parse_macaddress(xml : String) : String | Nil
Source
parse_net_info(output : String) : NamedTuple(active: Bool | Nil, autostart: Bool | Nil, persistent: Bool | Nil, bridge: String | Nil)

Parses virsh net-info <name> output. Active/Autostart/ Persistent are yes/no; Bridge can be legitimately absent (a network with no bridge yet) and is nil then.

Source
virsh(uri : String, subcommand : String, *args : String) : Array(String)

All command builders take the connection URI (the real module always opens its own connection with it, default qemu:///system - same default virsh itself uses).

Source

Nested types