[libvirt] [PATCH] conf: Mark missing optional USB devices in domain XML

When startupPolicy set for a USB devices allows such device to be missing, there was no way this could be detected from domain XML. With this patch, libvirt emits a new missing='yes' attribute for such devices when active domain XML is generated. --- docs/schemas/domaincommon.rng | 8 ++++++++ src/conf/domain_conf.c | 5 +++++ 2 files changed, 13 insertions(+) diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng index b142716..70bc0e2 100644 --- a/docs/schemas/domaincommon.rng +++ b/docs/schemas/domaincommon.rng @@ -1654,6 +1654,14 @@ </optional> <interleave> <element name="source"> + <optional> + <attribute name="missing"> + <choice> + <value>yes</value> + <value>no</value> + </choice> + </attribute> + </optional> <choice> <group> <ref name="usbproduct"/> diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 1eda551..a2971cd 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -12102,6 +12102,11 @@ virDomainHostdevSourceFormat(virBufferPtr buf, if (def->source.subsys.u.usb.autoAddress && (flags & VIR_DOMAIN_XML_MIGRATABLE)) virBufferAddLit(buf, " autoAddress='yes'"); + + if (def->missing && + !(flags & VIR_DOMAIN_XML_INACTIVE)) + virBufferAddLit(buf, " missing='yes'"); + virBufferAddLit(buf, ">\n"); virBufferAdjustIndent(buf, 2); -- 1.7.12.3

On 10/11/2012 02:56 PM, Jiri Denemark wrote:
When startupPolicy set for a USB devices allows such device to be missing, there was no way this could be detected from domain XML. With this patch, libvirt emits a new missing='yes' attribute for such devices when active domain XML is generated. --- docs/schemas/domaincommon.rng | 8 ++++++++ src/conf/domain_conf.c | 5 +++++ 2 files changed, 13 insertions(+)
ACK.
diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng index b142716..70bc0e2 100644 --- a/docs/schemas/domaincommon.rng +++ b/docs/schemas/domaincommon.rng @@ -1654,6 +1654,14 @@ </optional> <interleave> <element name="source"> + <optional> + <attribute name="missing"> + <choice> + <value>yes</value> + <value>no</value>
It's a bit odd to see a choice for missing='no', given that we never output it, and that we ignore it during input, but it doesn't hurt. -- Eric Blake eblake@redhat.com +1-919-301-3266 Libvirt virtualization library http://libvirt.org

On Thu, Oct 11, 2012 at 16:40:11 -0600, Eric Blake wrote:
On 10/11/2012 02:56 PM, Jiri Denemark wrote:
When startupPolicy set for a USB devices allows such device to be missing, there was no way this could be detected from domain XML. With this patch, libvirt emits a new missing='yes' attribute for such devices when active domain XML is generated. --- docs/schemas/domaincommon.rng | 8 ++++++++ src/conf/domain_conf.c | 5 +++++ 2 files changed, 13 insertions(+)
ACK.
Pushed, thanks. Jirka
participants (2)
-
Eric Blake
-
Jiri Denemark