unix:scripts:libvirt
Differences
This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
unix:scripts:libvirt [2024/09/20 20:32] – created rodolico | unix:scripts:libvirt [2024/09/20 21:23] (current) – rodolico | ||
---|---|---|---|
Line 4: | Line 4: | ||
This little one liner grabs the lines that define the vnc ports used by all defined on a node (hypervisor) and returns them as a tab delimited string. | This little one liner grabs the lines that define the vnc ports used by all defined on a node (hypervisor) and returns them as a tab delimited string. | ||
+ | |||
+ | ==== Code ==== | ||
<code bash> | <code bash> | ||
Line 22: | Line 24: | ||
libvirt (virsh) stores it's domain (virtual) definitions in / | libvirt (virsh) stores it's domain (virtual) definitions in / | ||
< | < | ||
- | /media/shared/havirt/conf/ | + | /etc/libvirt/qemu/ |
</ | </ | ||
We then pass those lines to a Perl one liner which grabs the filename (without the .xml) and the port, then prints them to STDOUT, tab separated. Using the -n flag to perl turns the one liner into a filter, which will run the code on all lines received via STDIN. For the above line, the following is sent to STDOUT | We then pass those lines to a Perl one liner which grabs the filename (without the .xml) and the port, then prints them to STDOUT, tab separated. Using the -n flag to perl turns the one liner into a filter, which will run the code on all lines received via STDIN. For the above line, the following is sent to STDOUT | ||
< | < | ||
+ | |||
+ | ==== Caveats ==== | ||
+ | |||
+ | * If there is only one domain defined, grep does not return the filename, so the system breaks. | ||
+ | * This is totally dependent on how libvirt stores the data; path, key and whether the key is on the same line. Any changes to the libvirt storage will break the script. | ||
+ | * We use [[https:// |
unix/scripts/libvirt.1726882376.txt.gz · Last modified: 2024/09/20 20:32 by rodolico