[PATCH v2 5/9] domain_conf.c: move smartcard address check to validate callback

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

 



This check is not tied to XML parsing and can be moved to
virDomainSmartcardDefValidate().

Signed-off-by: Daniel Henrique Barboza <danielhb413@xxxxxxxxx>
---
 src/conf/domain_conf.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index e9bafd189f..230e89e786 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -6567,6 +6567,13 @@ static int
 virDomainSmartcardDefValidate(const virDomainSmartcardDef *smartcard,
                               const virDomainDef *def)
 {
+    if (smartcard->info.type != VIR_DOMAIN_DEVICE_ADDRESS_TYPE_NONE &&
+        smartcard->info.type != VIR_DOMAIN_DEVICE_ADDRESS_TYPE_CCID) {
+        virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+                       _("Controllers must use the 'ccid' address type"));
+        return -1;
+    }
+
     if (smartcard->type == VIR_DOMAIN_SMARTCARD_TYPE_PASSTHROUGH)
         return virDomainChrSourceDefValidate(smartcard->data.passthru, NULL, def);
 
@@ -13682,13 +13689,6 @@ virDomainSmartcardDefParseXML(virDomainXMLOptionPtr xmlopt,
     if (virDomainDeviceInfoParseXML(xmlopt, node, &def->info, flags) < 0)
         return NULL;
 
-    if (def->info.type != VIR_DOMAIN_DEVICE_ADDRESS_TYPE_NONE &&
-        def->info.type != VIR_DOMAIN_DEVICE_ADDRESS_TYPE_CCID) {
-        virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
-                       _("Controllers must use the 'ccid' address type"));
-        return NULL;
-    }
-
     return g_steal_pointer(&def);
 }
 
-- 
2.26.2




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

  Powered by Linux