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