libvirt/docs/schemas/domaincommon.rng

5015 lines
129 KiB
Plaintext
Raw Normal View History

<?xml version="1.0"?>
<grammar xmlns="http://relaxng.org/ns/structure/1.0" datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
<!-- domain-related definitions used in multiple grammars -->
<include href='basictypes.rng'/>
<include href='storagecommon.rng'/>
<include href='networkcommon.rng'/>
<!--
description and title element, may be placed anywhere under the root
-->
<define name="description">
<element name="description">
<text/>
</element>
</define>
<define name="title">
<element name="title">
<data type="string">
<!-- Use literal newline instead of \n for bug in libxml2 2.7.6 -->
<param name="pattern">[^
]+</param>
</data>
</element>
</define>
<!--
We handle only document defining a domain
-->
<define name="domain">
<element name="domain">
<ref name="hvs"/>
<ref name="ids"/>
<interleave>
<optional>
<ref name="title"/>
</optional>
<optional>
<ref name="description"/>
</optional>
<optional>
<ref name="metadata"/>
</optional>
<optional>
<ref name="cpu"/>
</optional>
<optional>
<ref name="sysinfo"/>
</optional>
<ref name="os"/>
<ref name="clock"/>
<ref name="resources"/>
<ref name="features"/>
<ref name="events"/>
<optional>
<ref name="pm"/>
</optional>
<optional>
<ref name="idmap"/>
</optional>
<optional>
<ref name="devices"/>
</optional>
<zeroOrMore>
<ref name="seclabel"/>
</zeroOrMore>
<optional>
<ref name='qemucmdline'/>
</optional>
</interleave>
</element>
</define>
<define name="seclabel">
<element name="seclabel">
<optional>
<attribute name='model'>
<text/>
</attribute>
</optional>
<choice>
<group>
<!-- with dynamic label (default), relabel must be yes, baselabel
is optional, and label and imagelabel are output-only -->
<optional>
<attribute name='type'>
<value>dynamic</value>
</attribute>
</optional>
<optional>
<attribute name='relabel'>
<value>yes</value>
</attribute>
</optional>
<interleave>
<optional>
<element name='label'>
<text/>
</element>
</optional>
<optional>
<element name='imagelabel'>
<text/>
</element>
</optional>
<optional>
<element name='baselabel'>
<text/>
</element>
</optional>
</interleave>
</group>
<group>
<!-- with static label, relabel can be either format (default
no), label is required, imagelabel is output-only, and no
baselabel is present -->
<attribute name='type'>
<value>static</value>
</attribute>
<optional>
<attribute name='relabel'>
<ref name="virYesNo"/>
</attribute>
</optional>
<interleave>
<element name='label'>
<text/>
</element>
<optional>
<element name='imagelabel'>
<text/>
</element>
</optional>
</interleave>
</group>
<group>
<!-- with none, relabel must be no if present -->
<attribute name='type'>
<value>none</value>
</attribute>
<optional>
<attribute name='relabel'>
<value>no</value>
</attribute>
</optional>
</group>
</choice>
</element>
</define>
seclabel: extend XML to allow per-disk label overrides When doing security relabeling, there are cases where a per-file override might be appropriate. For example, with a static label and relabeling, it might be appropriate to skip relabeling on a particular disk, where the backing file lives on NFS that lacks the ability to track labeling. Or with dynamic labeling, it might be appropriate to use a custom (non-dynamic) label for a disk specifically intended to be shared across domains. The new XML resembles the top-level <seclabel>, but with fewer options (basically relabel='no', or <label>text</label>): <domain ...> ... <devices> <disk type='file' device='disk'> <source file='/path/to/image1'> <seclabel relabel='no'/> <!-- override for just this disk --> </source> ... </disk> <disk type='file' device='disk'> <source file='/path/to/image1'> <seclabel relabel='yes'> <!-- override for just this disk --> <label>system_u:object_r:shared_content_t:s0</label> </seclabel> </source> ... </disk> ... </devices> <seclabel type='dynamic' model='selinux'> <baselabel>text</baselabel> <!-- used for all devices without override --> </seclabel> </domain> This patch only introduces the XML and documentation; future patches will actually parse and make use of it. The intent is that we can further extend things as needed, adding a per-device <seclabel> in more places (such as the source of a console device), and possibly allowing a <baselabel> instead of <label> for labeling where we want to reuse the cNNN,cNNN pair of a dynamically labeled domain but a different base label. First suggested by Daniel P. Berrange here: https://www.redhat.com/archives/libvir-list/2011-December/msg00258.html * docs/schemas/domaincommon.rng (devSeclabel): New define. (disk): Use it. * docs/formatdomain.html.in (elementsDisks, seclabel): Document the new XML. * tests/qemuxml2argvdata/qemuxml2argv-seclabel-dynamic-override.xml: New test, to validate RNG.
2011-12-23 00:47:49 +00:00
<define name="devSeclabel">
<element name="seclabel">
<!-- A per-device seclabel override is more limited, either
selinux: distinguish failure to label from request to avoid label https://bugzilla.redhat.com/show_bug.cgi?id=924153 Commit 904e05a2 (v0.9.9) added a per-<disk> seclabel element with an attribute relabel='no' in order to try and minimize the impact of shutdown delays when an NFS server disappears. The idea was that if a disk is on NFS and can't be labeled in the first place, there is no need to attempt the (no-op) relabel on domain shutdown. Unfortunately, the way this was implemented was by modifying the domain XML so that the optimization would survive libvirtd restart, but in a way that is indistinguishable from an explicit user setting. Furthermore, once the setting is turned on, libvirt avoids attempts at labeling, even for operations like snapshot or blockcopy where the chain is being extended or pivoted onto non-NFS, where SELinux labeling is once again possible. As a result, it was impossible to do a blockcopy to pivot from an NFS image file onto a local file. The solution is to separate the semantics of a chain that must not be labeled (which the user can set even on persistent domains) vs. the optimization of not attempting a relabel on cleanup (a live-only annotation), and using only the user's explicit notation rather than the optimization as the decision on whether to skip a label attempt in the first place. When upgrading an older libvirtd to a newer, an NFS volume will still attempt the relabel; but as the avoidance of a relabel was only an optimization, this shouldn't cause any problems. In the ideal future, libvirt will eventually have XML describing EVERY file in the backing chain, with each file having a separate <seclabel> element. At that point, libvirt will be able to track more closely which files need a relabel attempt at shutdown. But until we reach that point, the single <seclabel> for the entire <disk> chain is treated as a hint - when a chain has only one file, then we know it is accurate; but if the chain has more than one file, we have to attempt relabel in spite of the attribute, in case part of the chain is local and SELinux mattered for that portion of the chain. * src/conf/domain_conf.h (_virSecurityDeviceLabelDef): Add new member. * src/conf/domain_conf.c (virSecurityDeviceLabelDefParseXML): Parse it, for live images only. (virSecurityDeviceLabelDefFormat): Output it. (virDomainDiskDefParseXML, virDomainChrSourceDefParseXML) (virDomainDiskSourceDefFormat, virDomainChrDefFormat) (virDomainDiskDefFormat): Pass flags on through. * src/security/security_selinux.c (virSecuritySELinuxRestoreSecurityImageLabelInt): Honor labelskip when possible. (virSecuritySELinuxSetSecurityFileLabel): Set labelskip, not norelabel, if labeling fails. (virSecuritySELinuxSetFileconHelper): Fix indentation. * docs/formatdomain.html.in (seclabel): Document new xml. * docs/schemas/domaincommon.rng (devSeclabel): Allow it in RNG. * tests/qemuxml2argvdata/qemuxml2argv-seclabel-*-labelskip.xml: * tests/qemuxml2argvdata/qemuxml2argv-seclabel-*-labelskip.args: * tests/qemuxml2xmloutdata/qemuxml2xmlout-seclabel-*-labelskip.xml: New test files. * tests/qemuxml2argvtest.c (mymain): Run the new tests. * tests/qemuxml2xmltest.c (mymain): Likewise. Signed-off-by: Eric Blake <eblake@redhat.com>
2013-08-12 15:15:42 +00:00
relabel=no or a <label> must be present on input;
output also can include labelskip=yes. -->
<optional>
<attribute name='model'>
<text/>
</attribute>
</optional>
seclabel: extend XML to allow per-disk label overrides When doing security relabeling, there are cases where a per-file override might be appropriate. For example, with a static label and relabeling, it might be appropriate to skip relabeling on a particular disk, where the backing file lives on NFS that lacks the ability to track labeling. Or with dynamic labeling, it might be appropriate to use a custom (non-dynamic) label for a disk specifically intended to be shared across domains. The new XML resembles the top-level <seclabel>, but with fewer options (basically relabel='no', or <label>text</label>): <domain ...> ... <devices> <disk type='file' device='disk'> <source file='/path/to/image1'> <seclabel relabel='no'/> <!-- override for just this disk --> </source> ... </disk> <disk type='file' device='disk'> <source file='/path/to/image1'> <seclabel relabel='yes'> <!-- override for just this disk --> <label>system_u:object_r:shared_content_t:s0</label> </seclabel> </source> ... </disk> ... </devices> <seclabel type='dynamic' model='selinux'> <baselabel>text</baselabel> <!-- used for all devices without override --> </seclabel> </domain> This patch only introduces the XML and documentation; future patches will actually parse and make use of it. The intent is that we can further extend things as needed, adding a per-device <seclabel> in more places (such as the source of a console device), and possibly allowing a <baselabel> instead of <label> for labeling where we want to reuse the cNNN,cNNN pair of a dynamically labeled domain but a different base label. First suggested by Daniel P. Berrange here: https://www.redhat.com/archives/libvir-list/2011-December/msg00258.html * docs/schemas/domaincommon.rng (devSeclabel): New define. (disk): Use it. * docs/formatdomain.html.in (elementsDisks, seclabel): Document the new XML. * tests/qemuxml2argvdata/qemuxml2argv-seclabel-dynamic-override.xml: New test, to validate RNG.
2011-12-23 00:47:49 +00:00
<choice>
<group>
<attribute name='relabel'>
<value>no</value>
</attribute>
</group>
<group>
selinux: distinguish failure to label from request to avoid label https://bugzilla.redhat.com/show_bug.cgi?id=924153 Commit 904e05a2 (v0.9.9) added a per-<disk> seclabel element with an attribute relabel='no' in order to try and minimize the impact of shutdown delays when an NFS server disappears. The idea was that if a disk is on NFS and can't be labeled in the first place, there is no need to attempt the (no-op) relabel on domain shutdown. Unfortunately, the way this was implemented was by modifying the domain XML so that the optimization would survive libvirtd restart, but in a way that is indistinguishable from an explicit user setting. Furthermore, once the setting is turned on, libvirt avoids attempts at labeling, even for operations like snapshot or blockcopy where the chain is being extended or pivoted onto non-NFS, where SELinux labeling is once again possible. As a result, it was impossible to do a blockcopy to pivot from an NFS image file onto a local file. The solution is to separate the semantics of a chain that must not be labeled (which the user can set even on persistent domains) vs. the optimization of not attempting a relabel on cleanup (a live-only annotation), and using only the user's explicit notation rather than the optimization as the decision on whether to skip a label attempt in the first place. When upgrading an older libvirtd to a newer, an NFS volume will still attempt the relabel; but as the avoidance of a relabel was only an optimization, this shouldn't cause any problems. In the ideal future, libvirt will eventually have XML describing EVERY file in the backing chain, with each file having a separate <seclabel> element. At that point, libvirt will be able to track more closely which files need a relabel attempt at shutdown. But until we reach that point, the single <seclabel> for the entire <disk> chain is treated as a hint - when a chain has only one file, then we know it is accurate; but if the chain has more than one file, we have to attempt relabel in spite of the attribute, in case part of the chain is local and SELinux mattered for that portion of the chain. * src/conf/domain_conf.h (_virSecurityDeviceLabelDef): Add new member. * src/conf/domain_conf.c (virSecurityDeviceLabelDefParseXML): Parse it, for live images only. (virSecurityDeviceLabelDefFormat): Output it. (virDomainDiskDefParseXML, virDomainChrSourceDefParseXML) (virDomainDiskSourceDefFormat, virDomainChrDefFormat) (virDomainDiskDefFormat): Pass flags on through. * src/security/security_selinux.c (virSecuritySELinuxRestoreSecurityImageLabelInt): Honor labelskip when possible. (virSecuritySELinuxSetSecurityFileLabel): Set labelskip, not norelabel, if labeling fails. (virSecuritySELinuxSetFileconHelper): Fix indentation. * docs/formatdomain.html.in (seclabel): Document new xml. * docs/schemas/domaincommon.rng (devSeclabel): Allow it in RNG. * tests/qemuxml2argvdata/qemuxml2argv-seclabel-*-labelskip.xml: * tests/qemuxml2argvdata/qemuxml2argv-seclabel-*-labelskip.args: * tests/qemuxml2xmloutdata/qemuxml2xmlout-seclabel-*-labelskip.xml: New test files. * tests/qemuxml2argvtest.c (mymain): Run the new tests. * tests/qemuxml2xmltest.c (mymain): Likewise. Signed-off-by: Eric Blake <eblake@redhat.com>
2013-08-12 15:15:42 +00:00
<attribute name='labelskip'>
<value>yes</value>
</attribute>
</group>
<group>
seclabel: extend XML to allow per-disk label overrides When doing security relabeling, there are cases where a per-file override might be appropriate. For example, with a static label and relabeling, it might be appropriate to skip relabeling on a particular disk, where the backing file lives on NFS that lacks the ability to track labeling. Or with dynamic labeling, it might be appropriate to use a custom (non-dynamic) label for a disk specifically intended to be shared across domains. The new XML resembles the top-level <seclabel>, but with fewer options (basically relabel='no', or <label>text</label>): <domain ...> ... <devices> <disk type='file' device='disk'> <source file='/path/to/image1'> <seclabel relabel='no'/> <!-- override for just this disk --> </source> ... </disk> <disk type='file' device='disk'> <source file='/path/to/image1'> <seclabel relabel='yes'> <!-- override for just this disk --> <label>system_u:object_r:shared_content_t:s0</label> </seclabel> </source> ... </disk> ... </devices> <seclabel type='dynamic' model='selinux'> <baselabel>text</baselabel> <!-- used for all devices without override --> </seclabel> </domain> This patch only introduces the XML and documentation; future patches will actually parse and make use of it. The intent is that we can further extend things as needed, adding a per-device <seclabel> in more places (such as the source of a console device), and possibly allowing a <baselabel> instead of <label> for labeling where we want to reuse the cNNN,cNNN pair of a dynamically labeled domain but a different base label. First suggested by Daniel P. Berrange here: https://www.redhat.com/archives/libvir-list/2011-December/msg00258.html * docs/schemas/domaincommon.rng (devSeclabel): New define. (disk): Use it. * docs/formatdomain.html.in (elementsDisks, seclabel): Document the new XML. * tests/qemuxml2argvdata/qemuxml2argv-seclabel-dynamic-override.xml: New test, to validate RNG.
2011-12-23 00:47:49 +00:00
<optional>
<attribute name='relabel'>
<value>yes</value>
</attribute>
</optional>
selinux: distinguish failure to label from request to avoid label https://bugzilla.redhat.com/show_bug.cgi?id=924153 Commit 904e05a2 (v0.9.9) added a per-<disk> seclabel element with an attribute relabel='no' in order to try and minimize the impact of shutdown delays when an NFS server disappears. The idea was that if a disk is on NFS and can't be labeled in the first place, there is no need to attempt the (no-op) relabel on domain shutdown. Unfortunately, the way this was implemented was by modifying the domain XML so that the optimization would survive libvirtd restart, but in a way that is indistinguishable from an explicit user setting. Furthermore, once the setting is turned on, libvirt avoids attempts at labeling, even for operations like snapshot or blockcopy where the chain is being extended or pivoted onto non-NFS, where SELinux labeling is once again possible. As a result, it was impossible to do a blockcopy to pivot from an NFS image file onto a local file. The solution is to separate the semantics of a chain that must not be labeled (which the user can set even on persistent domains) vs. the optimization of not attempting a relabel on cleanup (a live-only annotation), and using only the user's explicit notation rather than the optimization as the decision on whether to skip a label attempt in the first place. When upgrading an older libvirtd to a newer, an NFS volume will still attempt the relabel; but as the avoidance of a relabel was only an optimization, this shouldn't cause any problems. In the ideal future, libvirt will eventually have XML describing EVERY file in the backing chain, with each file having a separate <seclabel> element. At that point, libvirt will be able to track more closely which files need a relabel attempt at shutdown. But until we reach that point, the single <seclabel> for the entire <disk> chain is treated as a hint - when a chain has only one file, then we know it is accurate; but if the chain has more than one file, we have to attempt relabel in spite of the attribute, in case part of the chain is local and SELinux mattered for that portion of the chain. * src/conf/domain_conf.h (_virSecurityDeviceLabelDef): Add new member. * src/conf/domain_conf.c (virSecurityDeviceLabelDefParseXML): Parse it, for live images only. (virSecurityDeviceLabelDefFormat): Output it. (virDomainDiskDefParseXML, virDomainChrSourceDefParseXML) (virDomainDiskSourceDefFormat, virDomainChrDefFormat) (virDomainDiskDefFormat): Pass flags on through. * src/security/security_selinux.c (virSecuritySELinuxRestoreSecurityImageLabelInt): Honor labelskip when possible. (virSecuritySELinuxSetSecurityFileLabel): Set labelskip, not norelabel, if labeling fails. (virSecuritySELinuxSetFileconHelper): Fix indentation. * docs/formatdomain.html.in (seclabel): Document new xml. * docs/schemas/domaincommon.rng (devSeclabel): Allow it in RNG. * tests/qemuxml2argvdata/qemuxml2argv-seclabel-*-labelskip.xml: * tests/qemuxml2argvdata/qemuxml2argv-seclabel-*-labelskip.args: * tests/qemuxml2xmloutdata/qemuxml2xmlout-seclabel-*-labelskip.xml: New test files. * tests/qemuxml2argvtest.c (mymain): Run the new tests. * tests/qemuxml2xmltest.c (mymain): Likewise. Signed-off-by: Eric Blake <eblake@redhat.com>
2013-08-12 15:15:42 +00:00
<oneOrMore>
<element name='label'>
<text/>
</element>
selinux: distinguish failure to label from request to avoid label https://bugzilla.redhat.com/show_bug.cgi?id=924153 Commit 904e05a2 (v0.9.9) added a per-<disk> seclabel element with an attribute relabel='no' in order to try and minimize the impact of shutdown delays when an NFS server disappears. The idea was that if a disk is on NFS and can't be labeled in the first place, there is no need to attempt the (no-op) relabel on domain shutdown. Unfortunately, the way this was implemented was by modifying the domain XML so that the optimization would survive libvirtd restart, but in a way that is indistinguishable from an explicit user setting. Furthermore, once the setting is turned on, libvirt avoids attempts at labeling, even for operations like snapshot or blockcopy where the chain is being extended or pivoted onto non-NFS, where SELinux labeling is once again possible. As a result, it was impossible to do a blockcopy to pivot from an NFS image file onto a local file. The solution is to separate the semantics of a chain that must not be labeled (which the user can set even on persistent domains) vs. the optimization of not attempting a relabel on cleanup (a live-only annotation), and using only the user's explicit notation rather than the optimization as the decision on whether to skip a label attempt in the first place. When upgrading an older libvirtd to a newer, an NFS volume will still attempt the relabel; but as the avoidance of a relabel was only an optimization, this shouldn't cause any problems. In the ideal future, libvirt will eventually have XML describing EVERY file in the backing chain, with each file having a separate <seclabel> element. At that point, libvirt will be able to track more closely which files need a relabel attempt at shutdown. But until we reach that point, the single <seclabel> for the entire <disk> chain is treated as a hint - when a chain has only one file, then we know it is accurate; but if the chain has more than one file, we have to attempt relabel in spite of the attribute, in case part of the chain is local and SELinux mattered for that portion of the chain. * src/conf/domain_conf.h (_virSecurityDeviceLabelDef): Add new member. * src/conf/domain_conf.c (virSecurityDeviceLabelDefParseXML): Parse it, for live images only. (virSecurityDeviceLabelDefFormat): Output it. (virDomainDiskDefParseXML, virDomainChrSourceDefParseXML) (virDomainDiskSourceDefFormat, virDomainChrDefFormat) (virDomainDiskDefFormat): Pass flags on through. * src/security/security_selinux.c (virSecuritySELinuxRestoreSecurityImageLabelInt): Honor labelskip when possible. (virSecuritySELinuxSetSecurityFileLabel): Set labelskip, not norelabel, if labeling fails. (virSecuritySELinuxSetFileconHelper): Fix indentation. * docs/formatdomain.html.in (seclabel): Document new xml. * docs/schemas/domaincommon.rng (devSeclabel): Allow it in RNG. * tests/qemuxml2argvdata/qemuxml2argv-seclabel-*-labelskip.xml: * tests/qemuxml2argvdata/qemuxml2argv-seclabel-*-labelskip.args: * tests/qemuxml2xmloutdata/qemuxml2xmlout-seclabel-*-labelskip.xml: New test files. * tests/qemuxml2argvtest.c (mymain): Run the new tests. * tests/qemuxml2xmltest.c (mymain): Likewise. Signed-off-by: Eric Blake <eblake@redhat.com>
2013-08-12 15:15:42 +00:00
</oneOrMore>
seclabel: extend XML to allow per-disk label overrides When doing security relabeling, there are cases where a per-file override might be appropriate. For example, with a static label and relabeling, it might be appropriate to skip relabeling on a particular disk, where the backing file lives on NFS that lacks the ability to track labeling. Or with dynamic labeling, it might be appropriate to use a custom (non-dynamic) label for a disk specifically intended to be shared across domains. The new XML resembles the top-level <seclabel>, but with fewer options (basically relabel='no', or <label>text</label>): <domain ...> ... <devices> <disk type='file' device='disk'> <source file='/path/to/image1'> <seclabel relabel='no'/> <!-- override for just this disk --> </source> ... </disk> <disk type='file' device='disk'> <source file='/path/to/image1'> <seclabel relabel='yes'> <!-- override for just this disk --> <label>system_u:object_r:shared_content_t:s0</label> </seclabel> </source> ... </disk> ... </devices> <seclabel type='dynamic' model='selinux'> <baselabel>text</baselabel> <!-- used for all devices without override --> </seclabel> </domain> This patch only introduces the XML and documentation; future patches will actually parse and make use of it. The intent is that we can further extend things as needed, adding a per-device <seclabel> in more places (such as the source of a console device), and possibly allowing a <baselabel> instead of <label> for labeling where we want to reuse the cNNN,cNNN pair of a dynamically labeled domain but a different base label. First suggested by Daniel P. Berrange here: https://www.redhat.com/archives/libvir-list/2011-December/msg00258.html * docs/schemas/domaincommon.rng (devSeclabel): New define. (disk): Use it. * docs/formatdomain.html.in (elementsDisks, seclabel): Document the new XML. * tests/qemuxml2argvdata/qemuxml2argv-seclabel-dynamic-override.xml: New test, to validate RNG.
2011-12-23 00:47:49 +00:00
</group>
</choice>
</element>
</define>
<define name="hvs">
<attribute name="type">
<choice>
<value>qemu</value>
<value>kqemu</value>
<value>kvm</value>
<value>xen</value>
<value>lxc</value>
<value>uml</value>
<value>openvz</value>
<value>test</value>
<value>vmware</value>
<value>hyperv</value>
<value>vbox</value>
<value>phyp</value>
<value>parallels</value>
<value>bhyve</value>
</choice>
</attribute>
</define>
<define name="os">
<choice>
<ref name="osxen"/>
<ref name="oshvm"/>
<ref name="osexe"/>
</choice>
</define>
<define name="osxen">
<choice>
<group>
<optional>
<ref name="bootloader"/>
</optional>
<element name="os">
<ref name="ostypexen"/>
<ref name="osbootkernel"/>
</element>
</group>
<group>
<ref name="bootloader"/>
<optional>
<element name="os">
<ref name="ostypexen"/>
<optional>
<ref name="osbootkernel"/>
</optional>
</element>
</optional>
</group>
</choice>
</define>
<define name="oshvm">
<element name="os">
<ref name="ostypehvm"/>
<interleave>
<optional>
<element name="loader">
<optional>
<attribute name="readonly">
<choice>
<value>yes</value>
<value>no</value>
</choice>
</attribute>
</optional>
<optional>
<attribute name="type">
<choice>
<value>rom</value>
<value>pflash</value>
</choice>
</attribute>
</optional>
<ref name="absFilePath"/>
</element>
</optional>
<optional>
<element name="nvram">
<optional>
<attribute name="template">
<ref name="absFilePath"/>
</attribute>
</optional>
<optional>
<ref name="absFilePath"/>
</optional>
</element>
</optional>
<optional>
<ref name="osbootkernel"/>
</optional>
<zeroOrMore>
<ref name="osbootdev"/>
</zeroOrMore>
<optional>
<element name="bootmenu">
<attribute name="enable">
<ref name="virYesNo"/>
</attribute>
<optional>
<attribute name="timeout">
<ref name="unsignedShort"/>
</attribute>
</optional>
</element>
</optional>
<optional>
<ref name="smbios"/>
</optional>
<optional>
<ref name="bios"/>
</optional>
</interleave>
</element>
</define>
<define name="ostypexen">
<element name="type">
<optional>
<attribute name="arch">
<choice>
<value>i686</value>
<value>x86_64</value>
<value>ia64</value>
</choice>
</attribute>
</optional>
<optional>
<attribute name="machine">
<choice>
<value>xenpv</value>
<value>xenner</value>
</choice>
</attribute>
</optional>
<choice>
<value>xen</value>
<value>linux</value>
</choice>
</element>
</define>
<define name="ostypehvm">
<element name="type">
<optional>
<choice>
<ref name="hvmx86"/>
<ref name="hvmmips"/>
<ref name="hvmsparc"/>
<ref name="hvmppc"/>
<ref name="hvmppc64"/>
<ref name="hvms390"/>
<ref name="hvmarm"/>
<ref name="hvmaarch64"/>
</choice>
</optional>
<value>hvm</value>
</element>
</define>
<define name="hvmx86">
<group>
<optional>
<attribute name="arch">
<choice>
<value>i686</value>
<value>x86_64</value>
</choice>
</attribute>
</optional>
<optional>
<attribute name="machine">
<data type="string">
<param name="pattern">[a-zA-Z0-9_\.\-]+</param>
</data>
</attribute>
</optional>
</group>
</define>
<define name="hvmmips">
<group>
<optional>
<attribute name="arch">
<value>mips</value>
</attribute>
</optional>
<optional>
<attribute name="machine">
<value>mips</value>
</attribute>
</optional>
</group>
</define>
<define name="hvmsparc">
<group>
<optional>
<attribute name="arch">
<value>sparc</value>
</attribute>
</optional>
<optional>
<attribute name="machine">
<value>sun4m</value>
</attribute>
</optional>
</group>
</define>
<define name="hvmppc">
<group>
<optional>
<attribute name="arch">
<value>ppc</value>
</attribute>
</optional>
<optional>
<attribute name="machine">
<choice>
<value>g3beige</value>
<value>mac99</value>
<value>prep</value>
<value>ppce500</value>
</choice>
</attribute>
</optional>
</group>
</define>
<define name="hvmppc64">
<group>
<optional>
<attribute name="arch">
<value>ppc64</value>
</attribute>
</optional>
<optional>
<attribute name="machine">
<choice>
<value>pseries</value>
</choice>
</attribute>
</optional>
</group>
</define>
<define name="hvms390">
<group>
<optional>
<attribute name="arch">
<choice>
<value>s390</value>
<value>s390x</value>
</choice>
</attribute>
</optional>
<optional>
<attribute name="machine">
<choice>
<value>s390</value>
<value>s390-virtio</value>
<value>s390-ccw</value>
<value>s390-ccw-virtio</value>
</choice>
</attribute>
</optional>
</group>
</define>
<define name="hvmarm">
<group>
<optional>
<attribute name="arch">
<choice>
<value>armv7l</value>
</choice>
</attribute>
</optional>
<optional>
<attribute name="machine">
<data type="string">
<param name="pattern">[a-zA-Z0-9_\.\-]+</param>
</data>
</attribute>
</optional>
</group>
</define>
<define name="hvmaarch64">
<group>
<optional>
<attribute name="arch">
<choice>
<value>aarch64</value>
</choice>
</attribute>
</optional>
<optional>
<attribute name="machine">
<data type="string">
<param name="pattern">[a-zA-Z0-9_\.\-]+</param>
</data>
</attribute>
</optional>
</group>
</define>
<define name="osexe">
<element name="os">
<element name="type">
<optional>
<attribute name="arch">
<choice>
<value>i686</value>
<value>x86_64</value>
<value>ppc</value>
<value>ppc64</value>
<value>mips</value>
<value>sparc</value>
</choice>
</attribute>
</optional>
<value>exe</value>
</element>
<interleave>
<optional>
<element name="init">
<ref name="absFilePath"/>
</element>
</optional>
<zeroOrMore>
<element name="initarg">
<text/>
</element>
</zeroOrMore>
</interleave>
</element>
</define>
<!--
The Identifiers can be:
- an optional id attribute with a number on the domain element
- a mandatory name
- an optional uuid
-->
<define name="ids">
<optional>
<attribute name="id">
<ref name="unsignedInt"/>
</attribute>
</optional>
<interleave>
<element name="name">
<ref name="domainName"/>
</element>
<optional>
<element name="uuid">
<ref name="UUID"/>
</element>
</optional>
</interleave>
</define>
<define name="idmap">
<element name="idmap">
<interleave>
<zeroOrMore>
<element name="uid">
<attribute name="start">
<ref name="unsignedInt"/>
</attribute>
<attribute name="target">
<ref name="unsignedInt"/>
</attribute>
<attribute name="count">
<ref name="unsignedInt"/>
</attribute>
<empty/>
</element>
</zeroOrMore>
<zeroOrMore>
<element name="gid">
<attribute name="start">
<ref name="unsignedInt"/>
</attribute>
<attribute name="target">
<ref name="unsignedInt"/>
</attribute>
<attribute name="count">
<ref name="unsignedInt"/>
</attribute>
<empty/>
</element>
</zeroOrMore>
</interleave>
</element>
</define>
<!--
Resources usage defines the amount of memory (maximum and possibly
current usage) and number of virtual CPUs used by that domain.
We can't check here the rule that currentMemory <= memory
-->
<define name="resources">
<interleave>
<element name="memory">
<ref name='scaledInteger'/>
<optional>
<attribute name="dumpCore">
<ref name="virOnOff"/>
</attribute>
</optional>
</element>
<optional>
<element name="currentMemory">
<ref name='scaledInteger'/>
</element>
</optional>
<optional>
<element name="memoryBacking">
<interleave>
<optional>
<element name="hugepages">
<zeroOrMore>
<element name="page">
<attribute name="size">
<ref name="unsignedLong"/>
</attribute>
<optional>
<attribute name='unit'>
<ref name='unit'/>
</attribute>
</optional>
<optional>
<attribute name="nodeset">
<ref name='cpuset'/>
</attribute>
</optional>
<empty/>
</element>
</zeroOrMore>
</element>
</optional>
<optional>
<element name="nosharepages">
<empty/>
</element>
</optional>
<optional>
<element name="locked">
<empty/>
</element>
</optional>
</interleave>
</element>
</optional>
<optional>
<element name="vcpu">
<optional>
<attribute name="placement">
<choice>
<value>static</value>
<value>auto</value>
</choice>
</attribute>
</optional>
<optional>
<attribute name="cpuset">
<ref name="cpuset"/>
</attribute>
</optional>
<optional>
<attribute name="current">
<ref name="countCPU"/>
</attribute>
</optional>
<ref name="countCPU"/>
</element>
</optional>
<optional>
<element name="iothreads">
<ref name="unsignedInt"/>
</element>
</optional>
<optional>
<ref name="blkiotune"/>
</optional>
<optional>
<ref name="memtune"/>
</optional>
<optional>
<ref name="cputune"/>
</optional>
<optional>
<ref name="numatune"/>
</optional>
<optional>
<ref name="respartition"/>
</optional>
</interleave>
</define>
<!-- The Blkio cgroup related tunables would go in the blkiotune -->
<define name="blkiotune">
<element name="blkiotune">
<interleave>
<!-- I/O weight the VM can use -->
<optional>
<element name="weight">
<ref name="weight"/>
</element>
</optional>
<zeroOrMore>
<element name="device">
<interleave>
<element name="path">
<ref name="absFilePath"/>
</element>
<optional>
<element name="weight">
<ref name="weight"/>
</element>
</optional>
<optional>
<element name="read_iops_sec">
<data type='unsignedInt'/>
</element>
</optional>
<optional>
<element name="write_iops_sec">
<data type='unsignedInt'/>
</element>
</optional>
<optional>
<element name="read_bytes_sec">
<data type='unsignedLong'/>
</element>
</optional>
<optional>
<element name="write_bytes_sec">
<data type='unsignedLong'/>
</element>
</optional>
</interleave>
</element>
</zeroOrMore>
</interleave>
</element>
</define>
<!-- All the memory/swap related tunables would go in the memtune -->
<define name="memtune">
<element name="memtune">
<!-- Maximum memory the VM can use -->
<optional>
<element name="hard_limit">
<ref name='scaledInteger'/>
</element>
</optional>
<!-- Minimum memory ascertained for the VM during contention -->
<optional>
<element name="soft_limit">
<ref name='scaledInteger'/>
</element>
</optional>
<!-- Minimum amount of memory required to start the VM -->
<optional>
<element name="min_guarantee">
<ref name='scaledInteger'/>
</element>
</optional>
<!-- Maximum swap area the VM can use -->
<optional>
<element name="swap_hard_limit">
<ref name='scaledInteger'/>
</element>
</optional>
</element>
</define>
<!-- All the cpu related tunables would go in the cputune -->
<define name="cputune">
<element name="cputune">
<interleave>
<optional>
<element name="shares">
<ref name="cpushares"/>
</element>
</optional>
<optional>
<element name="period">
<ref name="cpuperiod"/>
</element>
</optional>
<optional>
<element name="quota">
<ref name="cpuquota"/>
</element>
</optional>
<optional>
<element name="emulator_period">
<ref name="cpuperiod"/>
</element>
</optional>
<optional>
<element name="emulator_quota">
<ref name="cpuquota"/>
</element>
</optional>
<zeroOrMore>
<element name="vcpupin">
<attribute name="vcpu">
<ref name="vcpuid"/>
</attribute>
<attribute name="cpuset">
<ref name="cpuset"/>
</attribute>
</element>
</zeroOrMore>
<optional>
<element name="emulatorpin">
<attribute name="cpuset">
<ref name="cpuset"/>
</attribute>
</element>
</optional>
<zeroOrMore>
<element name="iothreadpin">
<attribute name="iothread">
<ref name="unsignedInt"/>
</attribute>
<attribute name="cpuset">
<ref name="cpuset"/>
</attribute>
</element>
</zeroOrMore>
</interleave>
</element>
</define>
<!-- All the NUMA related tunables would go in the numatune -->
<define name="numatune">
<element name="numatune">
<interleave>
<optional>
<element name="memory">
<optional>
<attribute name="mode">
<choice>
<value>strict</value>
<value>preferred</value>
<value>interleave</value>
</choice>
</attribute>
</optional>
<choice>
<group>
<optional>
<attribute name='placement'>
<value>static</value>
</attribute>
</optional>
<optional>
<attribute name='nodeset'>
<ref name='cpuset'/>
</attribute>
</optional>
</group>
<attribute name='placement'>
<value>auto</value>
</attribute>
</choice>
</element>
</optional>
<zeroOrMore>
<element name="memnode">
<attribute name="cellid">
<ref name="unsignedInt"/>
</attribute>
<attribute name="mode">
<choice>
<value>strict</value>
<value>preferred</value>
<value>interleave</value>
</choice>
</attribute>
<attribute name='nodeset'>
<ref name='cpuset'/>
</attribute>
</element>
</zeroOrMore>
</interleave>
</element>
</define>
<define name="respartition">
<element name="resource">
<element name="partition">
<ref name="absFilePath"/>
</element>
</element>
</define>
<define name="clock">
<optional>
<element name="clock">
<choice>
<group>
<attribute name="offset">
<choice>
<value>localtime</value>
<value>utc</value>
</choice>
</attribute>
<optional>
<attribute name='adjustment'>
<choice>
<ref name='timeDelta'/>
<value>reset</value>
</choice>
</attribute>
</optional>
</group>
<group>
<attribute name="offset">
<value>timezone</value>
</attribute>
<optional>
<attribute name="timezone">
<ref name="timeZone"/>
</attribute>
</optional>
</group>
<group>
<attribute name="offset">
<value>variable</value>
</attribute>
<optional>
<attribute name="adjustment">
<ref name="timeDelta"/>
</attribute>
</optional>
<optional>
<attribute name="basis">
<choice>
<value>utc</value>
<value>localtime</value>
</choice>
</attribute>
</optional>
</group>
</choice>
<zeroOrMore>
<ref name="timer"/>
</zeroOrMore>
</element>
</optional>
</define>
<define name="timer">
<element name="timer">
<choice>
<group>
<attribute name="name">
<choice>
<value>platform</value>
<value>rtc</value>
</choice>
</attribute>
<optional>
<attribute name="track">
<choice>
<value>boot</value>
<value>guest</value>
<value>wall</value>
</choice>
</attribute>
</optional>
<optional>
<ref name="tickpolicy"/>
</optional>
</group>
<group>
<attribute name="name">
<value>tsc</value>
</attribute>
<optional>
<ref name="tickpolicy"/>
</optional>
<optional>
<attribute name="frequency">
<ref name="unsignedInt"/>
</attribute>
</optional>
<optional>
<attribute name="mode">
<choice>
<value>auto</value>
<value>native</value>
<value>emulate</value>
<value>paravirt</value>
<value>smpsafe</value>
</choice>
</attribute>
</optional>
</group>
<group>
<attribute name="name">
<choice>
<value>hpet</value>
<value>pit</value>
</choice>
</attribute>
<optional>
<ref name="tickpolicy"/>
</optional>
</group>
<group>
<attribute name="name">
<choice>
<value>kvmclock</value>
<value>hypervclock</value>
</choice>
</attribute>
</group>
</choice>
<optional>
<attribute name="present">
<ref name="virYesNo"/>
</attribute>
</optional>
<empty/>
</element>
</define>
<define name="tickpolicy">
<choice>
<group>
<attribute name="tickpolicy">
<choice>
<value>delay</value>
<value>merge</value>
<value>discard</value>
</choice>
</attribute>
</group>
<group>
<attribute name="tickpolicy">
<value>catchup</value>
</attribute>
<optional>
<element name="catchup">
<optional>
<attribute name="threshold">
<ref name="unsignedInt"/>
</attribute>
</optional>
<optional>
<attribute name="slew">
<ref name="unsignedInt"/>
</attribute>
</optional>
<optional>
<attribute name="limit">
<ref name="unsignedInt"/>
</attribute>
</optional>
</element>
</optional>
</group>
</choice>
</define>
<!--
A bootloader may be used to extract the OS information instead of
defining the OS parameter in the instance. It points just to the
binary or script used to extract the data from the first disk device.
-->
<define name="bootloader">
<interleave>
<element name="bootloader">
<choice>
<ref name="absFilePath"/>
<empty/>
</choice>
</element>
<optional>
<element name="bootloader_args">
<text/>
</element>
</optional>
</interleave>
</define>
<define name="osbootkernel">
<interleave>
<optional>
<element name="kernel">
<ref name="absFilePath"/>
</element>
</optional>
<optional>
<element name="initrd">
<ref name="absFilePath"/>
</element>
</optional>
<optional>
<element name="root">
<ref name="absFilePath"/>
</element>
</optional>
<optional>
<element name="cmdline">
<text/>
</element>
</optional>
<optional>
<element name="dtb">
<ref name="absFilePath"/>
</element>
</optional>
</interleave>
</define>
<define name="osbootdev">
<element name="boot">
<attribute name="dev">
<choice>
<value>hd</value>
<value>fd</value>
<value>cdrom</value>
<value>network</value>
</choice>
</attribute>
<empty/>
</element>
</define>
<define name="diskspec">
<interleave>
<optional>
<ref name="diskDriver"/>
</optional>
blockjob: enhance xml to track mirrors across libvirtd restart In order to track a block copy job across libvirtd restarts, we need to save internal XML that tracks the name of the file holding the mirror. Displaying this name in dumpxml might also be useful to the user, even if we don't yet have a way to (re-) start a domain with mirroring enabled up front. This is done with a new <mirror> sub-element to <disk>, as in: <disk type='file' device='disk'> <driver name='qemu' type='raw'/> <source file='/var/lib/libvirt/images/original.img'/> <mirror file='/var/lib/libvirt/images/copy.img' format='qcow2' ready='yes'/> ... </disk> For now, the element is output-only, in live domains; it is ignored when defining a domain or hot-plugging a disk (since those contexts use VIR_DOMAIN_XML_INACTIVE in parsing). The 'ready' attribute appears when libvirt knows that the job has changed from the initial pulling phase over to the mirroring phase, although absence of the attribute is not a sure indicator of the current phase. If we come up with a way to make qemu start with mirroring enabled, we can relax the xml restriction, and allow <mirror> (but not attribute 'ready') on input. Testing active-only XML meant tweaking the testsuite slightly, but it was worth it. * docs/schemas/domaincommon.rng (diskspec): Add diskMirror. * docs/formatdomain.html.in (elementsDisks): Document it. * src/conf/domain_conf.h (_virDomainDiskDef): New members. * src/conf/domain_conf.c (virDomainDiskDefFree): Clean them. (virDomainDiskDefParseXML): Parse them, but only internally. (virDomainDiskDefFormat): Output them. * tests/qemuxml2argvdata/qemuxml2argv-disk-mirror.xml: New test file. * tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-mirror.xml: Likewise. * tests/qemuxml2xmltest.c (testInfo): Alter members. (testCompareXMLToXMLHelper): Allow more test control. (mymain): Run new test.
2012-03-29 00:10:18 +00:00
<optional>
<ref name='diskMirror'/>
</optional>
<optional>
<ref name="diskAuth"/>
</optional>
<ref name="target"/>
<optional>
<ref name="deviceBoot"/>
</optional>
<optional>
<element name="readonly">
<empty/>
</element>
</optional>
<optional>
<element name="shareable">
<empty/>
</element>
</optional>
<optional>
<element name="transient">
<empty/>
</element>
</optional>
<optional>
<element name="serial">
<ref name="diskSerial"/>
</element>
</optional>
<optional>
<ref name="encryption"/>
</optional>
<optional>
<ref name="diskIoTune"/>
</optional>
<optional>
<ref name="alias"/>
</optional>
<optional>
<ref name="address"/>
</optional>
<optional>
<ref name="geometry"/>
</optional>
<optional>
<ref name="diskBlockIo"/>
</optional>
<optional>
<element name="wwn">
<ref name="wwn"/>
</element>
</optional>
<optional>
<element name="vendor">
<data type="string">
<param name="pattern">[x20-x7E]{0,8}</param>
</data>
</element>
</optional>
<optional>
<element name="product">
<data type="string">
<param name="pattern">[x20-x7E]{0,16}</param>
</data>
</element>
</optional>
</interleave>
</define>
<define name="snapshot">
<attribute name="snapshot">
<choice>
<value>no</value>
<value>internal</value>
<value>external</value>
</choice>
</attribute>
</define>
<define name="lease">
<element name="lease">
<interleave>
<element name="lockspace">
<text/>
</element>
<element name="key">
<text/>
</element>
<element name="target">
<attribute name="path">
<text/>
</attribute>
<optional>
<attribute name="offset">
<ref name="unsignedInt"/>
</attribute>
</optional>
</element>
</interleave>
</element>
</define>
<define name="startupPolicy">
<attribute name="startupPolicy">
<choice>
<value>mandatory</value>
<value>requisite</value>
<value>optional</value>
</choice>
</attribute>
</define>
<!--
A disk description can be either of type file or block
The name of the attribute on the source element depends on the type
-->
<define name="disk">
<element name="disk">
<choice>
<group>
<optional>
<attribute name="device">
<choice>
<value>floppy</value>
<value>disk</value>
<value>cdrom</value>
</choice>
</attribute>
</optional>
</group>
<group>
<attribute name="device">
<choice>
<value>lun</value>
</choice>
</attribute>
<optional>
<ref name="rawIO"/>
</optional>
<optional>
<attribute name="sgio">
<choice>
<value>filtered</value>
<value>unfiltered</value>
</choice>
</attribute>
</optional>
</group>
</choice>
<optional>
<ref name="snapshot"/>
</optional>
conf: Output disk backing store details in domain XML The XML for quite a longish backing chain is shown below: <disk type='network' device='disk'> <driver name='qemu' type='qcow2'/> <source protocol='nbd' name='bar'> <host transport='unix' socket='/var/run/nbdsock'/> </source> <backingStore type='block' index='1'> <format type='qcow2'/> <source dev='/dev/HostVG/QEMUGuest1'/> <backingStore type='file' index='2'> <format type='qcow2'/> <source file='/tmp/image2.qcow'/> <backingStore type='file' index='3'> <format type='qcow2'/> <source file='/tmp/image3.qcow'/> <backingStore type='file' index='4'> <format type='qcow2'/> <source file='/tmp/image4.qcow'/> <backingStore type='file' index='5'> <format type='qcow2'/> <source file='/tmp/image5.qcow'/> <backingStore type='file' index='6'> <format type='raw'/> <source file='/tmp/Fedora-17-x86_64-Live-KDE.iso'/> <backingStore/> </backingStore> </backingStore> </backingStore> </backingStore> </backingStore> </backingStore> <target dev='vdb' bus='virtio'/> </disk> Various disk types and formats can be mixed in one chain. The <backingStore/> empty element marks the end of the backing chain and it is there mostly for future support of parsing the chain provided by a user. If it's missing, we are supposed to probe for the rest of the chain ourselves, otherwise complete chain was provided by the user. The index attributes of backingStore elements can be used to unambiguously identify a specific part of the image chain. Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2014-04-16 13:28:10 +00:00
<interleave>
<ref name="diskSource"/>
<ref name="storageSourceExtra"/>
<ref name="diskBackingChain"/>
</interleave>
</element>
</define>
<define name="diskBackingChain">
<choice>
<ref name="diskBackingStore"/>
<ref name="diskBackingStoreLast"/>
</choice>
</define>
<define name="diskBackingStore">
<element name="backingStore">
<attribute name="index">
<ref name="positiveInteger"/>
</attribute>
<interleave>
<ref name="diskSource"/>
<ref name="diskBackingChain"/>
<ref name="diskFormat"/>
</interleave>
</element>
</define>
conf: Output disk backing store details in domain XML The XML for quite a longish backing chain is shown below: <disk type='network' device='disk'> <driver name='qemu' type='qcow2'/> <source protocol='nbd' name='bar'> <host transport='unix' socket='/var/run/nbdsock'/> </source> <backingStore type='block' index='1'> <format type='qcow2'/> <source dev='/dev/HostVG/QEMUGuest1'/> <backingStore type='file' index='2'> <format type='qcow2'/> <source file='/tmp/image2.qcow'/> <backingStore type='file' index='3'> <format type='qcow2'/> <source file='/tmp/image3.qcow'/> <backingStore type='file' index='4'> <format type='qcow2'/> <source file='/tmp/image4.qcow'/> <backingStore type='file' index='5'> <format type='qcow2'/> <source file='/tmp/image5.qcow'/> <backingStore type='file' index='6'> <format type='raw'/> <source file='/tmp/Fedora-17-x86_64-Live-KDE.iso'/> <backingStore/> </backingStore> </backingStore> </backingStore> </backingStore> </backingStore> </backingStore> <target dev='vdb' bus='virtio'/> </disk> Various disk types and formats can be mixed in one chain. The <backingStore/> empty element marks the end of the backing chain and it is there mostly for future support of parsing the chain provided by a user. If it's missing, we are supposed to probe for the rest of the chain ourselves, otherwise complete chain was provided by the user. The index attributes of backingStore elements can be used to unambiguously identify a specific part of the image chain. Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2014-04-16 13:28:10 +00:00
<define name="diskFormat">
<element name="format">
<attribute name="type">
<ref name="storageFormat"/>
</attribute>
<empty/>
</element>
</define>
<define name="diskBackingStoreLast">
<optional>
<element name="backingStore">
<empty/>
</element>
</optional>
</define>
<define name="diskSource">
<choice>
<ref name="diskSourceFile"/>
<ref name="diskSourceBlock"/>
<ref name="diskSourceDir"/>
<ref name="diskSourceNetwork"/>
<ref name="diskSourceVolume"/>
</choice>
</define>
<define name="diskSourceFile">
<optional>
<attribute name="type">
<value>file</value>
</attribute>
</optional>
<interleave>
<optional>
<element name="source">
<optional>
<attribute name="file">
<ref name="absFilePath"/>
</attribute>
</optional>
<optional>
<ref name="storageStartupPolicy"/>
</optional>
<optional>
<ref name='devSeclabel'/>
</optional>
</element>
</optional>
</interleave>
</define>
<define name="diskSourceBlock">
<attribute name="type">
<value>block</value>
</attribute>
<interleave>
<optional>
<element name="source">
<optional>
<attribute name="dev">
<ref name="absFilePath"/>
</attribute>
</optional>
<optional>
<ref name="storageStartupPolicy"/>
</optional>
<optional>
<ref name='devSeclabel'/>
</optional>
</element>
</optional>
</interleave>
</define>
<define name="diskSourceDir">
<attribute name="type">
<value>dir</value>
</attribute>
<interleave>
<optional>
<element name="source">
<attribute name="dir">
<ref name="absFilePath"/>
</attribute>
<optional>
<ref name="storageStartupPolicy"/>
</optional>
<empty/>
</element>
</optional>
</interleave>
</define>
<define name="diskSourceNetwork">
<attribute name="type">
<value>network</value>
</attribute>
<interleave>
<element name="source">
<attribute name="protocol">
<choice>
<value>nbd</value>
<value>rbd</value>
<value>sheepdog</value>
<value>gluster</value>
<value>iscsi</value>
<value>http</value>
<value>https</value>
<value>ftp</value>
<value>ftps</value>
<value>tftp</value>
</choice>
</attribute>
<optional>
<attribute name="name"/>
</optional>
<zeroOrMore>
<element name="host">
<choice>
<group>
<optional>
<attribute name="transport">
<choice>
<value>tcp</value>
<value>rdma</value>
</choice>
</attribute>
</optional>
<attribute name="name">
<choice>
<ref name="dnsName"/>
<ref name="ipAddr"/>
</choice>
</attribute>
<optional>
<attribute name="port">
<ref name="unsignedInt"/>
</attribute>
</optional>
</group>
<group>
<attribute name="transport">
<value>unix</value>
</attribute>
<attribute name="socket">
<ref name="absFilePath"/>
</attribute>
</group>
</choice>
</element>
</zeroOrMore>
<empty/>
</element>
</interleave>
</define>
conf: set up for per-grammar overrides in schemas This patch is my first experience playing with nested grammars, as documented in http://relaxng.org/tutorial-20011203.html#IDA3PZR. I plan on doing more overrides in order to make the RelaxNG grammar mirror the C code refactoring into a common virStorageSource, but where different clients of that source do not support the same subset of functionality. By starting with something fairly easy to validate, I can make sure my later patches will be possible. This patch adds a use of the no-op <ref name='sourceStartupPolicy'/> to the disksnapshot definition, so that the snapshot version of a type='file' <source> more closely resembles the version in domaincommon. A future patch will merge the two files into using a common define, but this patch is sufficient for testing that adding <source startupPolicy='optional'/> in any of the tests/domainsnapshotxml2xmlin/*.xml files still gets rejected unless it occurs within the <domain> subelement, because the definition of startupPolicy is empty outside of domain.rng. * docs/schemas/storagecommon.rng (storageStartupPolicy) (storageSourceExtra): Create no-op defaults. * docs/schemas/domainsnapshot.rng (domain): Use nested grammar to avoid restricting <domain>. (storageSourceExtra): Create new override. (disksnapshot): Access overrides through common names. * docs/schemas/domaincommon.rng (disk): Access overrides through common names. * docs/schemas/domain.rng (storageStartupPolicy) (storageSourceExtra): Create new overrides. Signed-off-by: Eric Blake <eblake@redhat.com> Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2014-04-14 22:54:15 +00:00
<define name="diskSourceVolume">
<attribute name="type">
<value>volume</value>
</attribute>
<interleave>
<optional>
<element name="source">
<attribute name="pool">
<ref name="genericName"/>
</attribute>
<attribute name="volume">
<ref name="volName"/>
</attribute>
<optional>
<attribute name="mode">
<choice>
<value>host</value>
<value>direct</value>
</choice>
</attribute>
</optional>
<optional>
<ref name="storageStartupPolicy"/>
</optional>
<optional>
<ref name='devSeclabel'/>
</optional>
</element>
</optional>
</interleave>
</define>
snapshot: also support disks by path I got confused when 'virsh domblkinfo dom disk' required the path to a disk (which can be ambiguous, since a single file can back multiple disks), rather than the unambiguous target device name that I was using in disk snapshots. So, in true developer fashion, I went for the best of both worlds - all interfaces that operate on a disk (aka block) now accept either the target name or the unambiguous path to the backing file used by the disk. * src/conf/domain_conf.h (virDomainDiskIndexByName): Add parameter. (virDomainDiskPathByName): New prototype. * src/libvirt_private.syms (domain_conf.h): Export it. * src/conf/domain_conf.c (virDomainDiskIndexByName): Also allow searching by path, and decide whether ambiguity is okay. (virDomainDiskPathByName): New function. (virDomainDiskRemoveByName, virDomainSnapshotAlignDisks): Update callers. * src/qemu/qemu_driver.c (qemudDomainBlockPeek) (qemuDomainAttachDeviceConfig, qemuDomainUpdateDeviceConfig) (qemuDomainGetBlockInfo, qemuDiskPathToAlias): Likewise. * src/qemu/qemu_process.c (qemuProcessFindDomainDiskByPath): Likewise. * src/libxl/libxl_driver.c (libxlDomainAttachDeviceDiskLive) (libxlDomainDetachDeviceDiskLive, libxlDomainAttachDeviceConfig) (libxlDomainUpdateDeviceConfig): Likewise. * src/uml/uml_driver.c (umlDomainBlockPeek): Likewise. * src/xen/xend_internal.c (xenDaemonDomainBlockPeek): Likewise. * docs/formatsnapshot.html.in: Update documentation. * tools/virsh.pod (domblkstat, domblkinfo): Likewise. * docs/schemas/domaincommon.rng (diskTarget): Tighten pattern on disk targets. * docs/schemas/domainsnapshot.rng (disksnapshot): Update to match. * tests/domainsnapshotxml2xmlin/disk_snapshot.xml: Update test.
2011-08-20 02:38:36 +00:00
<define name="diskTarget">
<data type="string">
<param name="pattern">(ioemu:)?(fd|hd|sd|vd|xvd|ubd)[a-zA-Z0-9_]+</param>
</data>
</define>
<define name="target">
<element name="target">
<attribute name="dev">
snapshot: also support disks by path I got confused when 'virsh domblkinfo dom disk' required the path to a disk (which can be ambiguous, since a single file can back multiple disks), rather than the unambiguous target device name that I was using in disk snapshots. So, in true developer fashion, I went for the best of both worlds - all interfaces that operate on a disk (aka block) now accept either the target name or the unambiguous path to the backing file used by the disk. * src/conf/domain_conf.h (virDomainDiskIndexByName): Add parameter. (virDomainDiskPathByName): New prototype. * src/libvirt_private.syms (domain_conf.h): Export it. * src/conf/domain_conf.c (virDomainDiskIndexByName): Also allow searching by path, and decide whether ambiguity is okay. (virDomainDiskPathByName): New function. (virDomainDiskRemoveByName, virDomainSnapshotAlignDisks): Update callers. * src/qemu/qemu_driver.c (qemudDomainBlockPeek) (qemuDomainAttachDeviceConfig, qemuDomainUpdateDeviceConfig) (qemuDomainGetBlockInfo, qemuDiskPathToAlias): Likewise. * src/qemu/qemu_process.c (qemuProcessFindDomainDiskByPath): Likewise. * src/libxl/libxl_driver.c (libxlDomainAttachDeviceDiskLive) (libxlDomainDetachDeviceDiskLive, libxlDomainAttachDeviceConfig) (libxlDomainUpdateDeviceConfig): Likewise. * src/uml/uml_driver.c (umlDomainBlockPeek): Likewise. * src/xen/xend_internal.c (xenDaemonDomainBlockPeek): Likewise. * docs/formatsnapshot.html.in: Update documentation. * tools/virsh.pod (domblkstat, domblkinfo): Likewise. * docs/schemas/domaincommon.rng (diskTarget): Tighten pattern on disk targets. * docs/schemas/domainsnapshot.rng (disksnapshot): Update to match. * tests/domainsnapshotxml2xmlin/disk_snapshot.xml: Update test.
2011-08-20 02:38:36 +00:00
<ref name="diskTarget"/>
</attribute>
<optional>
<attribute name="bus">
<choice>
<value>ide</value>
<value>fdc</value>
<value>scsi</value>
<value>virtio</value>
<value>xen</value>
<value>usb</value>
<value>uml</value>
<value>sata</value>
<value>sd</value>
</choice>
</attribute>
</optional>
<optional>
<attribute name="tray">
<choice>
<value>open</value>
<value>closed</value>
</choice>
</attribute>
</optional>
<optional>
<attribute name="removable">
<ref name="virOnOff"/>
</attribute>
</optional>
</element>
</define>
<define name="geometry">
<element name="geometry">
<attribute name="cyls">
<data type="integer"/>
</attribute>
<attribute name="heads">
<data type="integer"/>
</attribute>
<attribute name="secs">
<data type="integer"/>
</attribute>
<optional>
<attribute name="trans">
<choice>
<value>auto</value>
<value>none</value>
<value>lba</value>
</choice>
</attribute>
</optional>
</element>
</define>
<define name="diskBlockIo">
<element name="blockio">
<optional>
<attribute name="logical_block_size">
<data type="integer"/>
</attribute>
</optional>
<optional>
<attribute name="physical_block_size">
<data type="integer"/>
</attribute>
</optional>
</element>
</define>
<!--
blockjob: enhance xml to track mirrors across libvirtd restart In order to track a block copy job across libvirtd restarts, we need to save internal XML that tracks the name of the file holding the mirror. Displaying this name in dumpxml might also be useful to the user, even if we don't yet have a way to (re-) start a domain with mirroring enabled up front. This is done with a new <mirror> sub-element to <disk>, as in: <disk type='file' device='disk'> <driver name='qemu' type='raw'/> <source file='/var/lib/libvirt/images/original.img'/> <mirror file='/var/lib/libvirt/images/copy.img' format='qcow2' ready='yes'/> ... </disk> For now, the element is output-only, in live domains; it is ignored when defining a domain or hot-plugging a disk (since those contexts use VIR_DOMAIN_XML_INACTIVE in parsing). The 'ready' attribute appears when libvirt knows that the job has changed from the initial pulling phase over to the mirroring phase, although absence of the attribute is not a sure indicator of the current phase. If we come up with a way to make qemu start with mirroring enabled, we can relax the xml restriction, and allow <mirror> (but not attribute 'ready') on input. Testing active-only XML meant tweaking the testsuite slightly, but it was worth it. * docs/schemas/domaincommon.rng (diskspec): Add diskMirror. * docs/formatdomain.html.in (elementsDisks): Document it. * src/conf/domain_conf.h (_virDomainDiskDef): New members. * src/conf/domain_conf.c (virDomainDiskDefFree): Clean them. (virDomainDiskDefParseXML): Parse them, but only internally. (virDomainDiskDefFormat): Output them. * tests/qemuxml2argvdata/qemuxml2argv-disk-mirror.xml: New test file. * tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-mirror.xml: Likewise. * tests/qemuxml2xmltest.c (testInfo): Alter members. (testCompareXMLToXMLHelper): Allow more test control. (mymain): Run new test.
2012-03-29 00:10:18 +00:00
Disk may use a special driver for access.
-->
<define name="diskDriver">
<element name="driver">
<optional>
<ref name="driverFormat"/>
</optional>
<optional>
<ref name="driverCache"/>
</optional>
<optional>
<ref name="driverErrorPolicy"/>
</optional>
<optional>
<ref name="driverRerrorPolicy"/>
</optional>
<optional>
<ref name="driverIO"/>
</optional>
<optional>
<ref name="ioeventfd"/>
</optional>
<optional>
<ref name="event_idx"/>
</optional>
<optional>
<ref name="copy_on_read"/>
</optional>
<optional>
<ref name="discard"/>
</optional>
<optional>
<ref name="driverIOThread"/>
</optional>
<empty/>
</element>
</define>
<define name="driverFormat">
<attribute name="name">
<ref name="genericName"/>
</attribute>
<optional>
<attribute name='type'>
<choice>
<ref name='storageFormat'/>
<value>aio</value> <!-- back-compat for 'raw' -->
</choice>
</attribute>
</optional>
</define>
<define name="driverCache">
<attribute name="cache">
<choice>
<value>none</value>
<value>writeback</value>
<value>writethrough</value>
<value>directsync</value>
<value>unsafe</value>
</choice>
</attribute>
</define>
<define name="driverErrorPolicy">
<attribute name="error_policy">
<choice>
<value>stop</value>
<value>report</value>
<value>ignore</value>
<value>enospace</value>
</choice>
</attribute>
</define>
<define name="driverRerrorPolicy">
<attribute name="rerror_policy">
<choice>
<value>stop</value>
<value>report</value>
<value>ignore</value>
</choice>
</attribute>
</define>
<define name="driverIO">
<attribute name="io">
<choice>
<value>threads</value>
<value>native</value>
</choice>
</attribute>
</define>
<define name="ioeventfd">
<attribute name="ioeventfd">
<ref name="virOnOff"/>
</attribute>
</define>
<define name="event_idx">
<attribute name="event_idx">
<ref name="virOnOff"/>
</attribute>
</define>
<define name="copy_on_read">
<attribute name='copy_on_read'>
<ref name="virOnOff"/>
</attribute>
</define>
<define name="discard">
<attribute name='discard'>
<choice>
<value>unmap</value>
<value>ignore</value>
</choice>
</attribute>
</define>
<define name="driverIOThread">
<attribute name='iothread'>
<ref name="unsignedInt"/>
</attribute>
</define>
<define name="controller">
<element name="controller">
<attribute name="index">
<ref name="unsignedInt"/>
</attribute>
<interleave>
<optional>
<ref name="alias"/>
</optional>
<optional>
<ref name="address"/>
</optional>
<choice>
<!-- fdc/ide/sata/ccid have only the common attributes -->
<group>
<attribute name="type">
<choice>
<value>fdc</value>
<value>ide</value>
<value>sata</value>
<value>ccid</value>
</choice>
</attribute>
</group>
<!-- scsi has an optional attribute "model" -->
<group>
<attribute name="type">
<value>scsi</value>
</attribute>
<optional>
<attribute name="model">
<choice>
<value>auto</value>
<value>buslogic</value>
<value>lsilogic</value>
<value>lsisas1068</value>
<value>vmpvscsi</value>
<value>ibmvscsi</value>
<value>virtio-scsi</value>
<value>lsisas1078</value>
</choice>
</attribute>
</optional>
</group>
<!-- usb has an optional attribute "model", and optional subelement "master" -->
<group>
<attribute name="type">
<value>usb</value>
</attribute>
<optional>
<attribute name="model">
<choice>
<value>piix3-uhci</value>
<value>piix4-uhci</value>
<value>ehci</value>
<value>ich9-ehci1</value>
<value>ich9-uhci1</value>
<value>ich9-uhci2</value>
<value>ich9-uhci3</value>
<value>vt82c686b-uhci</value>
<value>pci-ohci</value>
<value>nec-xhci</value>
<value>none</value>
</choice>
</attribute>
</optional>
<optional>
<ref name="usbmaster"/>
</optional>
</group>
<!-- pci has an optional attribute "model" -->
<group>
<attribute name="type">
<value>pci</value>
</attribute>
<!-- *-root controllers have an optional element "pcihole64"-->
<choice>
<group>
<attribute name="model">
<choice>
<value>pci-root</value>
<value>pcie-root</value>
</choice>
</attribute>
<optional>
<element name="pcihole64">
<ref name="scaledInteger"/>
</element>
</optional>
</group>
<group>
<attribute name="model">
<choice>
<value>pci-bridge</value>
<value>dmi-to-pci-bridge</value>
</choice>
</attribute>
</group>
</choice>
</group>
<!-- virtio-serial has optional "ports" and "vectors" -->
<group>
<attribute name="type">
<value>virtio-serial</value>
</attribute>
<optional>
<attribute name="ports">
<ref name="unsignedInt"/>
</attribute>
</optional>
<optional>
<attribute name="vectors">
<ref name="unsignedInt"/>
</attribute>
</optional>
</group>
</choice>
<optional>
<element name="driver">
<optional>
<attribute name="queues">
<ref name="unsignedInt"/>
</attribute>
</optional>
<optional>
<attribute name="cmd_per_lun">
<ref name="unsignedInt"/>
</attribute>
</optional>
<optional>
<attribute name="max_sectors">
<ref name="unsignedInt"/>
</attribute>
</optional>
</element>
</optional>
</interleave>
</element>
</define>
<define name="filesystem">
<element name="filesystem">
<choice>
<group>
<attribute name="type">
<value>file</value>
</attribute>
<optional>
<ref name="fsDriver"/>
</optional>
<interleave>
<element name="source">
<attribute name="file">
<ref name="absFilePath"/>
</attribute>
<empty/>
</element>
</interleave>
</group>
<group>
<attribute name="type">
<value>block</value>
</attribute>
<optional>
<ref name="fsDriver"/>
</optional>
<interleave>
<element name="source">
<attribute name="dev">
<ref name="absFilePath"/>
</attribute>
<empty/>
</element>
</interleave>
</group>
<group>
<!-- type='mount' is default -->
<optional>
<attribute name="type">
<value>mount</value>
</attribute>
</optional>
<optional>
<ref name="fsDriver"/>
</optional>
<interleave>
<element name="source">
<attribute name="dir">
<ref name="absDirPath"/>
</attribute>
<empty/>
</element>
</interleave>
</group>
<group>
<optional>
<attribute name="type">
<value>bind</value>
</attribute>
</optional>
<optional>
<ref name="fsDriver"/>
</optional>
<interleave>
<element name="source">
<attribute name="dir">
<ref name="absDirPath"/>
</attribute>
<empty/>
</element>
</interleave>
</group>
<group>
<attribute name="type">
<value>template</value>
</attribute>
<optional>
<ref name="fsDriver"/>
</optional>
<interleave>
<element name="source">
<attribute name="name">
<ref name="genericName"/>
</attribute>
<empty/>
</element>
</interleave>
</group>
<group>
<attribute name="type">
<value>ram</value>
</attribute>
<optional>
<ref name="fsDriver"/>
</optional>
<interleave>
<element name="source">
<attribute name="usage">
<ref name="unsignedLong"/>
</attribute>
<optional>
<attribute name='units'>
<ref name='unit'/>
</attribute>
</optional>
<empty/>
</element>
</interleave>
</group>
</choice>
<interleave>
<element name="target">
<attribute name="dir">
<ref name="absDirPath"/>
</attribute>
<empty/>
</element>
<optional>
<attribute name="accessmode">
<choice>
<value>passthrough</value>
<value>mapped</value>
<value>squash</value>
</choice>
</attribute>
</optional>
<optional>
<element name='readonly'>
<empty/>
</element>
</optional>
<optional>
<ref name="alias"/>
</optional>
<optional>
<ref name="address"/>
</optional>
</interleave>
<interleave>
<optional>
<element name="space_hard_limit">
<ref name='scaledInteger'/>
</element>
</optional>
<optional>
<element name="space_soft_limit">
<ref name='scaledInteger'/>
</element>
</optional>
</interleave>
</element>
</define>
<define name="fsDriver">
<element name="driver">
<!-- Annoying inconsistency. 'disk' uses 'name'
for this kind of info, and 'type' for the
storage format. We need the latter too, so
had to invent a new attribute name -->
<optional>
<attribute name="type">
<choice>
<value>path</value>
<value>handle</value>
<value>loop</value>
<value>nbd</value>
</choice>
</attribute>
</optional>
<optional>
<attribute name="format">
<ref name="storageFormat"/>
</attribute>
</optional>
<optional>
<attribute name="wrpolicy">
<value>immediate</value>
</attribute>
</optional>
<empty/>
</element>
</define>
<!--
An interface description can either be of type bridge in which case
it will use a bridging source, or of type ethernet which uses a device
source and a device target instead. They both share a set of interface
options. FIXME
-->
<define name="interface">
<element name="interface">
<choice>
<group>
<attribute name="type">
<value>bridge</value>
</attribute>
<interleave>
<optional>
<element name="source">
<attribute name="bridge">
<ref name="deviceName"/>
</attribute>
<empty/>
</element>
</optional>
<optional>
<ref name="virtualPortProfile"/>
</optional>
<ref name="interface-options"/>
</interleave>
</group>
<group>
<attribute name="type">
<value>ethernet</value>
</attribute>
<interleave>
<optional>
<element name="source">
<attribute name="dev">
<ref name="deviceName"/>
</attribute>
<empty/>
</element>
</optional>
<ref name="interface-options"/>
</interleave>
</group>
<group>
<attribute name="type">
<value>vhostuser</value>
</attribute>
<interleave>
<element name="source">
<attribute name="type">
<choice>
<value>unix</value>
</choice>
</attribute>
<attribute name="path">
<ref name="absFilePath"/>
</attribute>
<attribute name="mode">
<choice>
<value>server</value>
<value>client</value>
</choice>
</attribute>
<empty/>
</element>
<ref name="interface-options"/>
</interleave>
</group>
<group>
<attribute name="type">
<value>network</value>
</attribute>
<interleave>
<element name="source">
<attribute name="network">
<ref name="deviceName"/>
</attribute>
<optional>
<attribute name="portgroup">
<ref name="deviceName"/>
</attribute>
</optional>
<empty/>
</element>
<optional>
<ref name="virtualPortProfile"/>
</optional>
<ref name="interface-options"/>
</interleave>
</group>
<group>
<attribute name="type">
<value>direct</value>
</attribute>
<interleave>
<element name="source">
<attribute name="dev">
<ref name="deviceName"/>
</attribute>
<optional>
<attribute name="mode">
<ref name="bridgeMode"/>
</attribute>
</optional>
<empty/>
</element>
<optional>
<ref name="virtualPortProfile"/>
</optional>
<ref name="interface-options"/>
</interleave>
</group>
<group>
<attribute name="type">
<value>user</value>
</attribute>
<interleave>
<ref name="interface-options"/>
</interleave>
</group>
<group>
<attribute name="type">
<value>internal</value>
</attribute>
<interleave>
<element name="source">
<attribute name="name">
<ref name="deviceName"/>
</attribute>
<empty/>
</element>
<ref name="interface-options"/>
</interleave>
</group>
<group>
<attribute name="type">
<choice>
<value>mcast</value>
<value>client</value>
</choice>
</attribute>
<interleave>
<element name="source">
<attribute name="address">
<ref name="ipv4Addr"/>
</attribute>
<attribute name="port">
<ref name="PortNumber"/>
</attribute>
<empty/>
</element>
<optional>
<element name="mac">
<attribute name="address">
<ref name="uniMacAddr"/>
</attribute>
<empty/>
</element>
</optional>
</interleave>
</group>
<group>
<attribute name="type">
<value>server</value>
</attribute>
<interleave>
<element name="source">
<optional>
<attribute name="address">
<ref name="ipv4Addr"/>
</attribute>
</optional>
<attribute name="port">
<ref name="PortNumber"/>
</attribute>
<empty/>
</element>
<optional>
<element name="mac">
<attribute name="address">
<ref name="uniMacAddr"/>
</attribute>
<empty/>
</element>
</optional>
</interleave>
</group>
conf: parse/format type='hostdev' network interfaces This is the new interface type that sets up an SR-IOV PCI network device to be assigned to the guest with PCI passthrough after initializing some network device-specific things from the config (e.g. MAC address, virtualport profile parameters). Here is an example of the syntax: <interface type='hostdev' managed='yes'> <source> <address type='pci' domain='0' bus='0' slot='4' function='3'/> </source> <mac address='00:11:22:33:44:55'/> <address type='pci' domain='0' bus='0' slot='7' function='0'/> </interface> This would assign the PCI card from bus 0 slot 4 function 3 on the host, to bus 0 slot 7 function 0 on the guest, but would first set the MAC address of the card to 00:11:22:33:44:55. NB: The parser and formatter don't care if the PCI card being specified is a standard single function network adapter, or a virtual function (VF) of an SR-IOV capable network adapter, but the upcoming code that implements the back end of this config will work *only* with SR-IOV VFs. This is because modifying the mac address of a standard network adapter prior to assigning it to a guest is pointless - part of the device reset that occurs during that process will reset the MAC address to the value programmed into the card's firmware. Although it's not supported by any of libvirt's hypervisor drivers, usb network hostdevs are also supported in the parser and formatter for completeness and consistency. <source> syntax is identical to that for plain <hostdev> devices, except that the <address> element should have "type='usb'" added if bus/device are specified: <interface type='hostdev'> <source> <address type='usb' bus='0' device='4'/> </source> <mac address='00:11:22:33:44:55'/> </interface> If the vendor/product form of usb specification is used, type='usb' is implied: <interface type='hostdev'> <source> <vendor id='0x0012'/> <product id='0x24dd'/> </source> <mac address='00:11:22:33:44:55'/> </interface> Again, the upcoming patch to fill in the backend of this functionality will log an error and fail with "Unsupported Config" if you actually try to assign a USB network adapter to a guest using <interface type='hostdev'> - just use a standard <hostdev> entry in that case (and also for single-port PCI adapters).
2012-02-15 17:37:15 +00:00
<group>
<attribute name="type">
<value>hostdev</value>
</attribute>
<optional>
<attribute name="managed">
<ref name="virYesNo"/>
conf: parse/format type='hostdev' network interfaces This is the new interface type that sets up an SR-IOV PCI network device to be assigned to the guest with PCI passthrough after initializing some network device-specific things from the config (e.g. MAC address, virtualport profile parameters). Here is an example of the syntax: <interface type='hostdev' managed='yes'> <source> <address type='pci' domain='0' bus='0' slot='4' function='3'/> </source> <mac address='00:11:22:33:44:55'/> <address type='pci' domain='0' bus='0' slot='7' function='0'/> </interface> This would assign the PCI card from bus 0 slot 4 function 3 on the host, to bus 0 slot 7 function 0 on the guest, but would first set the MAC address of the card to 00:11:22:33:44:55. NB: The parser and formatter don't care if the PCI card being specified is a standard single function network adapter, or a virtual function (VF) of an SR-IOV capable network adapter, but the upcoming code that implements the back end of this config will work *only* with SR-IOV VFs. This is because modifying the mac address of a standard network adapter prior to assigning it to a guest is pointless - part of the device reset that occurs during that process will reset the MAC address to the value programmed into the card's firmware. Although it's not supported by any of libvirt's hypervisor drivers, usb network hostdevs are also supported in the parser and formatter for completeness and consistency. <source> syntax is identical to that for plain <hostdev> devices, except that the <address> element should have "type='usb'" added if bus/device are specified: <interface type='hostdev'> <source> <address type='usb' bus='0' device='4'/> </source> <mac address='00:11:22:33:44:55'/> </interface> If the vendor/product form of usb specification is used, type='usb' is implied: <interface type='hostdev'> <source> <vendor id='0x0012'/> <product id='0x24dd'/> </source> <mac address='00:11:22:33:44:55'/> </interface> Again, the upcoming patch to fill in the backend of this functionality will log an error and fail with "Unsupported Config" if you actually try to assign a USB network adapter to a guest using <interface type='hostdev'> - just use a standard <hostdev> entry in that case (and also for single-port PCI adapters).
2012-02-15 17:37:15 +00:00
</attribute>
</optional>
<interleave>
<element name="source">
<optional>
<attribute name="missing">
<ref name="virYesNo"/>
</attribute>
</optional>
conf: parse/format type='hostdev' network interfaces This is the new interface type that sets up an SR-IOV PCI network device to be assigned to the guest with PCI passthrough after initializing some network device-specific things from the config (e.g. MAC address, virtualport profile parameters). Here is an example of the syntax: <interface type='hostdev' managed='yes'> <source> <address type='pci' domain='0' bus='0' slot='4' function='3'/> </source> <mac address='00:11:22:33:44:55'/> <address type='pci' domain='0' bus='0' slot='7' function='0'/> </interface> This would assign the PCI card from bus 0 slot 4 function 3 on the host, to bus 0 slot 7 function 0 on the guest, but would first set the MAC address of the card to 00:11:22:33:44:55. NB: The parser and formatter don't care if the PCI card being specified is a standard single function network adapter, or a virtual function (VF) of an SR-IOV capable network adapter, but the upcoming code that implements the back end of this config will work *only* with SR-IOV VFs. This is because modifying the mac address of a standard network adapter prior to assigning it to a guest is pointless - part of the device reset that occurs during that process will reset the MAC address to the value programmed into the card's firmware. Although it's not supported by any of libvirt's hypervisor drivers, usb network hostdevs are also supported in the parser and formatter for completeness and consistency. <source> syntax is identical to that for plain <hostdev> devices, except that the <address> element should have "type='usb'" added if bus/device are specified: <interface type='hostdev'> <source> <address type='usb' bus='0' device='4'/> </source> <mac address='00:11:22:33:44:55'/> </interface> If the vendor/product form of usb specification is used, type='usb' is implied: <interface type='hostdev'> <source> <vendor id='0x0012'/> <product id='0x24dd'/> </source> <mac address='00:11:22:33:44:55'/> </interface> Again, the upcoming patch to fill in the backend of this functionality will log an error and fail with "Unsupported Config" if you actually try to assign a USB network adapter to a guest using <interface type='hostdev'> - just use a standard <hostdev> entry in that case (and also for single-port PCI adapters).
2012-02-15 17:37:15 +00:00
<choice>
<group>
<ref name="usbproduct"/>
<optional>
<ref name="usbaddress"/>
</optional>
</group>
<element name="address">
<choice>
<group>
<attribute name="type">
<value>pci</value>
</attribute>
<ref name="pciaddress"/>
</group>
<group>
<attribute name="type">
<value>usb</value>
</attribute>
<attribute name="bus">
<ref name="usbAddr"/>
</attribute>
<attribute name="device">
<ref name="usbPort"/>
</attribute>
</group>
</choice>
</element>
</choice>
</element>
<optional>
<ref name="virtualPortProfile"/>
</optional>
<ref name="interface-options"/>
</interleave>
</group>
</choice>
</element>
</define>
<!--
The interface options possible are:
- the MAC address
- the IP address bound to the interface
- the name of the script used to set up the binding
- the target device used
- boot order
-->
<define name="interface-options">
<interleave>
<optional>
<element name="target">
<attribute name="dev">
<ref name="deviceName"/>
</attribute>
<empty/>
</element>
</optional>
<optional>
<element name="guest">
<interleave>
<optional>
<attribute name="dev">
<ref name="deviceName"/>
</attribute>
</optional>
<optional>
<attribute name="actual">
<ref name="deviceName"/>
</attribute>
</optional>
</interleave>
<empty/>
</element>
</optional>
<optional>
<element name="mac">
<attribute name="address">
<ref name="uniMacAddr"/>
</attribute>
<empty/>
</element>
</optional>
<optional>
<element name="ip">
<attribute name="address">
<ref name="ipv4Addr"/>
</attribute>
<empty/>
</element>
</optional>
<optional>
<element name="script">
<attribute name="path">
<ref name="filePath"/>
</attribute>
<empty/>
</element>
</optional>
<optional>
<element name="model">
<attribute name="type">
<data type="string">
<param name='pattern'>[a-zA-Z0-9\-_]+</param>
</data>
</attribute>
<empty/>
</element>
</optional>
<optional>
<element name="backend">
<optional>
<attribute name='tap'>
<ref name='absFilePath'/>
</attribute>
</optional>
<optional>
<attribute name='vhost'>
<ref name='absFilePath'/>
</attribute>
</optional>
</element>
</optional>
<optional>
<element name="driver">
<choice>
<group>
<attribute name="name">
<choice>
<value>kvm</value>
<value>vfio</value>
</choice>
</attribute>
</group>
<group>
<optional>
<attribute name="name">
<choice>
<value>qemu</value>
<value>vhost</value>
</choice>
</attribute>
</optional>
<optional>
<attribute name='queues'>
<ref name="positiveInteger"/>
</attribute>
</optional>
<optional>
<attribute name="txmode">
<choice>
<value>iothread</value>
<value>timer</value>
</choice>
</attribute>
</optional>
<optional>
<ref name="ioeventfd"/>
</optional>
<optional>
<ref name="event_idx"/>
</optional>
</group>
</choice>
<interleave>
<optional>
<element name='host'>
<optional>
<attribute name='csum'>
<ref name="virOnOff"/>
</attribute>
</optional>
<optional>
<attribute name='gso'>
<ref name="virOnOff"/>
</attribute>
</optional>
<optional>
<attribute name='tso4'>
<ref name="virOnOff"/>
</attribute>
</optional>
<optional>
<attribute name='tso6'>
<ref name="virOnOff"/>
</attribute>
</optional>
<optional>
<attribute name='ecn'>
<ref name="virOnOff"/>
</attribute>
</optional>
<optional>
<attribute name='ufo'>
<ref name="virOnOff"/>
</attribute>
</optional>
</element>
</optional>
<optional>
<element name='guest'>
<optional>
<attribute name='csum'>
<ref name="virOnOff"/>
</attribute>
</optional>
<optional>
<attribute name='tso4'>
<ref name="virOnOff"/>
</attribute>
</optional>
<optional>
<attribute name='tso6'>
<ref name="virOnOff"/>
</attribute>
</optional>
<optional>
<attribute name='ecn'>
<ref name="virOnOff"/>
</attribute>
</optional>
<optional>
<attribute name='ufo'>
<ref name="virOnOff"/>
</attribute>
</optional>
</element>
</optional>
</interleave>
</element>
</optional>
<optional>
<ref name="alias"/>
</optional>
<optional>
<ref name="address"/>
</optional>
<optional>
<element name="filterref">
<ref name="filterref-node-attributes"/>
</element>
</optional>
<optional>
<element name="tune">
<optional>
<!-- size of send buffer for network tap devices -->
<element name="sndbuf">
<ref name="unsignedInt"/>
</element>
</optional>
</element>
</optional>
<optional>
<ref name="deviceBoot"/>
</optional>
<optional>
<ref name="rom"/>
</optional>
<optional>
<ref name="bandwidth"/>
</optional>
conf: add <vlan> element to network and domain interface elements The following config elements now support a <vlan> subelements: within a domain: <interface>, and the <actual> subelement of <interface> within a network: the toplevel, as well as any <portgroup> Each vlan element must have one or more <tag id='n'/> subelements. If there is more than one tag, it is assumed that vlan trunking is being requested. If trunking is required with only a single tag, the attribute "trunk='yes'" should be added to the toplevel <vlan> element. Some examples: <interface type='hostdev'/> <vlan> <tag id='42'/> </vlan> <mac address='52:54:00:12:34:56'/> ... </interface> <network> <name>vlan-net</name> <vlan trunk='yes'> <tag id='30'/> </vlan> <virtualport type='openvswitch'/> </network> <interface type='network'/> <source network='vlan-net'/> ... </interface> <network> <name>trunk-vlan</name> <vlan> <tag id='42'/> <tag id='43'/> </vlan> ... </network> <network> <name>multi</name> ... <portgroup name='production'/> <vlan> <tag id='42'/> </vlan> </portgroup> <portgroup name='test'/> <vlan> <tag id='666'/> </vlan> </portgroup> </network> <interface type='network'/> <source network='multi' portgroup='test'/> ... </interface> IMPORTANT NOTE: As of this patch there is no backend support for the vlan element for *any* network device type. When support is added in later patches, it will only be for those select network types that support setting up a vlan on the host side, without the guest's involvement. (For example, it will be possible to configure a vlan for a guest connected to an openvswitch bridge, but it won't be possible to do that for one that is connected to a standard Linux host bridge.)
2012-08-12 07:51:30 +00:00
<optional>
<ref name="vlan"/>
</optional>
</interleave>
</define>
<!--
An emulator description is just a path to the binary used for the task
-->
<define name="emulator">
<element name="emulator">
<ref name="absFilePath"/>
</element>
</define>
<!--
A graphic description, currently in Xen only 2 types are supported:
- sdl with optional display, xauth and fullscreen
- vnc with a required port and optional listen IP address, password
and keymap
-->
<define name="graphic">
<element name="graphics">
<choice>
<group>
<attribute name="type">
<value>sdl</value>
</attribute>
<optional>
<attribute name="display">
<text/>
</attribute>
</optional>
<optional>
<attribute name="xauth">
<text/>
</attribute>
</optional>
<optional>
<attribute name="fullscreen">
<ref name="virYesNo"/>
</attribute>
</optional>
</group>
<group>
<attribute name="type">
<value>vnc</value>
</attribute>
<choice>
<group>
<optional>
<attribute name="port">
<ref name="PortNumber"/>
</attribute>
</optional>
<optional>
<attribute name="autoport">
<ref name="virYesNo"/>
</attribute>
</optional>
<optional>
<attribute name="websocket">
<ref name="PortNumber"/>
</attribute>
</optional>
<optional>
<attribute name="listen">
<ref name="addrIPorName"/>
</attribute>
</optional>
<optional>
<attribute name='sharePolicy'>
<choice>
<value>allow-exclusive</value>
<value>force-shared</value>
<value>ignore</value>
</choice>
</attribute>
</optional>
</group>
<group>
<optional>
<attribute name="socket">
<ref name="absFilePath"/>
</attribute>
</optional>
</group>
</choice>
<optional>
<attribute name="passwd">
<text/>
</attribute>
</optional>
<optional>
<attribute name="keymap">
<text/>
</attribute>
</optional>
<optional>
<attribute name="passwdValidTo">
<data type="dateTime"/>
</attribute>
</optional>
<optional>
<attribute name="connected">
<choice>
<value>keep</value>
</choice>
</attribute>
</optional>
<ref name="listenElements"/>
</group>
<group>
<attribute name="type">
<value>spice</value>
</attribute>
<optional>
<attribute name="port">
<ref name="PortNumber"/>
</attribute>
</optional>
<optional>
<attribute name="tlsPort">
<ref name="PortNumber"/>
</attribute>
</optional>
<optional>
<attribute name="autoport">
<ref name="virYesNo"/>
</attribute>
</optional>
<optional>
<attribute name="listen">
<ref name="addrIPorName"/>
</attribute>
</optional>
<optional>
<attribute name="passwd">
<text/>
</attribute>
</optional>
<optional>
<attribute name="keymap">
<text/>
</attribute>
</optional>
<optional>
<attribute name="passwdValidTo">
<data type="dateTime"/>
</attribute>
</optional>
<optional>
<attribute name="connected">
<choice>
<value>fail</value>
<value>disconnect</value>
<value>keep</value>
</choice>
</attribute>
</optional>
<optional>
<attribute name="defaultMode">
<choice>
<value>any</value>
<value>secure</value>
<value>insecure</value>
</choice>
</attribute>
</optional>
<interleave>
<ref name="listenElements"/>
<zeroOrMore>
<element name="channel">
<attribute name="name">
<choice>
<value>main</value>
<value>display</value>
<value>inputs</value>
<value>cursor</value>
<value>playback</value>
<value>record</value>
<value>smartcard</value>
<value>usbredir</value>
</choice>
</attribute>
<attribute name="mode">
<choice>
<value>any</value>
<value>secure</value>
<value>insecure</value>
</choice>
</attribute>
<empty/>
</element>
</zeroOrMore>
<optional>
<element name="image">
<attribute name="compression">
<choice>
<value>auto_glz</value>
<value>auto_lz</value>
<value>quic</value>
<value>glz</value>
<value>lz</value>
<value>off</value>
</choice>
</attribute>
<empty/>
</element>
</optional>
<optional>
<element name="jpeg">
<attribute name="compression">
<choice>
<value>auto</value>
<value>never</value>
<value>always</value>
</choice>
</attribute>
<empty/>
</element>
</optional>
<optional>
<element name="zlib">
<attribute name="compression">
<choice>
<value>auto</value>
<value>never</value>
<value>always</value>
</choice>
</attribute>
<empty/>
</element>
</optional>
<optional>
<element name="playback">
<attribute name="compression">
<ref name="virOnOff"/>
</attribute>
<empty/>
</element>
</optional>
<optional>
<element name="streaming">
<attribute name="mode">
<choice>
<value>filter</value>
<value>all</value>
<value>off</value>
</choice>
</attribute>
<empty/>
</element>
</optional>
<optional>
<element name="clipboard">
<attribute name="copypaste">
<ref name="virYesNo"/>
</attribute>
<empty/>
</element>
</optional>
<optional>
<element name="mouse">
<attribute name="mode">
<choice>
<value>server</value>
<value>client</value>
</choice>
</attribute>
<empty/>
</element>
</optional>
<optional>
<element name="filetransfer">
<attribute name="enable">
<ref name="virYesNo"/>
</attribute>
<empty/>
</element>
</optional>
</interleave>
</group>
<group>
<attribute name="type">
<value>rdp</value>
</attribute>
<optional>
<attribute name="port">
<ref name="PortNumber"/>
</attribute>
</optional>
<optional>
<attribute name="autoport">
<ref name="virYesNo"/>
</attribute>
</optional>
<optional>
<attribute name="replaceUser">
<ref name="virYesNo"/>
</attribute>
</optional>
<optional>
<attribute name="multiUser">
<ref name="virYesNo"/>
</attribute>
</optional>
<optional>
<attribute name="listen">
<ref name="addrIPorName"/>
</attribute>
</optional>
<ref name="listenElements"/>
</group>
<group>
<attribute name="type">
<value>desktop</value>
</attribute>
<optional>
<attribute name="display">
<text/>
</attribute>
</optional>
<optional>
<attribute name="fullscreen">
<ref name="virYesNo"/>
</attribute>
</optional>
</group>
</choice>
</element>
</define>
<define name="listenElements">
<zeroOrMore>
<element name="listen">
<choice>
<group>
<attribute name="type">
<value>address</value>
</attribute>
<attribute name="address">
<ref name="addrIPorName"/>
</attribute>
</group>
<group>
<attribute name="type">
<value>network</value>
</attribute>
<attribute name="network">
<text/>
</attribute>
<optional>
<attribute name="address">
<ref name="addrIPorName"/>
</attribute>
</optional>
</group>
</choice>
</element>
</zeroOrMore>
</define>
<!--
A video adapter description, allowing configuration of device
model, number of virtual heads, video ram size, and for qxl
both ram bar sizes.
-->
<define name="video">
<element name="video">
<optional>
<element name="model">
<choice>
<attribute name="type">
<choice>
<value>vga</value>
<value>cirrus</value>
<value>vmvga</value>
<value>xen</value>
<value>vbox</value>
</choice>
</attribute>
<group>
<attribute name="type">
<value>qxl</value>
</attribute>
<optional>
<attribute name="ram">
<ref name="unsignedInt"/>
</attribute>
</optional>
</group>
</choice>
<optional>
<attribute name="vram">
<ref name="unsignedInt"/>
</attribute>
</optional>
<optional>
<attribute name="heads">
<ref name="unsignedInt"/>
</attribute>
</optional>
<optional>
<attribute name="primary">
<ref name="virYesNo"/>
</attribute>
</optional>
<optional>
<element name="acceleration">
<optional>
<attribute name="accel3d">
<ref name="virYesNo"/>
</attribute>
</optional>
<optional>
<attribute name="accel2d">
<ref name="virYesNo"/>
</attribute>
</optional>
</element>
</optional>
</element>
</optional>
<optional>
<ref name="alias"/>
</optional>
<optional>
<ref name="address"/>
</optional>
</element>
</define>
<!--
When a certain event happens, multiple policies can be applied
depends on what happened:
-->
<define name="events">
<interleave>
<optional>
<element name="on_reboot">
<ref name="offOptions"/>
</element>
</optional>
<optional>
<element name="on_poweroff">
<ref name="offOptions"/>
</element>
</optional>
<optional>
<element name="on_crash">
<ref name="crashOptions"/>
</element>
</optional>
<optional>
<element name="on_lockfailure">
<ref name="lockfailureOptions"/>
</element>
</optional>
</interleave>
</define>
<!--
Options when a domain terminates:
destroy: The domain is cleaned up
restart: A new domain is started in place of the old one
preserve: The domain will remain in memory until it is destroyed manually
rename-restart: a variant of the previous one but where the old domain is
renamed before being saved to allow a restart
-->
<define name="offOptions">
<choice>
<value>destroy</value>
<value>restart</value>
<value>preserve</value>
<value>rename-restart</value>
</choice>
</define>
<!--
Options when a domain crashes:
destroy: The domain is cleaned up
restart: A new domain is started in place of the old one
preserve: The domain will remain in memory until it is destroyed manually
rename-restart: a variant of the previous one but where the old domain is
renamed before being saved to allow a restart
coredump-destroy: The crashed domain's core will be dumped, and then the
domain will be terminated completely and all resources
released
coredump-restart: The crashed domain's core will be dumped, and then the
domain will be restarted with the same configuration
-->
<define name="crashOptions">
<choice>
<value>destroy</value>
<value>restart</value>
<value>preserve</value>
<value>rename-restart</value>
<value>coredump-destroy</value>
<value>coredump-restart</value>
</choice>
</define>
<!--
Options when resource locks are lost:
poweroff: power off the domain
restart: power off the domain and start it up again to reacquire the
locks
pause: pause the execution of the domain so that it can be manually
resumed when lock issues are solved
ignore: keep the domain running
-->
<define name="lockfailureOptions">
<choice>
<value>poweroff</value>
<value>restart</value>
<value>pause</value>
<value>ignore</value>
</choice>
</define>
<!--
Control ACPI sleep states (dis)allowed for the domain
For each of the states the following rules apply:
on: the state will be forcefully enabled
off: the state will be forcefully disabled
not specified: hypervisor will be left to decide its defaults
-->
<define name="pm">
<element name="pm">
<interleave>
<optional>
<element name="suspend-to-mem">
<ref name="suspendChoices"/>
</element>
</optional>
<optional>
<element name="suspend-to-disk">
<ref name="suspendChoices"/>
</element>
</optional>
</interleave>
<empty/>
</element>
</define>
<define name="suspendChoices">
<optional>
<attribute name="enabled">
<ref name="virYesNo"/>
</attribute>
</optional>
</define>
<!--
Specific setup for a qemu emulated character device. Note: this
definition doesn't fully specify the constraints on this node.
-->
<define name="qemucdev">
<ref name="qemucdevSrcType"/>
<optional>
<attribute name="tty">
<ref name="absFilePath"/>
</attribute>
</optional>
<interleave>
<ref name="qemucdevSrcDef"/>
<optional>
<ref name="qemucdevTgtDef"/>
</optional>
<optional>
<ref name="alias"/>
</optional>
<optional>
<ref name="address"/>
</optional>
</interleave>
</define>
<define name="qemucdevConsoleTgtType">
<attribute name="type">
<choice>
<value>xen</value>
<value>serial</value>
<value>uml</value>
<value>virtio</value>
<value>lxc</value>
<value>openvz</value>
<value>sclp</value>
<value>sclplm</value>
</choice>
</attribute>
</define>
<define name='qemucdevSerialTgtType'>
<attribute name='type'>
<choice>
<value>isa-serial</value>
<value>usb-serial</value>
</choice>
</attribute>
</define>
<define name="qemucdevTgtDef">
<element name="target">
<interleave>
<choice>
<optional>
<ref name="qemucdevConsoleTgtType"/>
</optional>
<optional>
<ref name="qemucdevSerialTgtType"/>
</optional>
</choice>
<optional>
<attribute name="port"/>
</optional>
</interleave>
</element>
</define>
<define name="qemucdevSrcTypeChoice">
<choice>
<value>dev</value>
<value>file</value>
<value>pipe</value>
<value>unix</value>
<value>tcp</value>
<value>udp</value>
<value>null</value>
<value>stdio</value>
<value>vc</value>
<value>pty</value>
<value>spicevmc</value>
<value>spiceport</value>
<value>nmdm</value>
</choice>
</define>
<define name="usbdevfilter">
<element name="usbdev">
<attribute name="allow">
<ref name="virYesNo"/>
</attribute>
<optional>
<attribute name="class">
<choice>
<ref name="usbClass"/>
<ref name="usbIdDefault"/>
</choice>
</attribute>
</optional>
<optional>
<attribute name="vendor">
<choice>
<ref name="usbId"/>
<ref name="usbIdDefault"/>
</choice>
</attribute>
</optional>
<optional>
<attribute name="product">
<choice>
<ref name="usbId"/>
<ref name="usbIdDefault"/>
</choice>
</attribute>
</optional>
<optional>
<attribute name="version">
<choice>
<ref name="usbVersion"/>
<ref name="usbIdDefault"/>
</choice>
</attribute>
</optional>
</element>
</define>
<define name="qemucdevSrcType">
<attribute name="type">
<ref name="qemucdevSrcTypeChoice"/>
</attribute>
</define>
<define name="qemucdevSrcDef">
<zeroOrMore>
<element name="source">
<optional>
<attribute name="mode"/>
</optional>
<optional>
<attribute name="path"/>
</optional>
<optional>
<attribute name="host"/>
</optional>
<optional>
<attribute name="service"/>
</optional>
<optional>
<attribute name="wiremode"/>
</optional>
<optional>
<attribute name="channel"/>
</optional>
<optional>
<attribute name="master"/>
</optional>
<optional>
<attribute name="slave"/>
</optional>
<optional>
<ref name='devSeclabel'/>
</optional>
</element>
</zeroOrMore>
<optional>
<element name="protocol">
<optional>
<attribute name="type">
<choice>
<value>raw</value>
<value>telnet</value>
<value>telnets</value>
<value>tls</value>
</choice>
</attribute>
</optional>
</element>
</optional>
</define>
<!--
The description for a console
just a tty device
-->
<define name="console">
<element name="console">
<choice>
<group>
<optional>
<attribute name="tty">
<ref name="absFilePath"/>
</attribute>
</optional>
<empty/>
</group>
<choice>
<ref name="qemucdev"/>
</choice>
</choice>
</element>
</define>
<define name="codec">
<element name="codec">
<attribute name="type">
<choice>
<value>duplex</value>
<value>micro</value>
</choice>
</attribute>
</element>
</define>
<define name="sound">
<element name="sound">
<attribute name="model">
<choice>
<value>sb16</value>
<value>es1370</value>
<value>pcspk</value>
<value>ac97</value>
<value>ich6</value>
<value>ich9</value>
<value>usb</value>
</choice>
</attribute>
<interleave>
<optional>
<ref name="alias"/>
</optional>
<optional>
<ref name="address"/>
</optional>
<zeroOrMore>
<choice>
<ref name="codec"/>
</choice>
</zeroOrMore>
</interleave>
</element>
</define>
<define name="watchdog">
<element name="watchdog">
<attribute name="model">
<choice>
<value>i6300esb</value>
<value>ib700</value>
</choice>
</attribute>
<optional>
<attribute name="action">
<choice>
<value>reset</value>
<value>shutdown</value>
<value>poweroff</value>
<value>pause</value>
<value>none</value>
<value>dump</value>
</choice>
</attribute>
</optional>
<optional>
<ref name="alias"/>
</optional>
<optional>
<ref name="address"/>
</optional>
</element>
</define>
<define name="nvram">
<element name="nvram">
<optional>
<ref name="address"/>
</optional>
</element>
</define>
<define name="memballoon">
<element name="memballoon">
<attribute name="model">
<choice>
<value>virtio</value>
<value>xen</value>
<value>none</value>
</choice>
</attribute>
<optional>
<ref name="alias"/>
</optional>
<optional>
<ref name="address"/>
</optional>
<optional>
<element name="stats">
<attribute name="period">
<ref name="positiveInteger"/>
</attribute>
</element>
</optional>
</element>
</define>
<define name="parallel">
<element name="parallel">
<ref name="qemucdev"/>
</element>
</define>
<define name="serial">
<element name="serial">
<ref name="qemucdev"/>
</element>
</define>
<define name="guestfwdTarget">
<element name="target">
<attribute name="type">
<value>guestfwd</value>
</attribute>
<attribute name="address"/>
<attribute name="port"/>
</element>
</define>
<define name="virtioTarget">
<element name="target">
<attribute name="type">
<value>virtio</value>
</attribute>
<optional>
<attribute name="name"/>
</optional>
</element>
</define>
<define name="channel">
<element name="channel">
<ref name="qemucdevSrcType"/>
<interleave>
<ref name="qemucdevSrcDef"/>
<choice>
<ref name="guestfwdTarget"/>
<ref name="virtioTarget"/>
</choice>
<optional>
<ref name="alias"/>
</optional>
<optional>
<ref name="address"/>
</optional>
</interleave>
</element>
</define>
<define name="smartcard">
<element name="smartcard">
<choice>
<group>
<attribute name="mode">
<value>host</value>
</attribute>
<!-- might need to add optional database element here later -->
</group>
<group>
<attribute name="mode">
<value>host-certificates</value>
</attribute>
<ref name='certificate'/>
<ref name='certificate'/>
<ref name='certificate'/>
<optional>
<element name="database">
<ref name="absDirPath"/>
</element>
</optional>
</group>
<group>
<attribute name="mode">
<value>passthrough</value>
</attribute>
<ref name="qemucdevSrcType"/>
<interleave>
<ref name="qemucdevSrcDef"/>
<optional>
<ref name="qemucdevTgtDef"/>
</optional>
</interleave>
</group>
</choice>
<optional>
<ref name="alias"/>
</optional>
<optional>
<ref name="address"/>
</optional>
</element>
</define>
<define name="certificate">
<element name="certificate">
<text/>
</element>
</define>
<define name="tpm">
<element name="tpm">
<optional>
<attribute name="model">
<choice>
<value>tpm-tis</value>
</choice>
</attribute>
</optional>
<ref name="tpm-backend"/>
<optional>
<ref name="alias"/>
</optional>
</element>
</define>
<define name="tpm-backend">
<element name="backend">
<choice>
<group>
<attribute name="type">
<value>passthrough</value>
</attribute>
<ref name="tpm-passthrough-device"/>
</group>
</choice>
</element>
</define>
<define name="tpm-passthrough-device">
<optional>
<element name="device">
<optional>
<attribute name="path">
<ref name="filePath"/>
</attribute>
</optional>
</element>
</optional>
</define>
<define name="input">
<element name="input">
<attribute name="type">
<choice>
<value>tablet</value>
<value>mouse</value>
<value>keyboard</value>
</choice>
</attribute>
<optional>
<attribute name="bus">
<choice>
<value>ps2</value>
<value>usb</value>
<value>xen</value>
</choice>
</attribute>
</optional>
<optional>
<ref name="alias"/>
</optional>
<optional>
<ref name="address"/>
</optional>
</element>
</define>
<define name="hub">
<element name="hub">
<attribute name="type">
<choice>
<value>usb</value>
</choice>
</attribute>
<optional>
<ref name="alias"/>
</optional>
<optional>
<ref name="address"/>
</optional>
</element>
</define>
<define name="redirdev">
<element name="redirdev">
<attribute name="bus">
<choice>
<value>usb</value>
</choice>
</attribute>
<attribute name="type">
<ref name="qemucdevSrcTypeChoice"/>
</attribute>
<ref name="qemucdevSrcDef"/>
<optional>
<ref name="alias"/>
</optional>
<optional>
<ref name="address"/>
</optional>
<optional>
<ref name="deviceBoot"/>
</optional>
</element>
</define>
<define name="redirfilter">
<element name="redirfilter">
<zeroOrMore>
<ref name="usbdevfilter"/>
</zeroOrMore>
</element>
</define>
<define name="hostdev">
<element name="hostdev">
2013-05-03 18:07:24 +00:00
<interleave>
<choice>
<group>
<ref name="hostdevsubsys"/>
</group>
<group>
<ref name="hostdevcaps"/>
</group>
</choice>
<optional>
<ref name="alias"/>
</optional>
<optional>
<ref name="deviceBoot"/>
</optional>
<optional>
<ref name="rom"/>
</optional>
<optional>
<ref name="address"/>
</optional>
<optional>
<element name="readonly">
<empty/>
</element>
</optional>
<optional>
<element name="shareable">
<empty/>
</element>
</optional>
2013-05-03 18:07:24 +00:00
</interleave>
</element>
</define>
<define name="hostdevsubsys">
<optional>
<attribute name="mode">
<value>subsystem</value>
</attribute>
</optional>
<optional>
<attribute name="managed">
<ref name="virYesNo"/>
</attribute>
</optional>
<choice>
<ref name="hostdevsubsyspci"/>
<ref name="hostdevsubsysusb"/>
<ref name="hostdevsubsysscsi"/>
</choice>
</define>
<define name="hostdevcaps">
<attribute name="mode">
<value>capabilities</value>
</attribute>
<choice>
<group>
<ref name="hostdevcapsstorage"/>
</group>
<group>
<ref name="hostdevcapsmisc"/>
</group>
<group>
<ref name="hostdevcapsnet"/>
</group>
</choice>
</define>
<define name="hostdevsubsyspci">
<attribute name="type">
<value>pci</value>
</attribute>
<interleave>
<optional>
<element name="driver">
<attribute name="name">
<choice>
<value>kvm</value>
<value>vfio</value>
<value>xen</value>
</choice>
</attribute>
<empty/>
</element>
</optional>
<element name="source">
<optional>
<ref name="startupPolicy"/>
</optional>
<element name="address">
<ref name="pciaddress"/>
</element>
</element>
</interleave>
</define>
<define name="hostdevsubsysusb">
<attribute name="type">
<value>usb</value>
</attribute>
<element name="source">
<optional>
<ref name="startupPolicy"/>
</optional>
<choice>
<group>
<ref name="usbproduct"/>
<optional>
<ref name="usbaddress"/>
</optional>
</group>
<ref name="usbaddress"/>
</choice>
</element>
</define>
<define name="hostdevsubsysscsi">
<attribute name="type">
<value>scsi</value>
</attribute>
<optional>
<attribute name="sgio">
<choice>
<value>filtered</value>
<value>unfiltered</value>
</choice>
</attribute>
</optional>
<optional>
<ref name="rawIO"/>
</optional>
<element name="source">
<choice>
<group> <!-- scsi_host adapter -->
<optional>
<attribute name="protocol">
<choice>
<value>adapter</value> <!-- scsi_host, default, optional -->
</choice>
</attribute>
</optional>
<interleave>
<ref name="sourceinfoadapter"/>
<element name="address">
<ref name="scsiaddress"/>
</element>
</interleave>
</group>
<group> <!-- iscsi adapter -->
<attribute name="protocol">
<choice>
<value>iscsi</value> <!-- iscsi, required -->
</choice>
</attribute>
<attribute name="name">
<text/>
</attribute>
<interleave>
<oneOrMore>
<element name='host'>
<attribute name='name'>
<text/>
</attribute>
<optional>
<attribute name='port'>
<ref name="PortNumber"/>
</attribute>
</optional>
<empty/>
</element>
</oneOrMore>
<optional>
<ref name='diskAuth'/>
</optional>
</interleave>
</group>
</choice>
</element>
</define>
<define name="hostdevcapsstorage">
<attribute name="type">
<value>storage</value>
</attribute>
<element name="source">
<element name="block">
<ref name="absFilePath"/>
</element>
</element>
</define>
<define name="hostdevcapsmisc">
<attribute name="type">
<value>misc</value>
</attribute>
<element name="source">
<element name="char">
<ref name="absFilePath"/>
</element>
</element>
</define>
<define name="hostdevcapsnet">
<attribute name="type">
<value>net</value>
</attribute>
<element name="source">
<element name="interface">
<ref name="deviceName"/>
</element>
</element>
</define>
<define name="usbproduct">
<element name="vendor">
<attribute name="id">
<ref name="usbId"/>
</attribute>
</element>
<element name="product">
<attribute name="id">
<ref name="usbId"/>
</attribute>
</element>
</define>
<define name="usbaddress">
<element name="address">
<attribute name="bus">
<ref name="usbAddr"/>
</attribute>
<attribute name="device">
<ref name="usbPort"/>
</attribute>
</element>
</define>
<define name="scsiaddress">
<attribute name="bus">
<ref name="driveBus"/>
</attribute>
<attribute name="target">
<ref name="driveTarget"/>
</attribute>
<attribute name="unit">
<ref name="driveUnit"/>
</attribute>
</define>
<define name="usbportaddress">
<attribute name="bus">
<ref name="usbAddr"/>
</attribute>
<attribute name="port">
<ref name="usbPort"/>
</attribute>
</define>
<define name="spaprvioaddress">
<optional>
<attribute name="reg">
<ref name="spaprvioReg"/>
</attribute>
</optional>
</define>
<define name="ccwaddress">
<optional>
<attribute name="cssid">
<ref name="ccwCssidRange"/>
</attribute>
<attribute name="ssid">
<ref name="ccwSsidRange"/>
</attribute>
<attribute name="devno">
<ref name="ccwDevnoRange"/>
</attribute>
</optional>
</define>
<define name="driveaddress">
<optional>
<attribute name="controller">
<ref name="driveController"/>
</attribute>
</optional>
<optional>
<attribute name="bus">
<ref name="driveBus"/>
</attribute>
</optional>
<optional>
<attribute name="target">
<ref name="driveTarget"/>
</attribute>
</optional>
<optional>
<attribute name="unit">
<ref name="driveUnit"/>
</attribute>
</optional>
</define>
<define name="virtioserialaddress">
<attribute name="controller">
<ref name="driveController"/>
</attribute>
<optional>
<attribute name="bus">
<ref name="driveBus"/>
</attribute>
</optional>
<optional>
<attribute name="port">
<ref name="driveUnit"/>
</attribute>
</optional>
</define>
<define name="ccidaddress">
<attribute name="controller">
<ref name="driveController"/>
</attribute>
<optional>
<attribute name="slot">
<ref name="driveUnit"/>
</attribute>
</optional>
</define>
<define name="devices">
<element name="devices">
<interleave>
<optional>
<ref name="emulator"/>
</optional>
<zeroOrMore>
<choice>
<ref name="disk"/>
<ref name="controller"/>
<ref name="lease"/>
<ref name="filesystem"/>
<ref name="interface"/>
<ref name="input"/>
<ref name="sound"/>
<ref name="hostdev"/>
<ref name="graphic"/>
<ref name="video"/>
<ref name="console"/>
<ref name="parallel"/>
<ref name="serial"/>
<ref name="channel"/>
<ref name="smartcard"/>
<ref name="hub"/>
<ref name="redirdev"/>
<ref name="redirfilter"/>
<ref name="rng"/>
<ref name="tpm"/>
</choice>
</zeroOrMore>
<optional>
<ref name="watchdog"/>
</optional>
<optional>
<ref name="memballoon"/>
</optional>
<optional>
<ref name="nvram"/>
</optional>
<optional>
<ref name="panic"/>
</optional>
</interleave>
</element>
</define>
<!--
A set of optional features: PAE, APIC, ACPI,
HyperV Enlightenment, KVM features, paravirtual spinlocks and HAP support
-->
<define name="features">
<optional>
<element name="features">
<interleave>
<optional>
<element name="pae">
<empty/>
</element>
</optional>
<optional>
<element name="apic">
<optional>
<attribute name="eoi">
<ref name="virOnOff"/>
</attribute>
</optional>
</element>
</optional>
<optional>
<element name="acpi">
<empty/>
</element>
</optional>
<optional>
<element name="hap">
<empty/>
</element>
</optional>
<optional>
<ref name="hyperv"/>
</optional>
<optional>
<element name="viridian">
<empty/>
</element>
</optional>
<optional>
<ref name="kvm"/>
</optional>
<optional>
<element name="privnet">
<empty/>
</element>
</optional>
<optional>
<element name="pvspinlock">
<optional>
<ref name="featurestate"/>
</optional>
<empty/>
</element>
</optional>
<optional>
<ref name="capabilities"/>
</optional>
</interleave>
</element>
</optional>
</define>
<!--
CPU specification
-->
<define name="cpu">
<element name="cpu">
<choice>
<group>
<interleave>
<optional>
<ref name="cpuTopology"/>
</optional>
<optional>
<ref name="cpuNuma"/>
</optional>
</interleave>
</group>
<group>
Add support for cpu mode attribute The mode can be either of "custom" (default), "host-model", "host-passthrough". The semantics of each mode is described in the following examples: - guest CPU is a default model with specified topology: <cpu> <topology sockets='1' cores='2' threads='1'/> </cpu> - guest CPU matches selected model: <cpu mode='custom' match='exact'> <model>core2duo</model> </cpu> - guest CPU should be a copy of host CPU as advertised by capabilities XML (this is a short cut for manually copying host CPU specification from capabilities to domain XML): <cpu mode='host-model'/> In case a hypervisor does not support the exact host model, libvirt automatically falls back to a closest supported CPU model and removes/adds features to match host. This behavior can be disabled by <cpu mode='host-model'> <model fallback='forbid'/> </cpu> - the same as previous returned by virDomainGetXMLDesc with VIR_DOMAIN_XML_UPDATE_CPU flag: <cpu mode='host-model' match='exact'> <model fallback='allow'>Penryn</model> --+ <vendor>Intel</vendor> | <topology sockets='2' cores='4' threads='1'/> + copied from <feature policy='require' name='dca'/> | capabilities XML <feature policy='require' name='xtpr'/> | ... --+ </cpu> - guest CPU should be exactly the same as host CPU even in the aspects libvirt doesn't model (such domain cannot be migrated unless both hosts contain exactly the same CPUs): <cpu mode='host-passthrough'/> - the same as previous returned by virDomainGetXMLDesc with VIR_DOMAIN_XML_UPDATE_CPU flag: <cpu mode='host-passthrough' match='minimal'> <model>Penryn</model> --+ copied from caps <vendor>Intel</vendor> | XML but doesn't <topology sockets='2' cores='4' threads='1'/> | describe all <feature policy='require' name='dca'/> | aspects of the <feature policy='require' name='xtpr'/> | actual guest CPU ... --+ </cpu>
2011-08-18 10:14:36 +00:00
<ref name="cpuMode"/>
<interleave>
<optional>
<ref name="cpuModel"/>
</optional>
<optional>
<ref name="cpuNuma"/>
</optional>
</interleave>
</group>
<group>
<optional>
<ref name="cpuMode"/>
</optional>
<ref name="cpuMatch"/>
<interleave>
<ref name="cpuModel"/>
<optional>
<ref name="cpuVendor"/>
</optional>
<optional>
<ref name="cpuTopology"/>
</optional>
<zeroOrMore>
<ref name="cpuFeature"/>
</zeroOrMore>
<optional>
<ref name="cpuNuma"/>
</optional>
</interleave>
</group>
</choice>
</element>
</define>
Add support for cpu mode attribute The mode can be either of "custom" (default), "host-model", "host-passthrough". The semantics of each mode is described in the following examples: - guest CPU is a default model with specified topology: <cpu> <topology sockets='1' cores='2' threads='1'/> </cpu> - guest CPU matches selected model: <cpu mode='custom' match='exact'> <model>core2duo</model> </cpu> - guest CPU should be a copy of host CPU as advertised by capabilities XML (this is a short cut for manually copying host CPU specification from capabilities to domain XML): <cpu mode='host-model'/> In case a hypervisor does not support the exact host model, libvirt automatically falls back to a closest supported CPU model and removes/adds features to match host. This behavior can be disabled by <cpu mode='host-model'> <model fallback='forbid'/> </cpu> - the same as previous returned by virDomainGetXMLDesc with VIR_DOMAIN_XML_UPDATE_CPU flag: <cpu mode='host-model' match='exact'> <model fallback='allow'>Penryn</model> --+ <vendor>Intel</vendor> | <topology sockets='2' cores='4' threads='1'/> + copied from <feature policy='require' name='dca'/> | capabilities XML <feature policy='require' name='xtpr'/> | ... --+ </cpu> - guest CPU should be exactly the same as host CPU even in the aspects libvirt doesn't model (such domain cannot be migrated unless both hosts contain exactly the same CPUs): <cpu mode='host-passthrough'/> - the same as previous returned by virDomainGetXMLDesc with VIR_DOMAIN_XML_UPDATE_CPU flag: <cpu mode='host-passthrough' match='minimal'> <model>Penryn</model> --+ copied from caps <vendor>Intel</vendor> | XML but doesn't <topology sockets='2' cores='4' threads='1'/> | describe all <feature policy='require' name='dca'/> | aspects of the <feature policy='require' name='xtpr'/> | actual guest CPU ... --+ </cpu>
2011-08-18 10:14:36 +00:00
<define name="cpuMode">
<attribute name="mode">
<choice>
<value>custom</value>
<value>host-model</value>
<value>host-passthrough</value>
</choice>
</attribute>
</define>
<define name="cpuMatch">
<attribute name="match">
<choice>
<value>minimum</value>
<value>exact</value>
<value>strict</value>
</choice>
</attribute>
</define>
<define name="cpuModel">
<element name="model">
<optional>
<attribute name="fallback">
<choice>
<value>allow</value>
<value>forbid</value>
</choice>
</attribute>
</optional>
<optional>
<attribute name="vendor_id">
<data type="string">
<param name='pattern'>[^,]{12}</param>
</data>
</attribute>
</optional>
Add support for cpu mode attribute The mode can be either of "custom" (default), "host-model", "host-passthrough". The semantics of each mode is described in the following examples: - guest CPU is a default model with specified topology: <cpu> <topology sockets='1' cores='2' threads='1'/> </cpu> - guest CPU matches selected model: <cpu mode='custom' match='exact'> <model>core2duo</model> </cpu> - guest CPU should be a copy of host CPU as advertised by capabilities XML (this is a short cut for manually copying host CPU specification from capabilities to domain XML): <cpu mode='host-model'/> In case a hypervisor does not support the exact host model, libvirt automatically falls back to a closest supported CPU model and removes/adds features to match host. This behavior can be disabled by <cpu mode='host-model'> <model fallback='forbid'/> </cpu> - the same as previous returned by virDomainGetXMLDesc with VIR_DOMAIN_XML_UPDATE_CPU flag: <cpu mode='host-model' match='exact'> <model fallback='allow'>Penryn</model> --+ <vendor>Intel</vendor> | <topology sockets='2' cores='4' threads='1'/> + copied from <feature policy='require' name='dca'/> | capabilities XML <feature policy='require' name='xtpr'/> | ... --+ </cpu> - guest CPU should be exactly the same as host CPU even in the aspects libvirt doesn't model (such domain cannot be migrated unless both hosts contain exactly the same CPUs): <cpu mode='host-passthrough'/> - the same as previous returned by virDomainGetXMLDesc with VIR_DOMAIN_XML_UPDATE_CPU flag: <cpu mode='host-passthrough' match='minimal'> <model>Penryn</model> --+ copied from caps <vendor>Intel</vendor> | XML but doesn't <topology sockets='2' cores='4' threads='1'/> | describe all <feature policy='require' name='dca'/> | aspects of the <feature policy='require' name='xtpr'/> | actual guest CPU ... --+ </cpu>
2011-08-18 10:14:36 +00:00
<choice>
<text/>
<empty/>
</choice>
</element>
</define>
<define name="cpuVendor">
<element name="vendor">
<text/>
</element>
</define>
<define name="cpuFeature">
<element name="feature">
<attribute name="policy">
<choice>
<value>force</value>
<value>require</value>
<value>optional</value>
<value>disable</value>
<value>forbid</value>
</choice>
</attribute>
<attribute name="name">
<ref name="featureName"/>
</attribute>
<empty/>
</element>
</define>
<define name="cpuTopology">
<element name="topology">
<attribute name="sockets">
<ref name="positiveInteger"/>
</attribute>
<attribute name="cores">
<ref name="positiveInteger"/>
</attribute>
<attribute name="threads">
<ref name="positiveInteger"/>
</attribute>
</element>
</define>
<define name="cpuNuma">
<element name="numa">
<oneOrMore>
<ref name="numaCell"/>
</oneOrMore>
</element>
</define>
<define name="numaCell">
<element name="cell">
<optional>
<attribute name="id">
<ref name="unsignedInt"/>
</attribute>
</optional>
<attribute name="cpus">
<ref name="cpuset"/>
</attribute>
<attribute name="memory">
<ref name="memoryKB"/>
</attribute>
<optional>
<attribute name="memAccess">
<choice>
<value>shared</value>
<value>private</value>
</choice>
</attribute>
</optional>
</element>
</define>
<!--
System information specification:
Placeholder for system specific informations likes the ones
contained in the SMBIOS area.
Only a limited subset of entries can be modified there, so we
fully enumerate each case here.
The DMTF spec doesn't specify any string subset, just 0 terminated
byte strings, but better be safe and restrict at least the names
to avoid problems with space normalization in attribute values,
the value is kept as the element body for maximum flexibility.
A priori we allow only type 0 and type 1 string updates
-->
<define name="sysinfo">
<element name="sysinfo">
<attribute name="type">
<value>smbios</value>
</attribute>
<interleave>
<optional>
<element name="bios">
<oneOrMore>
<element name="entry">
<attribute name="name">
<ref name="sysinfo-bios-name"/>
</attribute>
<ref name="sysinfo-value"/>
</element>
</oneOrMore>
</element>
</optional>
<optional>
<element name="system">
<oneOrMore>
<element name="entry">
<attribute name="name">
<ref name="sysinfo-system-name"/>
</attribute>
<ref name="sysinfo-value"/>
</element>
</oneOrMore>
</element>
</optional>
</interleave>
</element>
</define>
<define name="sysinfo-bios-name">
<choice>
<value>vendor</value>
<value>version</value>
<value>date</value>
<value>release</value>
</choice>
</define>
<define name="sysinfo-system-name">
<choice>
<value>manufacturer</value>
<value>product</value>
<value>version</value>
<value>serial</value>
<value>uuid</value>
<value>sku</value>
<value>family</value>
</choice>
</define>
<define name="sysinfo-value">
<data type="string">
<param name='pattern'>[a-zA-Z0-9/\-_\. \(\)]+</param>
</data>
</define>
<define name="smbios">
<element name="smbios">
<attribute name="mode">
<choice>
<value>emulate</value>
<value>host</value>
<value>sysinfo</value>
</choice>
</attribute>
<empty/>
</element>
</define>
<define name="bios">
<element name="bios">
<optional>
<attribute name="useserial">
<ref name="virYesNo"/>
</attribute>
</optional>
<optional>
<attribute name="rebootTimeout">
<ref name="rebootTimeoutDelay"/>
</attribute>
</optional>
</element>
</define>
<define name="address">
<element name="address">
<choice>
<group>
<attribute name="type">
<value>pci</value>
</attribute>
<ref name="pciaddress"/>
</group>
<group>
<attribute name="type">
<value>drive</value>
</attribute>
<ref name="driveaddress"/>
</group>
<group>
<attribute name="type">
<value>virtio-serial</value>
</attribute>
<ref name="virtioserialaddress"/>
</group>
<group>
<attribute name="type">
<value>ccid</value>
</attribute>
<ref name="ccidaddress"/>
</group>
<group>
<attribute name="type">
<value>usb</value>
</attribute>
<ref name="usbportaddress"/>
</group>
<group>
<attribute name="type">
<value>spapr-vio</value>
</attribute>
<ref name="spaprvioaddress"/>
</group>
<group>
<attribute name="type">
<value>ccw</value>
</attribute>
<ref name="ccwaddress"/>
</group>
<group>
<attribute name="type">
<value>isa</value>
</attribute>
<ref name="isaaddress"/>
</group>
</choice>
</element>
</define>
<define name="rom">
<element name="rom">
<optional>
<attribute name="bar">
<ref name="virOnOff"/>
</attribute>
</optional>
<optional>
<attribute name="file">
<ref name="absFilePath"/>
</attribute>
</optional>
<empty/>
</element>
</define>
<define name="rng">
<element name="rng">
<attribute name="model">
<choice>
<value>virtio</value>
</choice>
</attribute>
<interleave>
<ref name="rng-backend"/>
<optional>
<ref name="rng-rate"/>
</optional>
<optional>
<ref name="alias"/>
</optional>
<optional>
<ref name="address"/>
</optional>
</interleave>
</element>
</define>
<define name="rng-backend">
<element name="backend">
<choice>
<group>
<attribute name="model">
<value>random</value>
</attribute>
<choice>
<value>/dev/random</value>
<value>/dev/hwrng</value>
<empty/>
</choice>
</group>
<group>
<attribute name="model">
<value>egd</value>
</attribute>
<ref name="qemucdevSrcType"/>
<ref name="qemucdevSrcDef"/>
</group>
</choice>
</element>
</define>
<define name="rng-rate">
<element name="rate">
<attribute name="bytes">
<ref name="positiveInteger"/>
</attribute>
<optional>
<attribute name="period">
<ref name="positiveInteger"/>
</attribute>
</optional>
<empty/>
</element>
</define>
<define name="usbmaster">
<element name="master">
<attribute name="startport">
<ref name="usbPort"/>
</attribute>
<empty/>
</element>
</define>
<define name="filterref-node-attributes">
<attribute name="filter">
<data type="NCName"/>
</attribute>
<optional>
<element name="parameter">
<attribute name="name">
<ref name="filter-param-name"/>
</attribute>
<attribute name="value">
<ref name="filter-param-value"/>
</attribute>
</element>
</optional>
</define>
<define name="deviceBoot">
<element name="boot">
<attribute name="order">
<ref name="positiveInteger"/>
</attribute>
<empty/>
</element>
</define>
conf: alter disk mirror xml output Now that we track a disk mirror as a virStorageSource, we might as well update the XML to theoretically allow any type of mirroring destination (not just a local file). A later patch will also be reusing <mirror> to track the block commit of the top layer of a chain, which is another case where libvirt needs to update the backing chain after the job is finally pivoted, and since backing chains can have network backing files as the destination to commit into, it makes more sense to display that in the XML. This patch changes output-only XML; it was already documented that <mirror> does not affect a domain definition at this point (because qemu doesn't provide persistent bitmaps yet). Any application that was starting a block copy job with older libvirt and then relying on the domain XML to determine if it was complete will no longer be able to access the file= and format= attributes of mirror that were previously used. However, this is not going to be a problem in practice: the only time a block copy job works is on a transient domain, and any app that is managing a transient domain probably already does enough of its own bookkeeping to know which file it is mirroring into without having to re-read it from the libvirt XML. The one thing that was likely to be used in a mirroring job was the ready= attribute, which is unchanged. Meanwhile, I made sure the schema and parser still accept the old format, even if we no longer output it, so that upgrading from an older version of libvirt is seamless. * docs/schemas/domaincommon.rng (diskMirror): Alter definition. * src/conf/domain_conf.c (virDomainDiskDefParseXML): Parse two styles of mirror elements. (virDomainDiskDefFormat): Output new style. * tests/qemuxml2argvdata/qemuxml2argv-disk-mirror-old.xml: New file, copied from... * tests/qemuxml2argvdata/qemuxml2argv-disk-mirror.xml: ...here before modernizing. * tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-mirror-old*: New files. * tests/qemuxml2xmltest.c (mymain): Test both styles. Signed-off-by: Eric Blake <eblake@redhat.com>
2014-05-22 04:39:57 +00:00
blockjob: enhance xml to track mirrors across libvirtd restart In order to track a block copy job across libvirtd restarts, we need to save internal XML that tracks the name of the file holding the mirror. Displaying this name in dumpxml might also be useful to the user, even if we don't yet have a way to (re-) start a domain with mirroring enabled up front. This is done with a new <mirror> sub-element to <disk>, as in: <disk type='file' device='disk'> <driver name='qemu' type='raw'/> <source file='/var/lib/libvirt/images/original.img'/> <mirror file='/var/lib/libvirt/images/copy.img' format='qcow2' ready='yes'/> ... </disk> For now, the element is output-only, in live domains; it is ignored when defining a domain or hot-plugging a disk (since those contexts use VIR_DOMAIN_XML_INACTIVE in parsing). The 'ready' attribute appears when libvirt knows that the job has changed from the initial pulling phase over to the mirroring phase, although absence of the attribute is not a sure indicator of the current phase. If we come up with a way to make qemu start with mirroring enabled, we can relax the xml restriction, and allow <mirror> (but not attribute 'ready') on input. Testing active-only XML meant tweaking the testsuite slightly, but it was worth it. * docs/schemas/domaincommon.rng (diskspec): Add diskMirror. * docs/formatdomain.html.in (elementsDisks): Document it. * src/conf/domain_conf.h (_virDomainDiskDef): New members. * src/conf/domain_conf.c (virDomainDiskDefFree): Clean them. (virDomainDiskDefParseXML): Parse them, but only internally. (virDomainDiskDefFormat): Output them. * tests/qemuxml2argvdata/qemuxml2argv-disk-mirror.xml: New test file. * tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-mirror.xml: Likewise. * tests/qemuxml2xmltest.c (testInfo): Alter members. (testCompareXMLToXMLHelper): Allow more test control. (mymain): Run new test.
2012-03-29 00:10:18 +00:00
<define name='diskMirror'>
<element name='mirror'>
conf: alter disk mirror xml output Now that we track a disk mirror as a virStorageSource, we might as well update the XML to theoretically allow any type of mirroring destination (not just a local file). A later patch will also be reusing <mirror> to track the block commit of the top layer of a chain, which is another case where libvirt needs to update the backing chain after the job is finally pivoted, and since backing chains can have network backing files as the destination to commit into, it makes more sense to display that in the XML. This patch changes output-only XML; it was already documented that <mirror> does not affect a domain definition at this point (because qemu doesn't provide persistent bitmaps yet). Any application that was starting a block copy job with older libvirt and then relying on the domain XML to determine if it was complete will no longer be able to access the file= and format= attributes of mirror that were previously used. However, this is not going to be a problem in practice: the only time a block copy job works is on a transient domain, and any app that is managing a transient domain probably already does enough of its own bookkeeping to know which file it is mirroring into without having to re-read it from the libvirt XML. The one thing that was likely to be used in a mirroring job was the ready= attribute, which is unchanged. Meanwhile, I made sure the schema and parser still accept the old format, even if we no longer output it, so that upgrading from an older version of libvirt is seamless. * docs/schemas/domaincommon.rng (diskMirror): Alter definition. * src/conf/domain_conf.c (virDomainDiskDefParseXML): Parse two styles of mirror elements. (virDomainDiskDefFormat): Output new style. * tests/qemuxml2argvdata/qemuxml2argv-disk-mirror-old.xml: New file, copied from... * tests/qemuxml2argvdata/qemuxml2argv-disk-mirror.xml: ...here before modernizing. * tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-mirror-old*: New files. * tests/qemuxml2xmltest.c (mymain): Test both styles. Signed-off-by: Eric Blake <eblake@redhat.com>
2014-05-22 04:39:57 +00:00
<choice>
<group> <!-- old format, for block copy back-compat -->
conf: alter disk mirror xml output Now that we track a disk mirror as a virStorageSource, we might as well update the XML to theoretically allow any type of mirroring destination (not just a local file). A later patch will also be reusing <mirror> to track the block commit of the top layer of a chain, which is another case where libvirt needs to update the backing chain after the job is finally pivoted, and since backing chains can have network backing files as the destination to commit into, it makes more sense to display that in the XML. This patch changes output-only XML; it was already documented that <mirror> does not affect a domain definition at this point (because qemu doesn't provide persistent bitmaps yet). Any application that was starting a block copy job with older libvirt and then relying on the domain XML to determine if it was complete will no longer be able to access the file= and format= attributes of mirror that were previously used. However, this is not going to be a problem in practice: the only time a block copy job works is on a transient domain, and any app that is managing a transient domain probably already does enough of its own bookkeeping to know which file it is mirroring into without having to re-read it from the libvirt XML. The one thing that was likely to be used in a mirroring job was the ready= attribute, which is unchanged. Meanwhile, I made sure the schema and parser still accept the old format, even if we no longer output it, so that upgrading from an older version of libvirt is seamless. * docs/schemas/domaincommon.rng (diskMirror): Alter definition. * src/conf/domain_conf.c (virDomainDiskDefParseXML): Parse two styles of mirror elements. (virDomainDiskDefFormat): Output new style. * tests/qemuxml2argvdata/qemuxml2argv-disk-mirror-old.xml: New file, copied from... * tests/qemuxml2argvdata/qemuxml2argv-disk-mirror.xml: ...here before modernizing. * tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-mirror-old*: New files. * tests/qemuxml2xmltest.c (mymain): Test both styles. Signed-off-by: Eric Blake <eblake@redhat.com>
2014-05-22 04:39:57 +00:00
<attribute name='file'>
<ref name='absFilePath'/>
</attribute>
<optional>
<attribute name='format'>
<ref name='storageFormat'/>
</attribute>
</optional>
blockcommit: track job type in xml A future patch is going to wire up qemu active block commit jobs; but as they have similar events and are canceled/pivoted in the same way as block copy jobs, it is easiest to track all bookkeeping for the commit job by reusing the <mirror> element. This patch adds domain XML to track which job was responsible for creating a mirroring situation, and adds a job='copy' attribute to all existing uses of <mirror>. Along the way, it also massages the qemu monitor backend to read the new field in order to generate the correct type of libvirt job (even though it requires a future patch to actually cause a qemu event that can be reported as an active commit). It also prepares to update persistent XML to match changes made to live XML when a copy completes. * docs/schemas/domaincommon.rng: Enhance schema. * docs/formatdomain.html.in: Document it. * src/conf/domain_conf.h (_virDomainDiskDef): Add a field. * src/conf/domain_conf.c (virDomainBlockJobType): String conversion. (virDomainDiskDefParseXML): Parse job type. (virDomainDiskDefFormat): Output job type. * src/qemu/qemu_process.c (qemuProcessHandleBlockJob): Distinguish active from regular commit. * src/qemu/qemu_driver.c (qemuDomainBlockCopy): Set job type. (qemuDomainBlockPivot, qemuDomainBlockJobImpl): Clean up job type on completion. * tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-mirror-old.xml: Update tests. * tests/qemuxml2argvdata/qemuxml2argv-disk-mirror.xml: Likewise. * tests/qemuxml2argvdata/qemuxml2argv-disk-active-commit.xml: New file. * tests/qemuxml2xmltest.c (mymain): Drive new test. Signed-off-by: Eric Blake <eblake@redhat.com>
2014-07-29 03:46:44 +00:00
<optional>
<attribute name='job'>
<choice>
<value>copy</value>
</choice>
</attribute>
</optional>
<optional>
<interleave>
<ref name='diskSourceFile'/>
<optional>
<ref name="diskFormat"/>
</optional>
</interleave>
</optional>
conf: alter disk mirror xml output Now that we track a disk mirror as a virStorageSource, we might as well update the XML to theoretically allow any type of mirroring destination (not just a local file). A later patch will also be reusing <mirror> to track the block commit of the top layer of a chain, which is another case where libvirt needs to update the backing chain after the job is finally pivoted, and since backing chains can have network backing files as the destination to commit into, it makes more sense to display that in the XML. This patch changes output-only XML; it was already documented that <mirror> does not affect a domain definition at this point (because qemu doesn't provide persistent bitmaps yet). Any application that was starting a block copy job with older libvirt and then relying on the domain XML to determine if it was complete will no longer be able to access the file= and format= attributes of mirror that were previously used. However, this is not going to be a problem in practice: the only time a block copy job works is on a transient domain, and any app that is managing a transient domain probably already does enough of its own bookkeeping to know which file it is mirroring into without having to re-read it from the libvirt XML. The one thing that was likely to be used in a mirroring job was the ready= attribute, which is unchanged. Meanwhile, I made sure the schema and parser still accept the old format, even if we no longer output it, so that upgrading from an older version of libvirt is seamless. * docs/schemas/domaincommon.rng (diskMirror): Alter definition. * src/conf/domain_conf.c (virDomainDiskDefParseXML): Parse two styles of mirror elements. (virDomainDiskDefFormat): Output new style. * tests/qemuxml2argvdata/qemuxml2argv-disk-mirror-old.xml: New file, copied from... * tests/qemuxml2argvdata/qemuxml2argv-disk-mirror.xml: ...here before modernizing. * tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-mirror-old*: New files. * tests/qemuxml2xmltest.c (mymain): Test both styles. Signed-off-by: Eric Blake <eblake@redhat.com>
2014-05-22 04:39:57 +00:00
</group>
<group> <!-- preferred format -->
blockcommit: track job type in xml A future patch is going to wire up qemu active block commit jobs; but as they have similar events and are canceled/pivoted in the same way as block copy jobs, it is easiest to track all bookkeeping for the commit job by reusing the <mirror> element. This patch adds domain XML to track which job was responsible for creating a mirroring situation, and adds a job='copy' attribute to all existing uses of <mirror>. Along the way, it also massages the qemu monitor backend to read the new field in order to generate the correct type of libvirt job (even though it requires a future patch to actually cause a qemu event that can be reported as an active commit). It also prepares to update persistent XML to match changes made to live XML when a copy completes. * docs/schemas/domaincommon.rng: Enhance schema. * docs/formatdomain.html.in: Document it. * src/conf/domain_conf.h (_virDomainDiskDef): Add a field. * src/conf/domain_conf.c (virDomainBlockJobType): String conversion. (virDomainDiskDefParseXML): Parse job type. (virDomainDiskDefFormat): Output job type. * src/qemu/qemu_process.c (qemuProcessHandleBlockJob): Distinguish active from regular commit. * src/qemu/qemu_driver.c (qemuDomainBlockCopy): Set job type. (qemuDomainBlockPivot, qemuDomainBlockJobImpl): Clean up job type on completion. * tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-mirror-old.xml: Update tests. * tests/qemuxml2argvdata/qemuxml2argv-disk-mirror.xml: Likewise. * tests/qemuxml2argvdata/qemuxml2argv-disk-active-commit.xml: New file. * tests/qemuxml2xmltest.c (mymain): Drive new test. Signed-off-by: Eric Blake <eblake@redhat.com>
2014-07-29 03:46:44 +00:00
<attribute name='job'>
<choice>
<value>copy</value>
<value>active-commit</value>
</choice>
</attribute>
conf: alter disk mirror xml output Now that we track a disk mirror as a virStorageSource, we might as well update the XML to theoretically allow any type of mirroring destination (not just a local file). A later patch will also be reusing <mirror> to track the block commit of the top layer of a chain, which is another case where libvirt needs to update the backing chain after the job is finally pivoted, and since backing chains can have network backing files as the destination to commit into, it makes more sense to display that in the XML. This patch changes output-only XML; it was already documented that <mirror> does not affect a domain definition at this point (because qemu doesn't provide persistent bitmaps yet). Any application that was starting a block copy job with older libvirt and then relying on the domain XML to determine if it was complete will no longer be able to access the file= and format= attributes of mirror that were previously used. However, this is not going to be a problem in practice: the only time a block copy job works is on a transient domain, and any app that is managing a transient domain probably already does enough of its own bookkeeping to know which file it is mirroring into without having to re-read it from the libvirt XML. The one thing that was likely to be used in a mirroring job was the ready= attribute, which is unchanged. Meanwhile, I made sure the schema and parser still accept the old format, even if we no longer output it, so that upgrading from an older version of libvirt is seamless. * docs/schemas/domaincommon.rng (diskMirror): Alter definition. * src/conf/domain_conf.c (virDomainDiskDefParseXML): Parse two styles of mirror elements. (virDomainDiskDefFormat): Output new style. * tests/qemuxml2argvdata/qemuxml2argv-disk-mirror-old.xml: New file, copied from... * tests/qemuxml2argvdata/qemuxml2argv-disk-mirror.xml: ...here before modernizing. * tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-mirror-old*: New files. * tests/qemuxml2xmltest.c (mymain): Test both styles. Signed-off-by: Eric Blake <eblake@redhat.com>
2014-05-22 04:39:57 +00:00
<interleave>
<ref name="diskSource"/>
<optional>
<ref name="diskFormat"/>
</optional>
</interleave>
</group>
</choice>
blockjob: enhance xml to track mirrors across libvirtd restart In order to track a block copy job across libvirtd restarts, we need to save internal XML that tracks the name of the file holding the mirror. Displaying this name in dumpxml might also be useful to the user, even if we don't yet have a way to (re-) start a domain with mirroring enabled up front. This is done with a new <mirror> sub-element to <disk>, as in: <disk type='file' device='disk'> <driver name='qemu' type='raw'/> <source file='/var/lib/libvirt/images/original.img'/> <mirror file='/var/lib/libvirt/images/copy.img' format='qcow2' ready='yes'/> ... </disk> For now, the element is output-only, in live domains; it is ignored when defining a domain or hot-plugging a disk (since those contexts use VIR_DOMAIN_XML_INACTIVE in parsing). The 'ready' attribute appears when libvirt knows that the job has changed from the initial pulling phase over to the mirroring phase, although absence of the attribute is not a sure indicator of the current phase. If we come up with a way to make qemu start with mirroring enabled, we can relax the xml restriction, and allow <mirror> (but not attribute 'ready') on input. Testing active-only XML meant tweaking the testsuite slightly, but it was worth it. * docs/schemas/domaincommon.rng (diskspec): Add diskMirror. * docs/formatdomain.html.in (elementsDisks): Document it. * src/conf/domain_conf.h (_virDomainDiskDef): New members. * src/conf/domain_conf.c (virDomainDiskDefFree): Clean them. (virDomainDiskDefParseXML): Parse them, but only internally. (virDomainDiskDefFormat): Output them. * tests/qemuxml2argvdata/qemuxml2argv-disk-mirror.xml: New test file. * tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-mirror.xml: Likewise. * tests/qemuxml2xmltest.c (testInfo): Alter members. (testCompareXMLToXMLHelper): Allow more test control. (mymain): Run new test.
2012-03-29 00:10:18 +00:00
<optional>
<attribute name='ready'>
blockcopy: add more XML for state tracking Doing a blockcopy operation across a libvirtd restart is not very robust at the moment. In particular, we are clearing the <mirror> element prior to telling qemu to finish the job. Also, thanks to the ability to request async completion, the user can easily regain control prior to qemu actually finishing the effort, and they should be able to poll the domain XML to see if the job is still going. A future patch will fix things to actually wait until qemu is done before modifying the XML to reflect the job completion. But since qemu issues identical BLOCK_JOB_COMPLETE events regardless of whether the job was cancelled (kept the original disk) or completed (pivoted to the new disk), we have to track which of the two operations were used to end the job. Furthermore, we'd like to avoid attempts to end a job where we are already waiting on an earlier request to qemu to end the job. Likewise, if we miss the qemu event (perhaps because it arrived during a libvirtd restart), we still need enough state recorded to be able to determine how to modify the domain XML once we reconnect to qemu and manually learn whether the job still exists. Although this patch doesn't actually fix the problem, it is a preliminary step that makes it possible to track whether a job has already begun steps towards completion. * src/conf/domain_conf.h (virDomainDiskMirrorState): New enum. (_virDomainDiskDef): Convert bool mirroring to new enum. * src/conf/domain_conf.c (virDomainDiskDefParseXML) (virDomainDiskDefFormat): Handle new values. * src/qemu/qemu_process.c (qemuProcessHandleBlockJob): Adjust client. * src/qemu/qemu_driver.c (qemuDomainBlockPivot) (qemuDomainBlockJobImpl): Likewise. * docs/schemas/domaincommon.rng (diskMirror): Expose new values. * docs/formatdomain.html.in (elementsDisks): Document it. * tests/qemuxml2argvdata/qemuxml2argv-disk-mirror.xml: Test it. Signed-off-by: Eric Blake <eblake@redhat.com>
2014-07-28 22:25:28 +00:00
<choice>
<value>yes</value>
<value>abort</value>
<value>pivot</value>
</choice>
blockjob: enhance xml to track mirrors across libvirtd restart In order to track a block copy job across libvirtd restarts, we need to save internal XML that tracks the name of the file holding the mirror. Displaying this name in dumpxml might also be useful to the user, even if we don't yet have a way to (re-) start a domain with mirroring enabled up front. This is done with a new <mirror> sub-element to <disk>, as in: <disk type='file' device='disk'> <driver name='qemu' type='raw'/> <source file='/var/lib/libvirt/images/original.img'/> <mirror file='/var/lib/libvirt/images/copy.img' format='qcow2' ready='yes'/> ... </disk> For now, the element is output-only, in live domains; it is ignored when defining a domain or hot-plugging a disk (since those contexts use VIR_DOMAIN_XML_INACTIVE in parsing). The 'ready' attribute appears when libvirt knows that the job has changed from the initial pulling phase over to the mirroring phase, although absence of the attribute is not a sure indicator of the current phase. If we come up with a way to make qemu start with mirroring enabled, we can relax the xml restriction, and allow <mirror> (but not attribute 'ready') on input. Testing active-only XML meant tweaking the testsuite slightly, but it was worth it. * docs/schemas/domaincommon.rng (diskspec): Add diskMirror. * docs/formatdomain.html.in (elementsDisks): Document it. * src/conf/domain_conf.h (_virDomainDiskDef): New members. * src/conf/domain_conf.c (virDomainDiskDefFree): Clean them. (virDomainDiskDefParseXML): Parse them, but only internally. (virDomainDiskDefFormat): Output them. * tests/qemuxml2argvdata/qemuxml2argv-disk-mirror.xml: New test file. * tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-mirror.xml: Likewise. * tests/qemuxml2xmltest.c (testInfo): Alter members. (testCompareXMLToXMLHelper): Allow more test control. (mymain): Run new test.
2012-03-29 00:10:18 +00:00
</attribute>
</optional>
</element>
</define>
<define name="diskAuth">
<element name="auth">
<attribute name="username">
<ref name="genericName"/>
</attribute>
<ref name="diskAuthSecret"/>
</element>
</define>
<define name='diskAuthSecret'>
<element name='secret'>
<attribute name='type'>
<choice>
<value>ceph</value>
<value>iscsi</value>
</choice>
</attribute>
<choice>
<attribute name='uuid'>
<ref name="UUID"/>
</attribute>
<attribute name='usage'>
<ref name='genericName'/>
</attribute>
</choice>
</element>
</define>
<define name='diskIoTune'>
<element name="iotune">
<interleave>
<choice>
<element name="total_bytes_sec">
<data type="unsignedLong"/>
</element>
<group>
<interleave>
<optional>
<element name="read_bytes_sec">
<data type="unsignedLong"/>
</element>
</optional>
<optional>
<element name="write_bytes_sec">
<data type="unsignedLong"/>
</element>
</optional>
</interleave>
</group>
</choice>
<choice>
<element name="total_iops_sec">
<data type="unsignedLong"/>
</element>
<group>
<interleave>
<optional>
<element name="read_iops_sec">
<data type="unsignedLong"/>
</element>
</optional>
<optional>
<element name="write_iops_sec">
<data type="unsignedLong"/>
</element>
</optional>
</interleave>
</group>
</choice>
</interleave>
</element>
</define>
<!-- Optional HyperV Enlightenment features -->
<define name="hyperv">
<element name="hyperv">
<interleave>
<optional>
<element name="relaxed">
<ref name="featurestate"/>
</element>
</optional>
<optional>
<element name="vapic">
<ref name="featurestate"/>
</element>
</optional>
<optional>
<element name="spinlocks">
<ref name="featurestate"/>
<optional>
<attribute name="retries">
<data type="unsignedInt"/>
</attribute>
</optional>
</element>
</optional>
</interleave>
</element>
</define>
<!-- Optional KVM features -->
<define name="kvm">
<element name="kvm">
<interleave>
<optional>
<element name="hidden">
<ref name="featurestate"/>
</element>
</optional>
</interleave>
</element>
</define>
<!-- Optional capabilities features -->
<define name="capabilities">
<element name="capabilities">
<ref name="capabilitiespolicy"/>
<interleave>
<optional>
<element name="audit_control">
<ref name="featurestate"/>
</element>
</optional>
<optional>
<element name="audit_write">
<ref name="featurestate"/>
</element>
</optional>
<optional>
<element name="block_suspend">
<ref name="featurestate"/>
</element>
</optional>
<optional>
<element name="chown">
<ref name="featurestate"/>
</element>
</optional>
<optional>
<element name="dac_override">
<ref name="featurestate"/>
</element>
</optional>
<optional>
<element name="dac_read_search">
<ref name="featurestate"/>
</element>
</optional>
<optional>
<element name="fowner">
<ref name="featurestate"/>
</element>
</optional>
<optional>
<element name="fsetid">
<ref name="featurestate"/>
</element>
</optional>
<optional>
<element name="ipc_lock">
<ref name="featurestate"/>
</element>
</optional>
<optional>
<element name="ipc_owner">
<ref name="featurestate"/>
</element>
</optional>
<optional>
<element name="kill">
<ref name="featurestate"/>
</element>
</optional>
<optional>
<element name="lease">
<ref name="featurestate"/>
</element>
</optional>
<optional>
<element name="linux_immutable">
<ref name="featurestate"/>
</element>
</optional>
<optional>
<element name="mac_admin">
<ref name="featurestate"/>
</element>
</optional>
<optional>
<element name="mac_override">
<ref name="featurestate"/>
</element>
</optional>
<optional>
<element name="mknod">
<ref name="featurestate"/>
</element>
</optional>
<optional>
<element name="net_admin">
<ref name="featurestate"/>
</element>
</optional>
<optional>
<element name="net_bind_service">
<ref name="featurestate"/>
</element>
</optional>
<optional>
<element name="net_broadcast">
<ref name="featurestate"/>
</element>
</optional>
<optional>
<element name="net_raw">
<ref name="featurestate"/>
</element>
</optional>
<optional>
<element name="setgid">
<ref name="featurestate"/>
</element>
</optional>
<optional>
<element name="setfcap">
<ref name="featurestate"/>
</element>
</optional>
<optional>
<element name="setpcap">
<ref name="featurestate"/>
</element>
</optional>
<optional>
<element name="setuid">
<ref name="featurestate"/>
</element>
</optional>
<optional>
<element name="sys_admin">
<ref name="featurestate"/>
</element>
</optional>
<optional>
<element name="sys_boot">
<ref name="featurestate"/>
</element>
</optional>
<optional>
<element name="sys_chroot">
<ref name="featurestate"/>
</element>
</optional>
<optional>
<element name="sys_module">
<ref name="featurestate"/>
</element>
</optional>
<optional>
<element name="sys_nice">
<ref name="featurestate"/>
</element>
</optional>
<optional>
<element name="sys_pacct">
<ref name="featurestate"/>
</element>
</optional>
<optional>
<element name="sys_ptrace">
<ref name="featurestate"/>
</element>
</optional>
<optional>
<element name="sys_rawio">
<ref name="featurestate"/>
</element>
</optional>
<optional>
<element name="sys_resource">
<ref name="featurestate"/>
</element>
</optional>
<optional>
<element name="sys_time">
<ref name="featurestate"/>
</element>
</optional>
<optional>
<element name="sys_tty_config">
<ref name="featurestate"/>
</element>
</optional>
<optional>
<element name="syslog">
<ref name="featurestate"/>
</element>
</optional>
<optional>
<element name="wake_alarm">
<ref name="featurestate"/>
</element>
</optional>
</interleave>
</element>
</define>
<define name="featurestate">
<attribute name="state">
<ref name="virOnOff"/>
</attribute>
</define>
<define name="capabilitiespolicy">
<attribute name="policy">
<choice>
<value>default</value>
<value>allow</value>
<value>deny</value>
</choice>
</attribute>
</define>
<!--
Optional hypervisor extensions in their own namespace:
QEmu
-->
<define name="qemucmdline">
<element name="commandline" ns="http://libvirt.org/schemas/domain/qemu/1.0">
<zeroOrMore>
<element name="arg">
<attribute name='value'/>
</element>
</zeroOrMore>
<zeroOrMore>
<element name="env">
<attribute name='name'>
<ref name="filter-param-name"/>
</attribute>
<optional>
<attribute name='value'/>
</optional>
<empty/>
</element>
</zeroOrMore>
</element>
</define>
<define name="metadata">
<element name="metadata">
<zeroOrMore>
<ref name="customElement"/>
</zeroOrMore>
</element>
</define>
<define name="customElement">
<element>
<anyName/>
<zeroOrMore>
<choice>
<attribute>
<anyName/>
</attribute>
<text/>
<ref name="customElement"/>
</choice>
</zeroOrMore>
</element>
</define>
<!--
Type library
-->
<define name="countCPU">
<data type="unsignedShort">
<param name="pattern">[0-9]+</param>
<param name="minInclusive">1</param>
</data>
</define>
<define name="vcpuid">
<data type="unsignedShort">
<param name="pattern">[0-9]+</param>
</data>
</define>
<define name="cpushares">
<data type="unsignedInt">
<param name="pattern">[0-9]+</param>
</data>
</define>
<define name="cpuperiod">
<data type="unsignedLong">
<param name="pattern">[0-9]+</param>
<param name="minInclusive">1000</param>
<param name="maxInclusive">1000000</param>
</data>
</define>
<define name="cpuquota">
<data type="long">
<param name="pattern">-?[0-9]+</param>
<param name="maxInclusive">18446744073709551</param>
<param name='minInclusive'>-1</param>
</data>
</define>
<define name="rebootTimeoutDelay">
<data type="short">
<param name="minInclusive">-1</param>
</data>
</define>
<!-- weight currently is in range [100, 1000] -->
<define name="weight">
<data type="unsignedInt">
<param name="pattern">[0-9]+</param>
<param name="minInclusive">100</param>
<param name="maxInclusive">1000</param>
</data>
</define>
xml: output memory unit for clarity Make it obvious to 'dumpxml' readers what unit we are using, since our default of KiB for memory (1024) differs from qemu's default of MiB; and differs from our use of bytes for storage. Tests were updated via: $ find tests/*data tests/*out -name '*.xml' | \ xargs sed -i 's/<\(memory\|currentMemory\|hard_limit\|soft_limit\|min_guarantee\|swap_hard_limit\)>/<\1 unit='"'KiB'>/" $ find tests/*data tests/*out -name '*.xml' | \ xargs sed -i 's/<\(capacity\|allocation\|available\)>/<\1 unit='"'bytes'>/" followed by a few fixes for the stragglers. Note that with this patch, the RNG for <memory> still forbids validation of anything except unit='KiB', since the code silently ignores the attribute; a later patch will expand <memory> to allow scaled input in the code and update the RNG to match. * docs/schemas/basictypes.rng (unit): Add 'bytes'. (scaledInteger): New define. * docs/schemas/storagevol.rng (sizing): Use it. * docs/schemas/storagepool.rng (sizing): Likewise. * docs/schemas/domaincommon.rng (memoryKBElement): New define; use for memory elements. * src/conf/storage_conf.c (virStoragePoolDefFormat) (virStorageVolDefFormat): Likewise. * src/conf/domain_conf.h (_virDomainDef): Document unit used internally. * src/conf/storage_conf.h (_virStoragePoolDef, _virStorageVolDef): Likewise. * tests/*data/*.xml: Update all tests. * tests/*out/*.xml: Likewise. * tests/define-dev-segfault: Likewise. * tests/openvzutilstest.c (testReadNetworkConf): Likewise. * tests/qemuargv2xmltest.c (blankProblemElements): Likewise.
2012-02-23 00:48:38 +00:00
<!-- Memory as an attribute is in KiB, no way to express a unit -->
<define name="memoryKB">
<data type="unsignedInt">
<param name="pattern">[0-9]+</param>
</data>
</define>
<define name="domainName">
<data type="string">
<!-- Use literal newline instead of \n for bug in libxml2 2.7.6 -->
<param name="pattern">[^
]+</param>
</data>
</define>
<define name="diskSerial">
<data type="string">
<param name="pattern">[A-Za-z0-9_\.\+\-]+</param>
</data>
</define>
<define name="bridgeMode">
<data type="string">
<param name="pattern">(vepa|bridge|private|passthrough)</param>
</data>
</define>
<define name="addrIPorName">
<data type="string">
<param name="pattern">(([0-2]?[0-9]?[0-9]\.){3}[0-2]?[0-9]?[0-9])|(([0-9a-fA-F]+|:)+[0-9a-fA-F]+)|([a-zA-Z0-9_\.\+\-]*)</param>
</data>
</define>
<define name="usbIdDefault">
<data type="string">
<param name="pattern">-1</param>
</data>
</define>
<define name="usbId">
<data type="string">
<param name="pattern">(0x)?[0-9a-fA-F]{1,4}</param>
</data>
</define>
<define name="usbVersion">
<data type="string">
<param name="pattern">[0-9]{1,2}.[0-9]{1,2}</param>
</data>
</define>
<define name="usbAddr">
<data type="string">
<param name="pattern">(0x)?[0-9a-fA-F]{1,3}</param>
</data>
</define>
<define name="usbClass">
<data type="string">
<param name="pattern">(0x)?[0-9a-fA-F]{1,2}</param>
</data>
</define>
<define name="usbPort">
<data type="string">
<param name="pattern">((0x)?[0-9a-fA-F]{1,3}\.){0,3}(0x)?[0-9a-fA-F]{1,3}</param>
</data>
</define>
<define name="driveController">
<data type="string">
<param name="pattern">[0-9]{1,2}</param>
</data>
</define>
<define name="driveBus">
<data type="string">
<param name="pattern">[0-9]{1,2}</param>
</data>
</define>
<define name="driveTarget">
<data type="string">
<param name="pattern">[0-9]{1,2}</param>
</data>
</define>
<define name="driveUnit">
<data type="string">
<param name="pattern">[0-9]{1,2}</param>
</data>
</define>
<define name="featureName">
<data type="string">
<param name='pattern'>[a-zA-Z0-9\-_\.]+</param>
</data>
</define>
<define name="timeDelta">
<data type="string">
<param name="pattern">(-|\+)?[0-9]+</param>
</data>
</define>
<define name="timeZone">
<data type="string">
<param name="pattern">[a-zA-Z0-9_\.\+\-/]+</param>
</data>
</define>
<define name="filter-param-name">
<data type="string">
<param name="pattern">[a-zA-Z0-9_]+</param>
</data>
</define>
<define name="filter-param-value">
<data type="string">
<param name="pattern">[a-zA-Z0-9_\.:]+</param>
</data>
</define>
<define name="spaprvioReg">
<data type="string">
<param name="pattern">(0x)?[0-9a-fA-F]{1,16}</param>
</data>
</define>
<define name='aliasName'>
<data type="string">
<param name="pattern">[a-zA-Z0-9_\-.]+</param>
</data>
</define>
<define name='alias'>
<element name='alias'>
<attribute name='name'>
<ref name='aliasName'/>
</attribute>
</element>
<empty/>
</define>
<define name="ccwCssidRange">
<choice>
<data type="string">
<param name="pattern">0x[0-9a-eA-E][0-9a-fA-F]?</param>
</data>
<data type="string">
<param name="pattern">0x[fF][0-9a-eA-E]?</param>
</data>
<data type="int">
<param name="minInclusive">0</param>
<param name="maxInclusive">254</param>
</data>
</choice>
</define>
<define name="ccwSsidRange">
<data type="string">
<param name="pattern">(0x)?[0-3]</param>
</data>
</define>
<define name="ccwDevnoRange">
<choice>
<data type="string">
<param name="pattern">0x[0-9a-fA-F]{1,4}</param>
</data>
<data type="int">
<param name="minInclusive">0</param>
<param name="maxInclusive">65535</param>
</data>
</choice>
</define>
<define name="panic">
<element name="panic">
<optional>
<ref name="address"/>
</optional>
</element>
</define>
<define name="rawIO">
<attribute name="rawio">
<ref name="virYesNo"/>
</attribute>
</define>
</grammar>