diff mbox

network: Don't use ERR_NO_SUPPORT for invalid net-update requests

Message ID a7e8d3f4bbffb859572b4eec6368c2eaf36e2a6a.1461101691.git.crobinso@redhat.com
State Accepted
Commit cdb4caac81606b8c1bb6ed6f3c0e5d06e4b8b3d6
Headers show

Commit Message

Cole Robinson April 19, 2016, 9:34 p.m. UTC
VIR_ERR_NO_SUPPORT maps to the error string

    this function is not supported by the connection driver

and is largely only used for when a driver doesn't have any
implementation for a public API. So its usage with invalid
net-update requests is a bit out of place. Instead use
VIR_ERR_OPERATION_UNSUPPORTED which maps to:

    Operation not supported

And is what qemu's hotplug routines use in similar scenarios
---
 src/conf/network_conf.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

-- 
2.7.3

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

Patch

diff --git a/src/conf/network_conf.c b/src/conf/network_conf.c
index 4fb2e2a..eabaccd 100644
--- a/src/conf/network_conf.c
+++ b/src/conf/network_conf.c
@@ -3376,14 +3376,14 @@  void virNetworkSetBridgeMacAddr(virNetworkDefPtr def)
 static void
 virNetworkDefUpdateNoSupport(virNetworkDefPtr def, const char *section)
 {
-    virReportError(VIR_ERR_NO_SUPPORT,
+    virReportError(VIR_ERR_OPERATION_UNSUPPORTED,
                    _("can't update '%s' section of network '%s'"),
                    section, def->name);
 }
 static void
 virNetworkDefUpdateUnknownCommand(unsigned int command)
 {
-    virReportError(VIR_ERR_NO_SUPPORT,
+    virReportError(VIR_ERR_OPERATION_UNSUPPORTED,
                    _("unrecognized network update command code %d"), command);
 }
 
@@ -3666,7 +3666,7 @@  virNetworkDefUpdateIPDHCPRange(virNetworkDefPtr def,
     /* parse the xml into a virSocketAddrRange */
     if (command == VIR_NETWORK_UPDATE_COMMAND_MODIFY) {
 
-        virReportError(VIR_ERR_NO_SUPPORT, "%s",
+        virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s",
                        _("dhcp ranges cannot be modified, "
                          "only added or deleted"));
         goto cleanup;
@@ -3772,7 +3772,7 @@  virNetworkDefUpdateForwardInterface(virNetworkDefPtr def,
         goto cleanup;
 
     if (command == VIR_NETWORK_UPDATE_COMMAND_MODIFY) {
-        virReportError(VIR_ERR_NO_SUPPORT, "%s",
+        virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s",
                        _("forward interface entries cannot be modified, "
                          "only added or deleted"));
         goto cleanup;
@@ -3973,7 +3973,7 @@  virNetworkDefUpdateDNSHost(virNetworkDefPtr def,
     memset(&host, 0, sizeof(host));
 
     if (command == VIR_NETWORK_UPDATE_COMMAND_MODIFY) {
-        virReportError(VIR_ERR_NO_SUPPORT, "%s",
+        virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s",
                        _("DNS HOST records cannot be modified, "
                          "only added or deleted"));
         goto cleanup;
@@ -4067,7 +4067,7 @@  virNetworkDefUpdateDNSSrv(virNetworkDefPtr def,
     memset(&srv, 0, sizeof(srv));
 
     if (command == VIR_NETWORK_UPDATE_COMMAND_MODIFY) {
-        virReportError(VIR_ERR_NO_SUPPORT, "%s",
+        virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s",
                        _("DNS SRV records cannot be modified, "
                          "only added or deleted"));
         goto cleanup;
@@ -4151,7 +4151,7 @@  virNetworkDefUpdateDNSTxt(virNetworkDefPtr def,
     memset(&txt, 0, sizeof(txt));
 
     if (command == VIR_NETWORK_UPDATE_COMMAND_MODIFY) {
-        virReportError(VIR_ERR_NO_SUPPORT, "%s",
+        virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s",
                        _("DNS TXT records cannot be modified, "
                          "only added or deleted"));
         goto cleanup;
@@ -4268,7 +4268,7 @@  virNetworkDefUpdateSection(virNetworkDefPtr def,
         ret = virNetworkDefUpdateDNSSrv(def, command, parentIndex, ctxt, flags);
         break;
     default:
-        virReportError(VIR_ERR_NO_SUPPORT, "%s",
+        virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s",
                        _("can't update unrecognized section of network"));
         break;
     }