diff options
author | Cole Robinson <crobinso@redhat.com> | 2020-09-10 13:52:07 -0400 |
---|---|---|
committer | Cole Robinson <crobinso@redhat.com> | 2020-09-11 15:04:37 -0400 |
commit | 8560138cf2269b8bc8f3cf657ed282a2ac9d499f (patch) | |
tree | 47f158a75bc7bdad295aaaee13fb1a425898e0f5 /man | |
parent | aa8572048bdc4947520de728fe2a3fec3b61815f (diff) | |
download | virt-manager-8560138cf2269b8bc8f3cf657ed282a2ac9d499f.tar.gz |
cli: Add --xml xpath option for virt-install and virt-xml
The --xml option allows users to request raw XML edits to virt-install
or virt-xml generated XML. This gives users a bit of a workaround
incase we don't have proper support for some XML property. The --xml
option can gain more features in the future if it makes sense, like
setting XML namespaces for example.
Basic usage is like: virt-install --xml ./@foo=bar ...
Which will change the generated <domain> XML to have
<domain foo='bar' ...
virt-xml works similarly. It can only be combined with --edit currently.
This only works with xpaths rooted against the entire document.
Signed-off-by: Cole Robinson <crobinso@redhat.com>
Diffstat (limited to 'man')
-rw-r--r-- | man/virt-install.pod | 42 | ||||
-rw-r--r-- | man/virt-xml.pod | 2 |
2 files changed, 44 insertions, 0 deletions
diff --git a/man/virt-install.pod b/man/virt-install.pod index 7e90f89a..5153e5a0 100644 --- a/man/virt-install.pod +++ b/man/virt-install.pod @@ -170,6 +170,48 @@ Use --sysinfo=? to see a list of all available sub options. Complete details at L<https://libvirt.org/formatdomain.html#elementsSysinfo> and L<https://libvirt.org/formatdomain.html#elementsOSBIOS> for B<smbios> XML element. +=item B<--xml> ARGS + +Make direct edits to the generated XML using XPath syntax. Take an example like + + virt-install --xml ./@foo=bar --xml ./newelement/subelement=1 + +This will alter the generated XML to contain: + + <domain foo='bar' ...> + ... + <newelement> + <subelement>1</subelement> + </newelement> + </domain> + +The --xml option has 4 sub options: + +=over 2 + +=item --xml xpath.set=XPATH[=VALUE] + +The default behavior if no explicit suboption is set. Takes the form XPATH=VALUE +unless paired with B<xpath.value>. See below for how value is interpreted. + +=item --xml xpath.value=VALUE + +B<xpath.set> will be interpreted only as the XPath string, and B<xpath.value> will +be used as the value to set. May help sidestep problems if the string you need to +set contains a '=' equals sign. + +If value is empty, it's treated as unsetting that particular node. + +=item --xml xpath.create=XPATH + +Create the node as an empty element. Needed for boolean elements like <readonly/> + +=item --xml xpath.delete=XPATH + +Delete the entire node specified by the xpath, and all its children + +=back + =item B<--qemu-commandline> ARGS Pass options directly to the qemu emulator. Only works for the libvirt qemu driver. The option can take a string of arguments, for example: diff --git a/man/virt-xml.pod b/man/virt-xml.pod index 0aaa63d4..12f9a7b9 100644 --- a/man/virt-xml.pod +++ b/man/virt-xml.pod @@ -240,6 +240,8 @@ variants. =item B<--sysinfo> +=item B<--xml> + =item B<--qemu-commandline> =item B<--launchSecurity> |