]> xenbits.xensource.com Git - people/liuw/libxenctrl-split/libvirt.git/commitdiff
conf: Mark missing optional USB devices in domain XML
authorJiri Denemark <jdenemar@redhat.com>
Thu, 11 Oct 2012 20:33:46 +0000 (22:33 +0200)
committerJiri Denemark <jdenemar@redhat.com>
Fri, 12 Oct 2012 08:55:32 +0000 (10:55 +0200)
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
src/conf/domain_conf.c

index b142716adc04c0259d1ebf642a61832c5878bae3..70bc0e207d500accd8a3af853bbf016dc2397f93 100644 (file)
           </optional>
           <interleave>
             <element name="source">
+              <optional>
+                <attribute name="missing">
+                  <choice>
+                    <value>yes</value>
+                    <value>no</value>
+                  </choice>
+                </attribute>
+              </optional>
               <choice>
                 <group>
                   <ref name="usbproduct"/>
index 3c3d0aeade65af628b8348010a65047108a5db31..c87c6155207b37a328762505fc20f44cf40879e1 100644 (file)
@@ -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);