]> xenbits.xensource.com Git - libvirt.git/commitdiff
conf: Requires either uuid or usage of secret
authorOsier Yang <jyang@redhat.com>
Thu, 20 Jun 2013 10:27:04 +0000 (18:27 +0800)
committerJiri Denemark <jdenemar@redhat.com>
Fri, 21 Jun 2013 07:41:48 +0000 (09:41 +0200)
As the RNG schema for disk auth secret implies, it requires either
"uuid" or "usage":

  <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>

src/conf/domain_conf.c

index 23733973b6c9bc6736b2f5be2453c92da766278d..92979372fb357f4b3623744e85ba0ee2f3f5505e 100644 (file)
@@ -4972,6 +4972,14 @@ virDomainDiskDefParseXML(virDomainXMLOptionPtr xmlopt,
                                            _("only one of uuid and usage can be specified"));
                             goto error;
                         }
+
+                        if (!authUUID && !authUsage) {
+                            virReportError(VIR_ERR_XML_ERROR, "%s",
+                                           _("either uuid or usage should be "
+                                             "specified for a secret"));
+                            goto error;
+                        }
+
                         if (authUUID != NULL) {
                             def->auth.secretType = VIR_DOMAIN_DISK_SECRET_TYPE_UUID;
                             if (virUUIDParse(authUUID,