From patchwork Tue Apr 19 21:34:51 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cole Robinson X-Patchwork-Id: 66140 Delivered-To: patch@linaro.org Received: by 10.140.93.198 with SMTP id d64csp2100656qge; Tue, 19 Apr 2016 14:37:45 -0700 (PDT) X-Received: by 10.194.77.42 with SMTP id p10mr5027374wjw.111.1461101865907; Tue, 19 Apr 2016 14:37:45 -0700 (PDT) Return-Path: Received: from mx6-phx2.redhat.com (mx6-phx2.redhat.com. [209.132.183.39]) by mx.google.com with ESMTPS id cd8si2345815wjc.60.2016.04.19.14.37.45 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 19 Apr 2016 14:37:45 -0700 (PDT) Received-SPF: pass (google.com: domain of libvir-list-bounces@redhat.com designates 209.132.183.39 as permitted sender) client-ip=209.132.183.39; Authentication-Results: mx.google.com; spf=pass (google.com: domain of libvir-list-bounces@redhat.com designates 209.132.183.39 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by mx6-phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u3JLYsuu009430; Tue, 19 Apr 2016 17:34:56 -0400 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id u3JLYscU005329 for ; Tue, 19 Apr 2016 17:34:54 -0400 Received: from colepc.redhat.com (ovpn-113-99.phx2.redhat.com [10.3.113.99]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u3JLYr1L029476; Tue, 19 Apr 2016 17:34:53 -0400 From: Cole Robinson To: libvirt-list@redhat.com Date: Tue, 19 Apr 2016 17:34:51 -0400 Message-Id: X-Scanned-By: MIMEDefang 2.68 on 10.5.11.23 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH] network: Don't use ERR_NO_SUPPORT for invalid net-update requests X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com 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 --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; }