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

[libvirt] [PATCH] conf: Always use VIR_ERR_XML_ERROR on enumFromString() failures



Currently, during XML parsing, when a call to a FromString() function to
get an enum value fails, the error which is reported is either
VIR_ERR_CONFIG_UNSUPPORTED, VIR_ERR_INTERNAL_ERROR or VIR_ERR_XML_ERROR.

This commit makes such conversion failures consistently return
VIR_ERR_XML_ERROR
---
 src/conf/device_conf.c      |   2 +-
 src/conf/domain_conf.c      | 158 ++++++++++++++++++++++----------------------
 src/conf/network_conf.c     |   2 +-
 src/conf/node_device_conf.c |   4 +-
 src/conf/nwfilter_conf.c    |   4 +-
 src/conf/snapshot_conf.c    |   4 +-
 6 files changed, 87 insertions(+), 87 deletions(-)

diff --git a/src/conf/device_conf.c b/src/conf/device_conf.c
index f49dc21..4084133 100644
--- a/src/conf/device_conf.c
+++ b/src/conf/device_conf.c
@@ -92,7 +92,7 @@ virDevicePCIAddressParseXML(xmlNodePtr node,
 
     if (multi &&
         ((addr->multi = virDeviceAddressPciMultiTypeFromString(multi)) <= 0)) {
-        virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+        virReportError(VIR_ERR_XML_ERROR,
                        _("Unknown value '%s' for <address> 'multifunction' attribute"),
                        multi);
         goto cleanup;
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 416d96e..dd1c6fa 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -3566,7 +3566,7 @@ virDomainDeviceInfoParseXML(xmlNodePtr node,
         char *rombar = virXMLPropString(rom, "bar");
         if (rombar &&
             ((info->rombar = virDomainPciRombarModeTypeFromString(rombar)) <= 0)) {
-            virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+            virReportError(VIR_ERR_XML_ERROR,
                            _("unknown rom bar value '%s'"), rombar);
             VIR_FREE(rombar);
             goto cleanup;
@@ -3582,7 +3582,7 @@ virDomainDeviceInfoParseXML(xmlNodePtr node,
 
     if (type) {
         if ((info->type = virDomainDeviceAddressTypeFromString(type)) < 0) {
-            virReportError(VIR_ERR_INTERNAL_ERROR,
+            virReportError(VIR_ERR_XML_ERROR,
                            _("unknown address type '%s'"), type);
             goto cleanup;
         }
@@ -4211,7 +4211,7 @@ virDomainHostdevDefParseXMLSubsys(xmlNodePtr node,
         if ((backendStr = virXPathString("string(./driver/@name)", ctxt)) &&
             (((backend = virDomainHostdevSubsysPciBackendTypeFromString(backendStr)) < 0) ||
              backend == VIR_DOMAIN_HOSTDEV_PCI_BACKEND_DEFAULT)) {
-            virReportError(VIR_ERR_INTERNAL_ERROR,
+            virReportError(VIR_ERR_XML_ERROR,
                            _("Unknown PCI device <driver name='%s'/> "
                              "has been specified"), backendStr);
             goto error;
@@ -5058,7 +5058,7 @@ virDomainDiskDefParseXML(virDomainXMLOptionPtr xmlopt,
     type = virXMLPropString(node, "type");
     if (type) {
         if ((def->type = virDomainDiskTypeFromString(type)) < 0) {
-            virReportError(VIR_ERR_INTERNAL_ERROR,
+            virReportError(VIR_ERR_XML_ERROR,
                            _("unknown disk type '%s'"), type);
             goto error;
         }
@@ -5130,7 +5130,7 @@ virDomainDiskDefParseXML(virDomainXMLOptionPtr xmlopt,
                 if (trans) {
                     def->geometry.trans = virDomainDiskGeometryTransTypeFromString(trans);
                     if (def->geometry.trans <= 0) {
-                        virReportError(VIR_ERR_INTERNAL_ERROR,
+                        virReportError(VIR_ERR_XML_ERROR,
                                        _("invalid translation value '%s'"),
                                        trans);
                         goto error;
@@ -5379,7 +5379,7 @@ virDomainDiskDefParseXML(virDomainXMLOptionPtr xmlopt,
     device = virXMLPropString(node, "device");
     if (device) {
         if ((def->device = virDomainDiskDeviceTypeFromString(device)) < 0) {
-            virReportError(VIR_ERR_INTERNAL_ERROR,
+            virReportError(VIR_ERR_XML_ERROR,
                            _("unknown disk device '%s'"), device);
             goto error;
         }
@@ -5454,7 +5454,7 @@ virDomainDiskDefParseXML(virDomainXMLOptionPtr xmlopt,
     if (snapshot) {
         def->snapshot = virDomainSnapshotLocationTypeFromString(snapshot);
         if (def->snapshot <= 0) {
-            virReportError(VIR_ERR_INTERNAL_ERROR,
+            virReportError(VIR_ERR_XML_ERROR,
                            _("unknown disk snapshot setting '%s'"),
                            snapshot);
             goto error;
@@ -5495,7 +5495,7 @@ virDomainDiskDefParseXML(virDomainXMLOptionPtr xmlopt,
 
     if (bus) {
         if ((def->bus = virDomainDiskBusTypeFromString(bus)) < 0) {
-            virReportError(VIR_ERR_INTERNAL_ERROR,
+            virReportError(VIR_ERR_XML_ERROR,
                            _("unknown disk bus type '%s'"), bus);
             goto error;
         }
@@ -5570,14 +5570,14 @@ virDomainDiskDefParseXML(virDomainXMLOptionPtr xmlopt,
 
     if (cachetag &&
         (def->cachemode = virDomainDiskCacheTypeFromString(cachetag)) < 0) {
-        virReportError(VIR_ERR_INTERNAL_ERROR,
+        virReportError(VIR_ERR_XML_ERROR,
                        _("unknown disk cache mode '%s'"), cachetag);
         goto error;
     }
 
     if (error_policy &&
         (def->error_policy = virDomainDiskErrorPolicyTypeFromString(error_policy)) <= 0) {
-        virReportError(VIR_ERR_INTERNAL_ERROR,
+        virReportError(VIR_ERR_XML_ERROR,
                        _("unknown disk error policy '%s'"), error_policy);
         goto error;
     }
@@ -5586,7 +5586,7 @@ virDomainDiskDefParseXML(virDomainXMLOptionPtr xmlopt,
         (((def->rerror_policy
            = virDomainDiskErrorPolicyTypeFromString(rerror_policy)) <= 0) ||
          (def->rerror_policy == VIR_DOMAIN_DISK_ERROR_POLICY_ENOSPACE))) {
-        virReportError(VIR_ERR_INTERNAL_ERROR,
+        virReportError(VIR_ERR_XML_ERROR,
                        _("unknown disk read error policy '%s'"),
                        rerror_policy);
         goto error;
@@ -5595,7 +5595,7 @@ virDomainDiskDefParseXML(virDomainXMLOptionPtr xmlopt,
     if (iotag) {
         if ((def->iomode = virDomainDiskIoTypeFromString(iotag)) < 0 ||
             def->iomode == VIR_DOMAIN_DISK_IO_DEFAULT) {
-            virReportError(VIR_ERR_INTERNAL_ERROR,
+            virReportError(VIR_ERR_XML_ERROR,
                            _("unknown disk io mode '%s'"), iotag);
             goto error;
         }
@@ -5612,7 +5612,7 @@ virDomainDiskDefParseXML(virDomainXMLOptionPtr xmlopt,
         }
 
         if ((val = virDomainIoEventFdTypeFromString(ioeventfd)) <= 0) {
-            virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+            virReportError(VIR_ERR_XML_ERROR,
                            _("unknown disk ioeventfd mode '%s'"),
                            ioeventfd);
             goto error;
@@ -5630,7 +5630,7 @@ virDomainDiskDefParseXML(virDomainXMLOptionPtr xmlopt,
 
         int idx;
         if ((idx = virDomainVirtioEventIdxTypeFromString(event_idx)) <= 0) {
-            virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+            virReportError(VIR_ERR_XML_ERROR,
                            _("unknown disk event_idx mode '%s'"),
                            event_idx);
             goto error;
@@ -5641,7 +5641,7 @@ virDomainDiskDefParseXML(virDomainXMLOptionPtr xmlopt,
     if (copy_on_read) {
         int cor;
         if ((cor = virDomainDiskCopyOnReadTypeFromString(copy_on_read)) <= 0) {
-            virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+            virReportError(VIR_ERR_XML_ERROR,
                            _("unknown disk copy_on_read mode '%s'"),
                            copy_on_read);
             goto error;
@@ -5651,7 +5651,7 @@ virDomainDiskDefParseXML(virDomainXMLOptionPtr xmlopt,
 
     if (discard) {
         if ((def->discard = virDomainDiskDiscardTypeFromString(discard)) <= 0) {
-            virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+            virReportError(VIR_ERR_XML_ERROR,
                            _("unknown disk discard mode '%s'"), discard);
             goto error;
         }
@@ -5676,7 +5676,7 @@ virDomainDiskDefParseXML(virDomainXMLOptionPtr xmlopt,
         int val;
 
         if ((val = virDomainStartupPolicyTypeFromString(startupPolicy)) <= 0) {
-            virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+            virReportError(VIR_ERR_XML_ERROR,
                            _("unknown startupPolicy value '%s'"),
                            startupPolicy);
             goto error;
@@ -5726,7 +5726,7 @@ virDomainDiskDefParseXML(virDomainXMLOptionPtr xmlopt,
     if (driverType) {
         def->format = virStorageFileFormatTypeFromString(driverType);
         if (def->format <= 0) {
-            virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+            virReportError(VIR_ERR_XML_ERROR,
                            _("unknown driver format value '%s'"),
                            driverType);
             goto error;
@@ -5736,7 +5736,7 @@ virDomainDiskDefParseXML(virDomainXMLOptionPtr xmlopt,
     if (mirrorFormat) {
         def->mirrorFormat = virStorageFileFormatTypeFromString(mirrorFormat);
         if (def->mirrorFormat <= 0) {
-            virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+            virReportError(VIR_ERR_XML_ERROR,
                            _("unknown mirror format value '%s'"),
                            driverType);
             goto error;
@@ -5887,7 +5887,7 @@ virDomainControllerDefParseXML(xmlNodePtr node,
     type = virXMLPropString(node, "type");
     if (type) {
         if ((def->type = virDomainControllerTypeFromString(type)) < 0) {
-            virReportError(VIR_ERR_INTERNAL_ERROR,
+            virReportError(VIR_ERR_XML_ERROR,
                            _("Unknown controller type '%s'"), type);
             goto error;
         }
@@ -5906,7 +5906,7 @@ virDomainControllerDefParseXML(xmlNodePtr node,
     model = virXMLPropString(node, "model");
     if (model) {
         if ((def->model = virDomainControllerModelTypeFromString(def, model)) < 0) {
-            virReportError(VIR_ERR_INTERNAL_ERROR,
+            virReportError(VIR_ERR_XML_ERROR,
                            _("Unknown model type '%s'"), model);
             goto error;
         }
@@ -6081,7 +6081,7 @@ virDomainFSDefParseXML(xmlNodePtr node,
     type = virXMLPropString(node, "type");
     if (type) {
         if ((def->type = virDomainFSTypeFromString(type)) < 0) {
-            virReportError(VIR_ERR_INTERNAL_ERROR,
+            virReportError(VIR_ERR_XML_ERROR,
                            _("unknown filesystem type '%s'"), type);
             goto error;
         }
@@ -6092,7 +6092,7 @@ virDomainFSDefParseXML(xmlNodePtr node,
     accessmode = virXMLPropString(node, "accessmode");
     if (accessmode) {
         if ((def->accessmode = virDomainFSAccessModeTypeFromString(accessmode)) < 0) {
-            virReportError(VIR_ERR_INTERNAL_ERROR,
+            virReportError(VIR_ERR_XML_ERROR,
                            _("unknown accessmode '%s'"), accessmode);
             goto error;
         }
@@ -6148,7 +6148,7 @@ virDomainFSDefParseXML(xmlNodePtr node,
 
     if (fsdriver) {
         if ((def->fsdriver = virDomainFSDriverTypeTypeFromString(fsdriver)) <= 0) {
-            virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+            virReportError(VIR_ERR_XML_ERROR,
                            _("unknown fs driver type '%s'"), fsdriver);
             goto error;
         }
@@ -6156,7 +6156,7 @@ virDomainFSDefParseXML(xmlNodePtr node,
 
     if (format) {
         if ((def->format = virStorageFileFormatTypeFromString(format)) <= 0) {
-            virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+            virReportError(VIR_ERR_XML_ERROR,
                            _("unknown driver format value '%s'"), format);
             goto error;
         }
@@ -6164,7 +6164,7 @@ virDomainFSDefParseXML(xmlNodePtr node,
 
     if (wrpolicy) {
         if ((def->wrpolicy = virDomainFSWrpolicyTypeFromString(wrpolicy)) <= 0) {
-            virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+            virReportError(VIR_ERR_XML_ERROR,
                            _("unknown filesystem write policy '%s'"), wrpolicy);
             goto error;
         }
@@ -6259,7 +6259,7 @@ virDomainActualNetDefParseXML(xmlNodePtr node,
         goto error;
     }
     if ((actual->type = virDomainNetTypeFromString(type)) < 0) {
-        virReportError(VIR_ERR_INTERNAL_ERROR,
+        virReportError(VIR_ERR_XML_ERROR,
                        _("unknown type '%s' in interface's <actual> element"), type);
         goto error;
     }
@@ -6302,7 +6302,7 @@ virDomainActualNetDefParseXML(xmlNodePtr node,
         if (mode) {
             int m;
             if ((m = virNetDevMacVLanModeTypeFromString(mode)) < 0) {
-                virReportError(VIR_ERR_INTERNAL_ERROR,
+                virReportError(VIR_ERR_XML_ERROR,
                                _("Unknown mode '%s' in interface <actual> element"),
                                mode);
                 goto error;
@@ -6417,7 +6417,7 @@ virDomainNetDefParseXML(virDomainXMLOptionPtr xmlopt,
     type = virXMLPropString(node, "type");
     if (type != NULL) {
         if ((int)(def->type = virDomainNetTypeFromString(type)) < 0) {
-            virReportError(VIR_ERR_INTERNAL_ERROR,
+            virReportError(VIR_ERR_XML_ERROR,
                            _("unknown interface type '%s'"), type);
             goto error;
         }
@@ -6684,7 +6684,7 @@ virDomainNetDefParseXML(virDomainXMLOptionPtr xmlopt,
         if (mode != NULL) {
             int m;
             if ((m = virNetDevMacVLanModeTypeFromString(mode)) < 0) {
-                virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+                virReportError(VIR_ERR_XML_ERROR, "%s",
                                _("Unknown mode has been specified"));
                 goto error;
             }
@@ -6758,7 +6758,7 @@ virDomainNetDefParseXML(virDomainXMLOptionPtr xmlopt,
             int name;
             if ((name = virDomainNetBackendTypeFromString(backend)) < 0 ||
                 name == VIR_DOMAIN_NET_BACKEND_TYPE_DEFAULT) {
-                virReportError(VIR_ERR_INTERNAL_ERROR,
+                virReportError(VIR_ERR_XML_ERROR,
                                _("Unknown interface <driver name='%s'> "
                                  "has been specified"),
                                backend);
@@ -6770,7 +6770,7 @@ virDomainNetDefParseXML(virDomainXMLOptionPtr xmlopt,
             int m;
             if ((m = virDomainNetVirtioTxModeTypeFromString(txmode)) < 0 ||
                 m == VIR_DOMAIN_NET_VIRTIO_TX_MODE_DEFAULT) {
-                virReportError(VIR_ERR_INTERNAL_ERROR,
+                virReportError(VIR_ERR_XML_ERROR,
                                _("Unknown interface <driver txmode='%s'> "
                                  "has been specified"),
                                txmode);
@@ -6781,7 +6781,7 @@ virDomainNetDefParseXML(virDomainXMLOptionPtr xmlopt,
         if (ioeventfd) {
             int val;
             if ((val = virDomainIoEventFdTypeFromString(ioeventfd)) <= 0) {
-                virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+                virReportError(VIR_ERR_XML_ERROR,
                                _("unknown interface ioeventfd mode '%s'"),
                                ioeventfd);
                 goto error;
@@ -6791,7 +6791,7 @@ virDomainNetDefParseXML(virDomainXMLOptionPtr xmlopt,
         if (event_idx) {
             int idx;
             if ((idx = virDomainVirtioEventIdxTypeFromString(event_idx)) <= 0) {
-                virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+                virReportError(VIR_ERR_XML_ERROR,
                                _("unknown interface event_idx mode '%s'"),
                                event_idx);
                 goto error;
@@ -6813,7 +6813,7 @@ virDomainNetDefParseXML(virDomainXMLOptionPtr xmlopt,
     def->linkstate = VIR_DOMAIN_NET_INTERFACE_LINK_STATE_DEFAULT;
     if (linkstate != NULL) {
         if ((def->linkstate = virDomainNetInterfaceLinkStateTypeFromString(linkstate)) <= 0) {
-            virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+            virReportError(VIR_ERR_XML_ERROR,
                            _("unknown interface link state '%s'"),
                            linkstate);
             goto error;
@@ -7198,7 +7198,7 @@ virDomainChrSourceDefParseXML(virDomainChrSourceDefPtr def,
             def->data.tcp.protocol = VIR_DOMAIN_CHR_TCP_PROTOCOL_RAW;
         else if ((def->data.tcp.protocol =
                   virDomainChrTcpProtocolTypeFromString(protocol)) < 0) {
-            virReportError(VIR_ERR_INTERNAL_ERROR,
+            virReportError(VIR_ERR_XML_ERROR,
                            _("Unknown protocol '%s'"), protocol);
             goto error;
         }
@@ -7555,7 +7555,7 @@ virDomainTPMDefParseXML(xmlNodePtr node,
     model = virXMLPropString(node, "model");
     if (model != NULL &&
         (int)(def->model = virDomainTPMModelTypeFromString(model)) < 0) {
-        virReportError(VIR_ERR_INVALID_ARG,
+        virReportError(VIR_ERR_XML_ERROR,
                        _("Unknown TPM frontend model '%s'"), model);
         goto error;
     } else {
@@ -7646,14 +7646,14 @@ virDomainInputDefParseXML(const char *ostype,
     }
 
     if ((def->type = virDomainInputTypeFromString(type)) < 0) {
-        virReportError(VIR_ERR_INTERNAL_ERROR,
+        virReportError(VIR_ERR_XML_ERROR,
                        _("unknown input device type '%s'"), type);
         goto error;
     }
 
     if (bus) {
         if ((def->bus = virDomainInputBusTypeFromString(bus)) < 0) {
-            virReportError(VIR_ERR_INTERNAL_ERROR,
+            virReportError(VIR_ERR_XML_ERROR,
                            _("unknown input bus type '%s'"), bus);
             goto error;
         }
@@ -7739,7 +7739,7 @@ virDomainHubDefParseXML(xmlNodePtr node, unsigned int flags)
     }
 
     if ((def->type = virDomainHubTypeFromString(type)) < 0) {
-        virReportError(VIR_ERR_INTERNAL_ERROR,
+        virReportError(VIR_ERR_XML_ERROR,
                        _("unknown hub device type '%s'"), type);
         goto error;
     }
@@ -7787,7 +7787,7 @@ virDomainTimerDefParseXML(xmlNodePtr node,
         goto error;
     }
     if ((def->name = virDomainTimerNameTypeFromString(name)) < 0) {
-        virReportError(VIR_ERR_INTERNAL_ERROR,
+        virReportError(VIR_ERR_XML_ERROR,
                        _("unknown timer name '%s'"), name);
         goto error;
     }
@@ -7809,7 +7809,7 @@ virDomainTimerDefParseXML(xmlNodePtr node,
     tickpolicy = virXMLPropString(node, "tickpolicy");
     if (tickpolicy != NULL) {
         if ((def->tickpolicy = virDomainTimerTickpolicyTypeFromString(tickpolicy)) < 0) {
-            virReportError(VIR_ERR_INTERNAL_ERROR,
+            virReportError(VIR_ERR_XML_ERROR,
                            _("unknown timer tickpolicy '%s'"), tickpolicy);
             goto error;
         }
@@ -7819,7 +7819,7 @@ virDomainTimerDefParseXML(xmlNodePtr node,
     track = virXMLPropString(node, "track");
     if (track != NULL) {
         if ((def->track = virDomainTimerTrackTypeFromString(track)) < 0) {
-            virReportError(VIR_ERR_INTERNAL_ERROR,
+            virReportError(VIR_ERR_XML_ERROR,
                            _("unknown timer track '%s'"), track);
             goto error;
         }
@@ -7838,7 +7838,7 @@ virDomainTimerDefParseXML(xmlNodePtr node,
     mode = virXMLPropString(node, "mode");
     if (mode != NULL) {
         if ((def->mode = virDomainTimerModeTypeFromString(mode)) < 0) {
-            virReportError(VIR_ERR_INTERNAL_ERROR,
+            virReportError(VIR_ERR_XML_ERROR,
                            _("unknown timer mode '%s'"), mode);
             goto error;
         }
@@ -7941,7 +7941,7 @@ virDomainGraphicsAuthDefParseXML(xmlNodePtr node,
     if (connected) {
         int action = virDomainGraphicsAuthConnectedTypeFromString(connected);
         if (action <= 0) {
-            virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+            virReportError(VIR_ERR_XML_ERROR,
                            _("unknown connected value %s"),
                            connected);
             VIR_FREE(connected);
@@ -8060,7 +8060,7 @@ virDomainGraphicsDefParseXML(xmlNodePtr node,
     }
 
     if ((def->type = virDomainGraphicsTypeFromString(type)) < 0) {
-        virReportError(VIR_ERR_INTERNAL_ERROR,
+        virReportError(VIR_ERR_XML_ERROR,
                        _("unknown graphics device type '%s'"), type);
         goto error;
     }
@@ -8186,7 +8186,7 @@ virDomainGraphicsDefParseXML(xmlNodePtr node,
                virDomainGraphicsVNCSharePolicyTypeFromString(sharePolicy);
 
             if (policy < 0) {
-                virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+                virReportError(VIR_ERR_XML_ERROR,
                                _("unknown vnc display sharing policy '%s'"), sharePolicy);
                 VIR_FREE(sharePolicy);
                 goto error;
@@ -8332,7 +8332,7 @@ virDomainGraphicsDefParseXML(xmlNodePtr node,
 
         if ((defaultMode = virXMLPropString(node, "defaultMode")) != NULL) {
             if ((defaultModeVal = virDomainGraphicsSpiceChannelModeTypeFromString(defaultMode)) < 0) {
-                virReportError(VIR_ERR_INTERNAL_ERROR,
+                virReportError(VIR_ERR_XML_ERROR,
                                _("unknown default spice channel mode %s"),
                                defaultMode);
                 VIR_FREE(defaultMode);
@@ -8376,7 +8376,7 @@ virDomainGraphicsDefParseXML(xmlNodePtr node,
                     }
 
                     if ((nameval = virDomainGraphicsSpiceChannelNameTypeFromString(name)) < 0) {
-                        virReportError(VIR_ERR_INTERNAL_ERROR,
+                        virReportError(VIR_ERR_XML_ERROR,
                                        _("unknown spice channel name %s"),
                                        name);
                         VIR_FREE(name);
@@ -8384,7 +8384,7 @@ virDomainGraphicsDefParseXML(xmlNodePtr node,
                         goto error;
                     }
                     if ((modeval = virDomainGraphicsSpiceChannelModeTypeFromString(mode)) < 0) {
-                        virReportError(VIR_ERR_INTERNAL_ERROR,
+                        virReportError(VIR_ERR_XML_ERROR,
                                        _("unknown spice channel mode %s"),
                                        mode);
                         VIR_FREE(name);
@@ -8407,7 +8407,7 @@ virDomainGraphicsDefParseXML(xmlNodePtr node,
 
                     if ((compressionVal =
                          virDomainGraphicsSpiceImageCompressionTypeFromString(compression)) <= 0) {
-                        virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+                        virReportError(VIR_ERR_XML_ERROR,
                                        _("unknown spice image compression %s"),
                                        compression);
                         VIR_FREE(compression);
@@ -8428,7 +8428,7 @@ virDomainGraphicsDefParseXML(xmlNodePtr node,
 
                     if ((compressionVal =
                          virDomainGraphicsSpiceJpegCompressionTypeFromString(compression)) <= 0) {
-                        virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+                        virReportError(VIR_ERR_XML_ERROR,
                                        _("unknown spice jpeg compression %s"),
                                        compression);
                         VIR_FREE(compression);
@@ -8449,7 +8449,7 @@ virDomainGraphicsDefParseXML(xmlNodePtr node,
 
                     if ((compressionVal =
                          virDomainGraphicsSpiceZlibCompressionTypeFromString(compression)) <= 0) {
-                        virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+                        virReportError(VIR_ERR_XML_ERROR,
                                        _("unknown spice zlib compression %s"),
                                        compression);
                         VIR_FREE(compression);
@@ -8470,7 +8470,7 @@ virDomainGraphicsDefParseXML(xmlNodePtr node,
 
                     if ((compressionVal =
                          virDomainGraphicsSpicePlaybackCompressionTypeFromString(compression)) <= 0) {
-                        virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+                        virReportError(VIR_ERR_XML_ERROR, "%s",
                                        _("unknown spice playback compression"));
                         VIR_FREE(compression);
                         goto error;
@@ -8490,7 +8490,7 @@ virDomainGraphicsDefParseXML(xmlNodePtr node,
                     }
                     if ((modeVal =
                          virDomainGraphicsSpiceStreamingModeTypeFromString(mode)) <= 0) {
-                        virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+                        virReportError(VIR_ERR_XML_ERROR, "%s",
                                        _("unknown spice streaming mode"));
                         VIR_FREE(mode);
                         goto error;
@@ -8511,7 +8511,7 @@ virDomainGraphicsDefParseXML(xmlNodePtr node,
 
                     if ((copypasteVal =
                          virDomainGraphicsSpiceClipboardCopypasteTypeFromString(copypaste)) <= 0) {
-                        virReportError(VIR_ERR_INTERNAL_ERROR,
+                        virReportError(VIR_ERR_XML_ERROR,
                                        _("unknown copypaste value '%s'"), copypaste);
                         VIR_FREE(copypaste);
                         goto error;
@@ -8571,7 +8571,7 @@ virDomainSoundCodecDefParseXML(xmlNodePtr node)
 
     type = virXMLPropString(node, "type");
     if ((def->type = virDomainSoundCodecTypeFromString(type)) < 0) {
-        virReportError(VIR_ERR_INTERNAL_ERROR,
+        virReportError(VIR_ERR_XML_ERROR,
                        _("unknown codec type '%s'"), type);
         goto error;
     }
@@ -8604,7 +8604,7 @@ virDomainSoundDefParseXML(xmlNodePtr node,
 
     model = virXMLPropString(node, "model");
     if ((def->model = virDomainSoundModelTypeFromString(model)) < 0) {
-        virReportError(VIR_ERR_INTERNAL_ERROR,
+        virReportError(VIR_ERR_XML_ERROR,
                        _("unknown sound model '%s'"), model);
         goto error;
     }
@@ -8677,7 +8677,7 @@ virDomainWatchdogDefParseXML(xmlNodePtr node,
     }
     def->model = virDomainWatchdogModelTypeFromString(model);
     if (def->model < 0) {
-        virReportError(VIR_ERR_INTERNAL_ERROR,
+        virReportError(VIR_ERR_XML_ERROR,
                        _("unknown watchdog model '%s'"), model);
         goto error;
     }
@@ -8688,7 +8688,7 @@ virDomainWatchdogDefParseXML(xmlNodePtr node,
     else {
         def->action = virDomainWatchdogActionTypeFromString(action);
         if (def->action < 0) {
-            virReportError(VIR_ERR_INTERNAL_ERROR,
+            virReportError(VIR_ERR_XML_ERROR,
                            _("unknown watchdog action '%s'"), action);
             goto error;
         }
@@ -8923,7 +8923,7 @@ virSysinfoParseXML(xmlNodePtr node,
         goto error;
     }
     if ((def->type = virSysinfoTypeFromString(type)) < 0) {
-        virReportError(VIR_ERR_INTERNAL_ERROR,
+        virReportError(VIR_ERR_XML_ERROR,
                        _("unknown sysinfo type '%s'"), type);
         goto error;
     }
@@ -9159,7 +9159,7 @@ virDomainVideoDefParseXML(xmlNodePtr node,
 
     if (type) {
         if ((def->type = virDomainVideoTypeFromString(type)) < 0) {
-            virReportError(VIR_ERR_INTERNAL_ERROR,
+            virReportError(VIR_ERR_XML_ERROR,
                            _("unknown video model '%s'"), type);
             goto error;
         }
@@ -9245,7 +9245,7 @@ virDomainHostdevDefParseXML(virDomainXMLOptionPtr xmlopt,
 
     if (mode) {
         if ((def->mode = virDomainHostdevModeTypeFromString(mode)) < 0) {
-            virReportError(VIR_ERR_INTERNAL_ERROR,
+            virReportError(VIR_ERR_XML_ERROR,
                            _("unknown hostdev mode '%s'"), mode);
             goto error;
         }
@@ -9333,7 +9333,7 @@ virDomainRedirdevDefParseXML(xmlNodePtr node,
     bus = virXMLPropString(node, "bus");
     if (bus) {
         if ((def->bus = virDomainRedirdevBusTypeFromString(bus)) < 0) {
-            virReportError(VIR_ERR_INTERNAL_ERROR,
+            virReportError(VIR_ERR_XML_ERROR,
                            _("unknown redirdev bus '%s'"), bus);
             goto error;
         }
@@ -9344,7 +9344,7 @@ virDomainRedirdevDefParseXML(xmlNodePtr node,
     type = virXMLPropString(node, "type");
     if (type) {
         if ((def->source.chr.type = virDomainChrTypeFromString(type)) < 0) {
-            virReportError(VIR_ERR_INTERNAL_ERROR,
+            virReportError(VIR_ERR_XML_ERROR,
                            _("unknown redirdev character device type '%s'"), type);
             goto error;
         }
@@ -9599,7 +9599,7 @@ virDomainEventActionParseXML(xmlXPathContextPtr ctxt,
     } else {
         *val = convFunc(tmp);
         if (*val < 0) {
-            virReportError(VIR_ERR_INTERNAL_ERROR,
+            virReportError(VIR_ERR_XML_ERROR,
                            _("unknown %s action: %s"), name, tmp);
             VIR_FREE(tmp);
             return -1;
@@ -9619,7 +9619,7 @@ virDomainPMStateParseXML(xmlXPathContextPtr ctxt,
     if (tmp) {
         *val = virDomainPMStateTypeFromString(tmp);
         if (*val < 0) {
-            virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+            virReportError(VIR_ERR_XML_ERROR,
                            _("unknown PM state value %s"), tmp);
             goto cleanup;
         }
@@ -10619,7 +10619,7 @@ virDomainDefParseBootXML(xmlXPathContextPtr ctxt,
             goto cleanup;
         }
         if ((val = virDomainBootTypeFromString(dev)) < 0) {
-            virReportError(VIR_ERR_INTERNAL_ERROR,
+            virReportError(VIR_ERR_XML_ERROR,
                            _("unknown boot device '%s'"),
                            dev);
             VIR_FREE(dev);
@@ -11023,7 +11023,7 @@ virDomainDefParseXML(xmlDocPtr xml,
     }
 
     if ((def->virtType = virDomainVirtTypeFromString(tmp)) < 0) {
-        virReportError(VIR_ERR_INTERNAL_ERROR,
+        virReportError(VIR_ERR_XML_ERROR,
                        _("invalid domain type %s"), tmp);
         goto error;
     }
@@ -11579,7 +11579,7 @@ virDomainDefParseXML(xmlDocPtr xml,
     for (i = 0; i < n; i++) {
         int val = virDomainFeatureTypeFromString((const char *)nodes[i]->name);
         if (val < 0) {
-            virReportError(VIR_ERR_INTERNAL_ERROR,
+            virReportError(VIR_ERR_XML_ERROR,
                            _("unexpected feature '%s'"), nodes[i]->name);
             goto error;
         }
@@ -11589,7 +11589,7 @@ virDomainDefParseXML(xmlDocPtr xml,
             if ((tmp = virXPathString("string(./features/apic/@eoi)", ctxt))) {
                 int eoi;
                 if ((eoi = virDomainFeatureStateTypeFromString(tmp)) <= 0) {
-                    virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+                    virReportError(VIR_ERR_XML_ERROR,
                                    _("unknown value for attribute eoi: '%s'"),
                                    tmp);
                     goto error;
@@ -11612,7 +11612,7 @@ virDomainDefParseXML(xmlDocPtr xml,
             ctxt->node = nodes[i];
             if ((tmp = virXPathString("string(./@state)", ctxt))) {
                 if ((def->features[val] = virDomainFeatureStateTypeFromString(tmp)) == -1) {
-                    virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+                    virReportError(VIR_ERR_XML_ERROR,
                                    _("unknown state attribute '%s' of feature '%s'"),
                                    tmp, virDomainFeatureTypeToString(val));
                     goto error;
@@ -11755,7 +11755,7 @@ virDomainDefParseXML(xmlDocPtr xml,
 
     if ((tmp = virXPathString("string(./clock/@offset)", ctxt)) &&
         (def->clock.offset = virDomainClockOffsetTypeFromString(tmp)) < 0) {
-        virReportError(VIR_ERR_INTERNAL_ERROR,
+        virReportError(VIR_ERR_XML_ERROR,
                        _("unknown clock offset '%s'"), tmp);
         goto error;
     }
@@ -11799,7 +11799,7 @@ virDomainDefParseXML(xmlDocPtr xml,
         tmp = virXPathString("string(./clock/@basis)", ctxt);
         if (tmp) {
             if ((def->clock.data.variable.basis = virDomainClockBasisTypeFromString(tmp)) < 0) {
-                virReportError(VIR_ERR_INTERNAL_ERROR,
+                virReportError(VIR_ERR_XML_ERROR,
                                _("unknown clock basis '%s'"), tmp);
                 goto error;
             }
@@ -11881,7 +11881,7 @@ virDomainDefParseXML(xmlDocPtr xml,
     if (tmp) {
         def->os.arch = virArchFromString(tmp);
         if (!def->os.arch) {
-            virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+            virReportError(VIR_ERR_XML_ERROR,
                            _("Unknown architecture %s"),
                            tmp);
             goto error;
@@ -12686,7 +12686,7 @@ virDomainDefParseXML(xmlDocPtr xml,
         int mode;
 
         if ((mode = virDomainSmbiosModeTypeFromString(tmp)) < 0) {
-            virReportError(VIR_ERR_INTERNAL_ERROR,
+            virReportError(VIR_ERR_XML_ERROR,
                            _("unknown smbios mode '%s'"), tmp);
             goto error;
         }
@@ -12770,7 +12770,7 @@ virDomainObjParseXML(xmlDocPtr xml,
         goto error;
     }
     if ((state = virDomainStateTypeFromString(tmp)) < 0) {
-        virReportError(VIR_ERR_INTERNAL_ERROR,
+        virReportError(VIR_ERR_XML_ERROR,
                        _("invalid domain state '%s'"), tmp);
         VIR_FREE(tmp);
         goto error;
@@ -12779,7 +12779,7 @@ virDomainObjParseXML(xmlDocPtr xml,
 
     if ((tmp = virXPathString("string(./@reason)", ctxt))) {
         if ((reason = virDomainStateReasonFromString(state, tmp)) < 0) {
-            virReportError(VIR_ERR_INTERNAL_ERROR,
+            virReportError(VIR_ERR_XML_ERROR,
                            _("invalid domain state reason '%s'"), tmp);
             VIR_FREE(tmp);
             goto error;
@@ -12804,7 +12804,7 @@ virDomainObjParseXML(xmlDocPtr xml,
         if (str) {
             int flag = virDomainTaintTypeFromString(str);
             if (flag < 0) {
-                virReportError(VIR_ERR_INTERNAL_ERROR,
+                virReportError(VIR_ERR_XML_ERROR,
                                _("Unknown taint flag %s"), str);
                 VIR_FREE(str);
                 goto error;
diff --git a/src/conf/network_conf.c b/src/conf/network_conf.c
index 481fc5b..537cc2a 100644
--- a/src/conf/network_conf.c
+++ b/src/conf/network_conf.c
@@ -1747,7 +1747,7 @@ virNetworkForwardDefParseXML(const char *networkName,
             = virNetworkForwardDriverNameTypeFromString(forwardDriverName);
 
         if (driverName <= 0) {
-            virReportError(VIR_ERR_INTERNAL_ERROR,
+            virReportError(VIR_ERR_XML_ERROR,
                            _("Unknown forward <driver name='%s'/> "
                              "in network %s"),
                            forwardDriverName, networkName);
diff --git a/src/conf/node_device_conf.c b/src/conf/node_device_conf.c
index 171cd7c..51a76ea 100644
--- a/src/conf/node_device_conf.c
+++ b/src/conf/node_device_conf.c
@@ -854,7 +854,7 @@ virNodeDevCapNetParseXML(xmlXPathContextPtr ctxt,
         int val = virNodeDevNetCapTypeFromString(tmp);
         VIR_FREE(tmp);
         if (val < 0) {
-            virReportError(VIR_ERR_INTERNAL_ERROR,
+            virReportError(VIR_ERR_XML_ERROR,
                            _("invalid network type supplied for '%s'"),
                            def->name);
             goto out;
@@ -1166,7 +1166,7 @@ virNodeDevCapsDefParseXML(xmlXPathContextPtr ctxt,
     }
 
     if ((val = virNodeDevCapTypeFromString(tmp)) < 0) {
-        virReportError(VIR_ERR_INTERNAL_ERROR,
+        virReportError(VIR_ERR_XML_ERROR,
                        _("unknown capability type '%s'"), tmp);
         VIR_FREE(tmp);
         goto error;
diff --git a/src/conf/nwfilter_conf.c b/src/conf/nwfilter_conf.c
index d280df5..3ebdc1f 100644
--- a/src/conf/nwfilter_conf.c
+++ b/src/conf/nwfilter_conf.c
@@ -2319,7 +2319,7 @@ virNWFilterRuleParse(xmlNodePtr node)
     }
 
     if ((ret->action = virNWFilterRuleActionTypeFromString(action)) < 0) {
-        virReportError(VIR_ERR_INTERNAL_ERROR,
+        virReportError(VIR_ERR_XML_ERROR,
                        "%s",
                        _("unknown rule action attribute value"));
         goto err_exit;
@@ -2333,7 +2333,7 @@ virNWFilterRuleParse(xmlNodePtr node)
     }
 
     if ((ret->tt = virNWFilterRuleDirectionTypeFromString(direction)) < 0) {
-        virReportError(VIR_ERR_INTERNAL_ERROR,
+        virReportError(VIR_ERR_XML_ERROR,
                        "%s",
                        _("unknown rule direction attribute value"));
         goto err_exit;
diff --git a/src/conf/snapshot_conf.c b/src/conf/snapshot_conf.c
index c18b99b..74ffe47 100644
--- a/src/conf/snapshot_conf.c
+++ b/src/conf/snapshot_conf.c
@@ -121,7 +121,7 @@ virDomainSnapshotDiskDefParseXML(xmlNodePtr node,
     if (snapshot) {
         def->snapshot = virDomainSnapshotLocationTypeFromString(snapshot);
         if (def->snapshot <= 0) {
-            virReportError(VIR_ERR_INTERNAL_ERROR,
+            virReportError(VIR_ERR_XML_ERROR,
                            _("unknown disk snapshot setting '%s'"),
                            snapshot);
             goto cleanup;
@@ -157,7 +157,7 @@ virDomainSnapshotDiskDefParseXML(xmlNodePtr node,
             if (driver) {
                 def->format = virStorageFileFormatTypeFromString(driver);
                 if (def->format <= 0) {
-                    virReportError(VIR_ERR_INTERNAL_ERROR,
+                    virReportError(VIR_ERR_XML_ERROR,
                                    _("unknown disk snapshot driver '%s'"),
                                    driver);
                     VIR_FREE(driver);
-- 
1.8.4.2


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