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 docs: Document libxl.conf location 2021-03-12 10:52:51 +01:00
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 docs: convert virt-host-validate man page from pod to rst 2019-12-11 14:28:41 +00:00
virt-login-shell.rst docs: use "::" instead of ".. code-block::" 2020-10-05 13:05:47 +01:00
virt-pki-query-dn.rst virt-pki-query-dn: Add manual page 2021-12-10 18:40:10 +01:00
virt-pki-validate.rst docs: convert virt-pki-validate man page from pod to rst 2019-12-11 14:28:41 +00:00
virt-qemu-run.rst virt-qemu-run: Improve manual page 2021-12-10 18:39:56 +01:00
virt-sanlock-cleanup.rst man: fix section of virt-sanlock-cleanup 2020-01-17 15:34:10 +01:00
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 docs: add manpage for virtbhyved 2021-01-15 19:08:00 +00:00
virtinterfaced.rst docs: add manpage for virtinterfaced 2021-01-15 19:08:00 +00:00
virtlockd.rst docs: don't hardcode an ancient version in manpage examples 2021-01-15 19:08:00 +00:00
virtlogd.rst docs: don't hardcode an ancient version in manpage examples 2021-01-15 19:08:00 +00:00
virtlxcd.rst docs: Document lxc.conf location 2021-03-12 10:52:41 +01:00
virtnetworkd.rst docs: add manpage for virtnetworkd 2021-01-15 19:08:00 +00:00
virtnodedevd.rst docs: add manpage for virtnodedevd 2021-01-15 19:08:00 +00:00
virtnwfilterd.rst docs: add manpage for virtnwfilterd 2021-01-15 19:08:00 +00:00
virtproxyd.rst Fix spelling 2021-04-15 15:42:21 +02:00
virtqemud.rst docs: Capitalize QEMU driver reference 2021-03-12 10:51:47 +01:00
virtsecretd.rst docs: add manpage for virtsecretd 2021-01-15 19:08:00 +00:00
virtstoraged.rst docs: add manpage for virtstoraged 2021-01-15 19:08:00 +00:00
virtvboxd.rst docs: add manpage for virtvboxd 2021-01-15 19:08:00 +00:00
virtvzd.rst docs: add manpage for virtvzd 2021-01-15 19:08:00 +00:00
virtxend.rst docs: Document libxl.conf location 2021-03-12 10:52:51 +01:00