libvirt/docs/manpages
Daniel P. Berrangé 8603b3d76c tools: add '--xpath EXPRESSION --wrap' args to all dumpxml commands
While you can chain the virsh output up to a later 'xmllint' or 'xpath'
command, integrating it into virsh avoids needs for installing extra
binaries which we've often found to be missing on production installs
of libvirt. It also gives better response if the initial virsh command
hits an error, as you don't get an aborted pipeline.

    $ virsh pool-dumpxml --xpath //permissions default
    <permissions>
      <mode>0711</mode>
      <owner>1000</owner>
      <group>1000</group>
      <label>unconfined_u:object_r:svirt_home_t:s0</label>
    </permissions>

If multiple nodes match, they are emitted individually:

    $ virsh dumpxml --xpath '//devices/*/address[@type="pci"]' --wrap demo
    <address type="pci" domain="0x0000" bus="0x05" slot="0x00" function="0x0"/>
    <address type="pci" domain="0x0000" bus="0x03" slot="0x00" function="0x0"/>
    ...snip...
    <address type="pci" domain="0x0000" bus="0x00" slot="0x02" function="0x0" multifunction="on"/>
    <address type="pci" domain="0x0000" bus="0x07" slot="0x00" function="0x0"/>

but if intending to post-process the output further, the results
can be wrapped in a parent node

    $ virsh dumpxml --xpath '//devices/*/address[@type="pci"]' --wrap demo
    <nodes>
      <address type="pci" domain="0x0000" bus="0x05" slot="0x00" function="0x0"/>
      <address type="pci" domain="0x0000" bus="0x03" slot="0x00" function="0x0"/>
      ...snip...
      <address type="pci" domain="0x0000" bus="0x00" slot="0x02" function="0x0" multifunction="on"/>
      <address type="pci" domain="0x0000" bus="0x07" slot="0x00" function="0x0"/>
    </nodes>

Fixes https://gitlab.com/libvirt/libvirt/-/issues/244
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2022-06-20 10:40:45 +01:00
..
index.rst docs: Add man page for libvirt-guests 2022-01-17 18:20:55 +01:00
libvirt-guests.rst manpages: libvirt-guests: Fix typos 2022-01-19 14:52:27 +01:00
libvirtd.rst
meson.build docs: Simplify passing of 'href_base' XSL variable 2022-04-12 12:53:32 +02:00
virsh.rst tools: add '--xpath EXPRESSION --wrap' args to all dumpxml commands 2022-06-20 10:40:45 +01:00
virt-admin.rst man: virt-admin: Mention monolithic daemon URIs 2022-01-21 13:40:11 +01:00
virt-host-validate.rst
virt-login-shell.rst
virt-pki-query-dn.rst virt-pki-query-dn: Add manual page 2021-12-10 18:40:10 +01:00
virt-pki-validate.rst
virt-qemu-run.rst virt-qemu-run: Improve manual page 2021-12-10 18:39:56 +01:00
virt-sanlock-cleanup.rst
virt-ssh-helper.rst virt-ssh-helper: Move manual page to section 8 2022-01-13 16:07:56 +01:00
virt-xml-validate.rst virt-xml-validate: Add more XML formats support 2022-05-13 17:15:24 +02:00
virtbhyved.rst
virtinterfaced.rst
virtlockd.rst
virtlogd.rst
virtlxcd.rst
virtnetworkd.rst
virtnodedevd.rst
virtnwfilterd.rst
virtproxyd.rst
virtqemud.rst
virtsecretd.rst
virtstoraged.rst
virtvboxd.rst
virtvzd.rst
virtxend.rst