[PATCH] conf: Requires either uuid or usage of secret

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



As the RNG schema for disk auth secret implies, it requires either
"uuid" or "secret":

  <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 | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 2373397..9297937 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -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,
-- 
1.8.1.4

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]