]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
domain_conf.c: move smartcard address check to domain_validate.c
authorDaniel Henrique Barboza <danielhb413@gmail.com>
Tue, 8 Dec 2020 20:37:28 +0000 (17:37 -0300)
committerDaniel Henrique Barboza <danielhb413@gmail.com>
Wed, 9 Dec 2020 12:51:51 +0000 (09:51 -0300)
This check is not tied to XML parsing and can be moved to
virDomainSmartcardDefValidate().

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
src/conf/domain_conf.c
src/conf/domain_validate.c

index c51d3225ca8719c8c3487cf8fa5e339d98f79853..40417c2fd0fd45cb4ca7fa4f643e2b2c5aefbd7d 100644 (file)
@@ -13227,13 +13227,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);
 }
 
index 882fbdac570edd0a7dbb4422760c79127ecd45a9..6fca604d17ada9712734e9754578a2cd18eb086c 100644 (file)
@@ -484,6 +484,13 @@ 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);