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

[libvirt] [PATCH 1/4] Fix error messages codes when TypeFromString fails



---
 src/conf/cpu_conf.c                |    4 +-
 src/conf/domain_conf.c             |  100 ++++++++++++++++++-----------------
 src/conf/interface_conf.c          |    2 +-
 src/conf/network_conf.c            |    2 +-
 src/conf/node_device_conf.c        |    4 +-
 src/conf/nwfilter_conf.c           |    6 +-
 src/conf/secret_conf.c             |    2 +-
 src/conf/storage_conf.c            |    2 +-
 src/conf/storage_encryption_conf.c |    4 +-
 9 files changed, 64 insertions(+), 62 deletions(-)

diff --git a/src/conf/cpu_conf.c b/src/conf/cpu_conf.c
index 98d598a..5b7b363 100644
--- a/src/conf/cpu_conf.c
+++ b/src/conf/cpu_conf.c
@@ -156,7 +156,7 @@ virCPUDefParseXML(const xmlNodePtr node,
             VIR_FREE(match);
 
             if (def->match < 0) {
-                virCPUReportError(VIR_ERR_INTERNAL_ERROR,
+                virCPUReportError(VIR_ERR_CONFIG_UNSUPPORTED,
                         "%s", _("Invalid match attribute for CPU specification"));
                 goto error;
             }
@@ -257,7 +257,7 @@ virCPUDefParseXML(const xmlNodePtr node,
             VIR_FREE(strpolicy);
 
             if (policy < 0) {
-                virCPUReportError(VIR_ERR_INTERNAL_ERROR,
+                virCPUReportError(VIR_ERR_CONFIG_UNSUPPORTED,
                         "%s", _("Invalid CPU feature policy"));
                 goto error;
             }
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 3298c80..e7e265c 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -1707,7 +1707,7 @@ virDomainDeviceInfoParseXML(xmlNodePtr node,
 
     if (type) {
         if ((info->type = virDomainDeviceAddressTypeFromString(type)) < 0) {
-            virDomainReportError(VIR_ERR_INTERNAL_ERROR,
+            virDomainReportError(VIR_ERR_CONFIG_UNSUPPORTED,
                                  _("unknown address type '%s'"), type);
             goto cleanup;
         }
@@ -1914,7 +1914,7 @@ virDomainDiskDefParseXML(virCapsPtr caps,
     type = virXMLPropString(node, "type");
     if (type) {
         if ((def->type = virDomainDiskTypeFromString(type)) < 0) {
-            virDomainReportError(VIR_ERR_INTERNAL_ERROR,
+            virDomainReportError(VIR_ERR_CONFIG_UNSUPPORTED,
                                  _("unknown disk type '%s'"), type);
             goto error;
         }
@@ -1947,7 +1947,7 @@ virDomainDiskDefParseXML(virCapsPtr caps,
                     }
                     def->protocol = virDomainDiskProtocolTypeFromString(protocol);
                     if (def->protocol < 0) {
-                        virDomainReportError(VIR_ERR_INTERNAL_ERROR,
+                        virDomainReportError(VIR_ERR_CONFIG_UNSUPPORTED,
                                              _("unknown protocol type '%s'"),
                                              protocol);
                         goto error;
@@ -2046,7 +2046,7 @@ virDomainDiskDefParseXML(virCapsPtr caps,
     device = virXMLPropString(node, "device");
     if (device) {
         if ((def->device = virDomainDiskDeviceTypeFromString(device)) < 0) {
-            virDomainReportError(VIR_ERR_INTERNAL_ERROR,
+            virDomainReportError(VIR_ERR_CONFIG_UNSUPPORTED,
                                  _("unknown disk device '%s'"), device);
             goto error;
         }
@@ -2094,7 +2094,7 @@ virDomainDiskDefParseXML(virCapsPtr caps,
 
     if (bus) {
         if ((def->bus = virDomainDiskBusTypeFromString(bus)) < 0) {
-            virDomainReportError(VIR_ERR_INTERNAL_ERROR,
+            virDomainReportError(VIR_ERR_CONFIG_UNSUPPORTED,
                                  _("unknown disk bus type '%s'"), bus);
             goto error;
         }
@@ -2132,14 +2132,14 @@ virDomainDiskDefParseXML(virCapsPtr caps,
 
     if (cachetag &&
         (def->cachemode = virDomainDiskCacheTypeFromString(cachetag)) < 0) {
-        virDomainReportError(VIR_ERR_INTERNAL_ERROR,
+        virDomainReportError(VIR_ERR_CONFIG_UNSUPPORTED,
                              _("unknown disk cache mode '%s'"), cachetag);
         goto error;
     }
 
     if (error_policy &&
         (def->error_policy = virDomainDiskErrorPolicyTypeFromString(error_policy)) < 0) {
-        virDomainReportError(VIR_ERR_INTERNAL_ERROR,
+        virDomainReportError(VIR_ERR_CONFIG_UNSUPPORTED,
                              _("unknown disk error policy '%s'"), error_policy);
         goto error;
     }
@@ -2147,7 +2147,7 @@ virDomainDiskDefParseXML(virCapsPtr caps,
     if (iotag) {
         if ((def->iomode = virDomainDiskIoTypeFromString(iotag)) < 0 ||
             def->iomode == VIR_DOMAIN_DISK_IO_DEFAULT) {
-            virDomainReportError(VIR_ERR_INTERNAL_ERROR,
+            virDomainReportError(VIR_ERR_CONFIG_UNSUPPORTED,
                                  _("unknown disk io mode '%s'"), iotag);
             goto error;
         }
@@ -2251,7 +2251,7 @@ virDomainControllerDefParseXML(xmlNodePtr node,
     type = virXMLPropString(node, "type");
     if (type) {
         if ((def->type = virDomainControllerTypeFromString(type)) < 0) {
-            virDomainReportError(VIR_ERR_INTERNAL_ERROR,
+            virDomainReportError(VIR_ERR_CONFIG_UNSUPPORTED,
                                  _("Unknown controller type '%s'"), type);
             goto error;
         }
@@ -2269,7 +2269,7 @@ virDomainControllerDefParseXML(xmlNodePtr node,
     model = virXMLPropString(node, "model");
     if (model) {
         if ((def->model = virDomainControllerModelTypeFromString(model)) < 0) {
-            virDomainReportError(VIR_ERR_INTERNAL_ERROR,
+            virDomainReportError(VIR_ERR_CONFIG_UNSUPPORTED,
                                  _("Unknown model type '%s'"), model);
             goto error;
         }
@@ -2359,7 +2359,7 @@ virDomainFSDefParseXML(xmlNodePtr node,
     type = virXMLPropString(node, "type");
     if (type) {
         if ((def->type = virDomainFSTypeFromString(type)) < 0) {
-            virDomainReportError(VIR_ERR_INTERNAL_ERROR,
+            virDomainReportError(VIR_ERR_CONFIG_UNSUPPORTED,
                                  _("unknown filesystem type '%s'"), type);
             goto error;
         }
@@ -2370,7 +2370,7 @@ virDomainFSDefParseXML(xmlNodePtr node,
     accessmode = virXMLPropString(node, "accessmode");
     if (accessmode) {
         if ((def->accessmode = virDomainFSAccessModeTypeFromString(accessmode)) < 0) {
-            virDomainReportError(VIR_ERR_INTERNAL_ERROR,
+            virDomainReportError(VIR_ERR_CONFIG_UNSUPPORTED,
                                  _("unknown accessmode '%s'"), accessmode);
             goto error;
         }
@@ -2622,7 +2622,7 @@ virDomainNetDefParseXML(virCapsPtr caps,
     type = virXMLPropString(node, "type");
     if (type != NULL) {
         if ((int)(def->type = virDomainNetTypeFromString(type)) < 0) {
-            virDomainReportError(VIR_ERR_INTERNAL_ERROR,
+            virDomainReportError(VIR_ERR_CONFIG_UNSUPPORTED,
                                  _("unknown interface type '%s'"), type);
             goto error;
         }
@@ -2834,7 +2834,7 @@ virDomainNetDefParseXML(virCapsPtr caps,
         if (mode != NULL) {
             int m;
             if ((m = virDomainNetdevMacvtapTypeFromString(mode)) < 0) {
-                virDomainReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+                virDomainReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
                                      _("Unkown mode has been specified"));
                 goto error;
             }
@@ -2887,7 +2887,7 @@ virDomainNetDefParseXML(virCapsPtr caps,
             int name;
             if (((name = virDomainNetBackendTypeFromString(backend)) < 0) ||
                 (name == VIR_DOMAIN_NET_BACKEND_TYPE_DEFAULT)) {
-                virDomainReportError(VIR_ERR_INTERNAL_ERROR,
+                virDomainReportError(VIR_ERR_CONFIG_UNSUPPORTED,
                                      _("Unknown interface <driver name='%s'> "
                                        "has been specified"),
                                      backend);
@@ -2899,7 +2899,7 @@ virDomainNetDefParseXML(virCapsPtr caps,
             int m;
             if (((m = virDomainNetVirtioTxModeTypeFromString(txmode)) < 0) ||
                 (m == VIR_DOMAIN_NET_VIRTIO_TX_MODE_DEFAULT)) {
-                virDomainReportError(VIR_ERR_INTERNAL_ERROR,
+                virDomainReportError(VIR_ERR_CONFIG_UNSUPPORTED,
                                      _("Unknown interface <driver txmode='%s'> "
                                        "has been specified"),
                                      txmode);
@@ -3037,6 +3037,8 @@ virDomainChrDefParseTargetXML(virCapsPtr caps,
     if ((def->targetType =
         virDomainChrTargetTypeFromString(caps,
                                          def->deviceType, targetType)) < 0) {
+        virDomainReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+                             _("unknown type %s"), targetType);
         goto error;
     }
 
@@ -3259,7 +3261,7 @@ virDomainChrSourceDefParseXML(virDomainChrSourceDefPtr def,
             def->data.tcp.protocol = VIR_DOMAIN_CHR_TCP_PROTOCOL_RAW;
         else if ((def->data.tcp.protocol =
                   virDomainChrTcpProtocolTypeFromString(protocol)) < 0) {
-            virDomainReportError(VIR_ERR_INTERNAL_ERROR,
+            virDomainReportError(VIR_ERR_CONFIG_UNSUPPORTED,
                                  _("Unknown protocol '%s'"), protocol);
             goto error;
         }
@@ -3386,7 +3388,7 @@ virDomainChrDefParseXML(virCapsPtr caps,
     if (type == NULL) {
         def->source.type = VIR_DOMAIN_CHR_TYPE_PTY;
     } else if ((def->source.type = virDomainChrTypeFromString(type)) < 0) {
-        virDomainReportError(VIR_ERR_XML_ERROR,
+        virDomainReportError(VIR_ERR_CONFIG_UNSUPPORTED,
                              _("unknown type presented to host for character device: %s"),
                              type);
         goto error;
@@ -3394,7 +3396,7 @@ virDomainChrDefParseXML(virCapsPtr caps,
 
     nodeName = (const char *) node->name;
     if ((def->deviceType = virDomainChrDeviceTypeFromString(nodeName)) < 0) {
-        virDomainReportError(VIR_ERR_XML_ERROR,
+        virDomainReportError(VIR_ERR_CONFIG_UNSUPPORTED,
                              _("unknown character device type: %s"),
                              nodeName);
     }
@@ -3464,7 +3466,7 @@ virDomainSmartcardDefParseXML(xmlNodePtr node,
         goto error;
     }
     if ((def->type = virDomainSmartcardTypeFromString(mode)) < 0) {
-        virDomainReportError(VIR_ERR_XML_ERROR,
+        virDomainReportError(VIR_ERR_CONFIG_UNSUPPORTED,
                              _("unknown smartcard device mode: %s"),
                              mode);
         goto error;
@@ -3526,7 +3528,7 @@ virDomainSmartcardDefParseXML(xmlNodePtr node,
             goto error;
         }
         if ((def->data.passthru.type = virDomainChrTypeFromString(type)) < 0) {
-            virDomainReportError(VIR_ERR_XML_ERROR,
+            virDomainReportError(VIR_ERR_CONFIG_UNSUPPORTED,
                                  _("unknown type presented to host for "
                                    "character device: %s"), type);
             goto error;
@@ -3594,14 +3596,14 @@ virDomainInputDefParseXML(const char *ostype,
     }
 
     if ((def->type = virDomainInputTypeFromString(type)) < 0) {
-        virDomainReportError(VIR_ERR_INTERNAL_ERROR,
+        virDomainReportError(VIR_ERR_CONFIG_UNSUPPORTED,
                              _("unknown input device type '%s'"), type);
         goto error;
     }
 
     if (bus) {
         if ((def->bus = virDomainInputBusTypeFromString(bus)) < 0) {
-            virDomainReportError(VIR_ERR_INTERNAL_ERROR,
+            virDomainReportError(VIR_ERR_CONFIG_UNSUPPORTED,
                                  _("unknown input bus type '%s'"), bus);
             goto error;
         }
@@ -3691,7 +3693,7 @@ virDomainTimerDefParseXML(const xmlNodePtr node,
         goto error;
     }
     if ((def->name = virDomainTimerNameTypeFromString(name)) < 0) {
-        virDomainReportError(VIR_ERR_INTERNAL_ERROR,
+        virDomainReportError(VIR_ERR_CONFIG_UNSUPPORTED,
                              _("unknown timer name '%s'"), name);
         goto error;
     }
@@ -3713,7 +3715,7 @@ virDomainTimerDefParseXML(const xmlNodePtr node,
     tickpolicy = virXMLPropString(node, "tickpolicy");
     if (tickpolicy != NULL) {
         if ((def->tickpolicy = virDomainTimerTickpolicyTypeFromString(tickpolicy)) < 0) {
-            virDomainReportError(VIR_ERR_INTERNAL_ERROR,
+            virDomainReportError(VIR_ERR_CONFIG_UNSUPPORTED,
                                  _("unknown timer tickpolicy '%s'"), tickpolicy);
             goto error;
         }
@@ -3723,7 +3725,7 @@ virDomainTimerDefParseXML(const xmlNodePtr node,
     track = virXMLPropString(node, "track");
     if (track != NULL) {
         if ((def->track = virDomainTimerTrackTypeFromString(track)) < 0) {
-            virDomainReportError(VIR_ERR_INTERNAL_ERROR,
+            virDomainReportError(VIR_ERR_CONFIG_UNSUPPORTED,
                                  _("unknown timer track '%s'"), track);
             goto error;
         }
@@ -3742,7 +3744,7 @@ virDomainTimerDefParseXML(const xmlNodePtr node,
     mode = virXMLPropString(node, "mode");
     if (mode != NULL) {
         if ((def->mode = virDomainTimerModeTypeFromString(mode)) < 0) {
-            virDomainReportError(VIR_ERR_INTERNAL_ERROR,
+            virDomainReportError(VIR_ERR_CONFIG_UNSUPPORTED,
                                  _("unknown timer mode '%s'"), mode);
             goto error;
         }
@@ -3863,7 +3865,7 @@ virDomainGraphicsDefParseXML(xmlNodePtr node, int flags) {
     }
 
     if ((def->type = virDomainGraphicsTypeFromString(type)) < 0) {
-        virDomainReportError(VIR_ERR_INTERNAL_ERROR,
+        virDomainReportError(VIR_ERR_CONFIG_UNSUPPORTED,
                              _("unknown graphics device type '%s'"), type);
         goto error;
     }
@@ -4052,7 +4054,7 @@ virDomainGraphicsDefParseXML(xmlNodePtr node, int flags) {
                     }
 
                     if ((nameval = virDomainGraphicsSpiceChannelNameTypeFromString(name)) < 0) {
-                        virDomainReportError(VIR_ERR_INTERNAL_ERROR,
+                        virDomainReportError(VIR_ERR_CONFIG_UNSUPPORTED,
                                              _("unknown spice channel name %s"),
                                              name);
                         VIR_FREE(name);
@@ -4060,7 +4062,7 @@ virDomainGraphicsDefParseXML(xmlNodePtr node, int flags) {
                         goto error;
                     }
                     if ((modeval = virDomainGraphicsSpiceChannelModeTypeFromString(mode)) < 0) {
-                        virDomainReportError(VIR_ERR_INTERNAL_ERROR,
+                        virDomainReportError(VIR_ERR_CONFIG_UNSUPPORTED,
                                              _("unknown spice channel mode %s"),
                                              mode);
                         VIR_FREE(name);
@@ -4187,7 +4189,7 @@ virDomainSoundDefParseXML(const xmlNodePtr node,
 
     model = virXMLPropString(node, "model");
     if ((def->model = virDomainSoundModelTypeFromString(model)) < 0) {
-        virDomainReportError(VIR_ERR_INTERNAL_ERROR,
+        virDomainReportError(VIR_ERR_CONFIG_UNSUPPORTED,
                              _("unknown sound model '%s'"), model);
         goto error;
     }
@@ -4229,7 +4231,7 @@ virDomainWatchdogDefParseXML(const xmlNodePtr node,
     }
     def->model = virDomainWatchdogModelTypeFromString (model);
     if (def->model < 0) {
-        virDomainReportError(VIR_ERR_INTERNAL_ERROR,
+        virDomainReportError(VIR_ERR_CONFIG_UNSUPPORTED,
                              _("unknown watchdog model '%s'"), model);
         goto error;
     }
@@ -4240,7 +4242,7 @@ virDomainWatchdogDefParseXML(const xmlNodePtr node,
     else {
         def->action = virDomainWatchdogActionTypeFromString (action);
         if (def->action < 0) {
-            virDomainReportError(VIR_ERR_INTERNAL_ERROR,
+            virDomainReportError(VIR_ERR_CONFIG_UNSUPPORTED,
                                  _("unknown watchdog action '%s'"), action);
             goto error;
         }
@@ -4281,7 +4283,7 @@ virDomainMemballoonDefParseXML(const xmlNodePtr node,
         goto error;
     }
     if ((def->model = virDomainMemballoonModelTypeFromString(model)) < 0) {
-        virDomainReportError(VIR_ERR_INTERNAL_ERROR,
+        virDomainReportError(VIR_ERR_CONFIG_UNSUPPORTED,
                              _("unknown memory balloon model '%s'"), model);
         goto error;
     }
@@ -4325,7 +4327,7 @@ virSysinfoParseXML(const xmlNodePtr node,
         goto error;
     }
     if ((def->type = virDomainSysinfoTypeFromString(type)) < 0) {
-        virDomainReportError(VIR_ERR_INTERNAL_ERROR,
+        virDomainReportError(VIR_ERR_CONFIG_UNSUPPORTED,
                              _("unknown sysinfo type '%s'"), type);
         goto error;
     }
@@ -4502,13 +4504,13 @@ virDomainVideoDefParseXML(const xmlNodePtr node,
 
     if (type) {
         if ((def->type = virDomainVideoTypeFromString(type)) < 0) {
-            virDomainReportError(VIR_ERR_INTERNAL_ERROR,
+            virDomainReportError(VIR_ERR_CONFIG_UNSUPPORTED,
                                  _("unknown video model '%s'"), type);
             goto error;
         }
     } else {
         if ((def->type = virDomainVideoDefaultType(dom)) < 0) {
-            virDomainReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+            virDomainReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
                                  _("missing video model and cannot determine default"));
             goto error;
         }
@@ -4516,7 +4518,7 @@ virDomainVideoDefParseXML(const xmlNodePtr node,
 
     if (vram) {
         if (virStrToLong_ui(vram, NULL, 10, &def->vram) < 0) {
-            virDomainReportError(VIR_ERR_INTERNAL_ERROR,
+            virDomainReportError(VIR_ERR_CONFIG_UNSUPPORTED,
                                  _("cannot parse video ram '%s'"), vram);
             goto error;
         }
@@ -4526,7 +4528,7 @@ virDomainVideoDefParseXML(const xmlNodePtr node,
 
     if (heads) {
         if (virStrToLong_ui(heads, NULL, 10, &def->heads) < 0) {
-            virDomainReportError(VIR_ERR_INTERNAL_ERROR,
+            virDomainReportError(VIR_ERR_CONFIG_UNSUPPORTED,
                                  _("cannot parse video heads '%s'"), heads);
             goto error;
         }
@@ -4739,7 +4741,7 @@ virDomainHostdevDefParseXML(const xmlNodePtr node,
     mode = virXMLPropString(node, "mode");
     if (mode) {
         if ((def->mode=virDomainHostdevModeTypeFromString(mode)) < 0) {
-             virDomainReportError(VIR_ERR_INTERNAL_ERROR,
+             virDomainReportError(VIR_ERR_CONFIG_UNSUPPORTED,
                                   _("unknown hostdev mode '%s'"), mode);
             goto error;
         }
@@ -4750,7 +4752,7 @@ virDomainHostdevDefParseXML(const xmlNodePtr node,
     type = virXMLPropString(node, "type");
     if (type) {
         if ((def->source.subsys.type = virDomainHostdevSubsysTypeFromString(type)) < 0) {
-            virDomainReportError(VIR_ERR_INTERNAL_ERROR,
+            virDomainReportError(VIR_ERR_CONFIG_UNSUPPORTED,
                                  _("unknown host device type '%s'"), type);
             goto error;
         }
@@ -4869,7 +4871,7 @@ virSecurityLabelDefParseXML(const virDomainDefPtr def,
     def->seclabel.type = virDomainSeclabelTypeFromString(p);
     VIR_FREE(p);
     if (def->seclabel.type < 0) {
-        virDomainReportError(VIR_ERR_XML_ERROR,
+        virDomainReportError(VIR_ERR_CONFIG_UNSUPPORTED,
                              "%s", _("invalid security type"));
         goto error;
     }
@@ -5290,7 +5292,7 @@ virDomainDefParseBootXML(xmlXPathContextPtr ctxt,
             goto cleanup;
         }
         if ((val = virDomainBootTypeFromString(dev)) < 0) {
-            virDomainReportError(VIR_ERR_INTERNAL_ERROR,
+            virDomainReportError(VIR_ERR_CONFIG_UNSUPPORTED,
                                  _("unknown boot device '%s'"),
                                  dev);
             VIR_FREE(dev);
@@ -5425,7 +5427,7 @@ static virDomainDefPtr virDomainDefParseXML(virCapsPtr caps,
     }
 
     if ((def->virtType = virDomainVirtTypeFromString(tmp)) < 0) {
-        virDomainReportError(VIR_ERR_INTERNAL_ERROR,
+        virDomainReportError(VIR_ERR_CONFIG_UNSUPPORTED,
                              _("invalid domain type %s"), tmp);
         goto error;
     }
@@ -5597,7 +5599,7 @@ static virDomainDefPtr virDomainDefParseXML(virCapsPtr caps,
         for (i = 0 ; i < n ; i++) {
             int val = virDomainFeatureTypeFromString((const char *)nodes[i]->name);
             if (val < 0) {
-                virDomainReportError(VIR_ERR_INTERNAL_ERROR,
+                virDomainReportError(VIR_ERR_CONFIG_UNSUPPORTED,
                                      _("unexpected feature %s"),
                                      nodes[i]->name);
                 goto error;
@@ -6239,7 +6241,7 @@ static virDomainDefPtr virDomainDefParseXML(virCapsPtr caps,
         int mode;
 
         if ((mode = virDomainSmbiosModeTypeFromString(tmp)) < 0) {
-            virDomainReportError(VIR_ERR_INTERNAL_ERROR,
+            virDomainReportError(VIR_ERR_CONFIG_UNSUPPORTED,
                                  _("unknown smbios mode '%s'"), tmp);
             goto error;
         }
@@ -6318,7 +6320,7 @@ static virDomainObjPtr virDomainObjParseXML(virCapsPtr caps,
         goto error;
     }
     if ((state = virDomainStateTypeFromString(tmp)) < 0) {
-        virDomainReportError(VIR_ERR_INTERNAL_ERROR,
+        virDomainReportError(VIR_ERR_CONFIG_UNSUPPORTED,
                              _("invalid domain state '%s'"), tmp);
         VIR_FREE(tmp);
         goto error;
@@ -9170,7 +9172,7 @@ virDomainSnapshotDefPtr virDomainSnapshotDefParseString(const char *xmlStr,
         }
         def->state = virDomainStateTypeFromString(state);
         if (def->state < 0) {
-            virDomainReportError(VIR_ERR_INTERNAL_ERROR,
+            virDomainReportError(VIR_ERR_CONFIG_UNSUPPORTED,
                                  _("Invalid state '%s' in domain snapshot XML"),
                                  state);
             goto cleanup;
@@ -9521,7 +9523,7 @@ int virDomainDiskDefForeachPath(virDomainDiskDefPtr disk,
             formatStr = "raw"; /* Xen compat */
 
         if ((format = virStorageFileFormatTypeFromString(formatStr)) < 0) {
-            virDomainReportError(VIR_ERR_INTERNAL_ERROR,
+            virDomainReportError(VIR_ERR_CONFIG_UNSUPPORTED,
                                  _("unknown disk format '%s' for %s"),
                                  disk->driverType, disk->src);
             return -1;
diff --git a/src/conf/interface_conf.c b/src/conf/interface_conf.c
index f3848bd..7e9c78f 100644
--- a/src/conf/interface_conf.c
+++ b/src/conf/interface_conf.c
@@ -689,7 +689,7 @@ virInterfaceDefParseXML(xmlXPathContextPtr ctxt, int parentIfType) {
     }
     type = virInterfaceTypeFromString(tmp);
     if (type == -1) {
-        virInterfaceReportError(VIR_ERR_XML_ERROR,
+        virInterfaceReportError(VIR_ERR_CONFIG_UNSUPPORTED,
                                 _("unknown interface type %s"), tmp);
         VIR_FREE(tmp);
         return(NULL);
diff --git a/src/conf/network_conf.c b/src/conf/network_conf.c
index e4765ea..598d01f 100644
--- a/src/conf/network_conf.c
+++ b/src/conf/network_conf.c
@@ -674,7 +674,7 @@ virNetworkDefParseXML(xmlXPathContextPtr ctxt)
         tmp = virXPathString("string(./forward[1]/@mode)", ctxt);
         if (tmp) {
             if ((def->forwardType = virNetworkForwardTypeFromString(tmp)) < 0) {
-                virNetworkReportError(VIR_ERR_INTERNAL_ERROR,
+                virNetworkReportError(VIR_ERR_CONFIG_UNSUPPORTED,
                                       _("unknown forwarding type '%s'"), tmp);
                 VIR_FREE(tmp);
                 goto error;
diff --git a/src/conf/node_device_conf.c b/src/conf/node_device_conf.c
index dde2921..1675631 100644
--- a/src/conf/node_device_conf.c
+++ b/src/conf/node_device_conf.c
@@ -826,7 +826,7 @@ virNodeDevCapNetParseXML(xmlXPathContextPtr ctxt,
         int val = virNodeDevNetCapTypeFromString(tmp);
         VIR_FREE(tmp);
         if (val < 0) {
-            virNodeDeviceReportError(VIR_ERR_INTERNAL_ERROR,
+            virNodeDeviceReportError(VIR_ERR_CONFIG_UNSUPPORTED,
                                      _("invalid network type supplied for '%s'"),
                                      def->name);
             goto out;
@@ -1076,7 +1076,7 @@ virNodeDevCapsDefParseXML(xmlXPathContextPtr ctxt,
     }
 
     if ((val = virNodeDevCapTypeFromString(tmp)) < 0) {
-        virNodeDeviceReportError(VIR_ERR_INTERNAL_ERROR,
+        virNodeDeviceReportError(VIR_ERR_CONFIG_UNSUPPORTED,
                                  _("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 a32bdb3..d493c77 100644
--- a/src/conf/nwfilter_conf.c
+++ b/src/conf/nwfilter_conf.c
@@ -1891,7 +1891,7 @@ virNWFilterRuleParse(xmlNodePtr node)
     }
 
     if ((ret->action = virNWFilterRuleActionTypeFromString(action)) < 0) {
-        virNWFilterReportError(VIR_ERR_INTERNAL_ERROR,
+        virNWFilterReportError(VIR_ERR_CONFIG_UNSUPPORTED,
                                "%s",
                                _("unknown rule action attribute value"));
         goto err_exit;
@@ -1905,7 +1905,7 @@ virNWFilterRuleParse(xmlNodePtr node)
     }
 
     if ((ret->tt = virNWFilterRuleDirectionTypeFromString(direction)) < 0) {
-        virNWFilterReportError(VIR_ERR_INTERNAL_ERROR,
+        virNWFilterReportError(VIR_ERR_CONFIG_UNSUPPORTED,
                                "%s",
                                _("unknown rule direction attribute value"));
         goto err_exit;
@@ -2004,7 +2004,7 @@ virNWFilterDefParseXML(xmlXPathContextPtr ctxt) {
     if (chain) {
         if ((ret->chainsuffix =
              virNWFilterChainSuffixTypeFromString(chain)) < 0) {
-            virNWFilterReportError(VIR_ERR_INTERNAL_ERROR,
+            virNWFilterReportError(VIR_ERR_CONFIG_UNSUPPORTED,
                                    _("unknown chain suffix '%s'"), chain);
             goto cleanup;
         }
diff --git a/src/conf/secret_conf.c b/src/conf/secret_conf.c
index 105afbe..c8a8b85 100644
--- a/src/conf/secret_conf.c
+++ b/src/conf/secret_conf.c
@@ -74,7 +74,7 @@ virSecretDefParseUsage(xmlXPathContextPtr ctxt,
     }
     type = virSecretUsageTypeTypeFromString(type_str);
     if (type < 0) {
-        virSecretReportError(VIR_ERR_XML_ERROR,
+        virSecretReportError(VIR_ERR_CONFIG_UNSUPPORTED,
                              _("unknown secret usage type %s"), type_str);
         VIR_FREE(type_str);
         return -1;
diff --git a/src/conf/storage_conf.c b/src/conf/storage_conf.c
index ca86f19..5f94c01 100644
--- a/src/conf/storage_conf.c
+++ b/src/conf/storage_conf.c
@@ -627,7 +627,7 @@ virStoragePoolDefParseXML(xmlXPathContextPtr ctxt) {
 
     type = virXPathString("string(./@type)", ctxt);
     if ((ret->type = virStoragePoolTypeFromString((const char *)type)) < 0) {
-        virStorageReportError(VIR_ERR_INTERNAL_ERROR,
+        virStorageReportError(VIR_ERR_CONFIG_UNSUPPORTED,
                               _("unknown storage pool type %s"), (const char*)type);
         goto cleanup;
     }
diff --git a/src/conf/storage_encryption_conf.c b/src/conf/storage_encryption_conf.c
index 545efad..0a4d8ba 100644
--- a/src/conf/storage_encryption_conf.c
+++ b/src/conf/storage_encryption_conf.c
@@ -94,7 +94,7 @@ virStorageEncryptionSecretParse(xmlXPathContextPtr ctxt,
     }
     type = virStorageEncryptionSecretTypeTypeFromString(type_str);
     if (type < 0) {
-        virStorageReportError(VIR_ERR_XML_ERROR,
+        virStorageReportError(VIR_ERR_CONFIG_UNSUPPORTED,
                               _("unknown volume encryption secret type %s"),
                               type_str);
         VIR_FREE(type_str);
@@ -148,7 +148,7 @@ virStorageEncryptionParseXML(xmlXPathContextPtr ctxt)
     }
     format = virStorageEncryptionFormatTypeFromString(format_str);
     if (format < 0) {
-        virStorageReportError(VIR_ERR_XML_ERROR,
+        virStorageReportError(VIR_ERR_CONFIG_UNSUPPORTED,
                               _("unknown volume encryption format type %s"),
                               format_str);
         VIR_FREE(format_str);
-- 
1.7.5.rc3


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