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

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
This commit is contained in:
Cole Robinson 2016-04-19 14:48:30 -04:00
parent 0496063f14
commit cdb4caac81

View File

@ -3399,14 +3399,14 @@ void virNetworkSetBridgeMacAddr(virNetworkDefPtr def)
static void static void
virNetworkDefUpdateNoSupport(virNetworkDefPtr def, const char *section) virNetworkDefUpdateNoSupport(virNetworkDefPtr def, const char *section)
{ {
virReportError(VIR_ERR_NO_SUPPORT, virReportError(VIR_ERR_OPERATION_UNSUPPORTED,
_("can't update '%s' section of network '%s'"), _("can't update '%s' section of network '%s'"),
section, def->name); section, def->name);
} }
static void static void
virNetworkDefUpdateUnknownCommand(unsigned int command) virNetworkDefUpdateUnknownCommand(unsigned int command)
{ {
virReportError(VIR_ERR_NO_SUPPORT, virReportError(VIR_ERR_OPERATION_UNSUPPORTED,
_("unrecognized network update command code %d"), command); _("unrecognized network update command code %d"), command);
} }
@ -3689,7 +3689,7 @@ virNetworkDefUpdateIPDHCPRange(virNetworkDefPtr def,
/* parse the xml into a virSocketAddrRange */ /* parse the xml into a virSocketAddrRange */
if (command == VIR_NETWORK_UPDATE_COMMAND_MODIFY) { if (command == VIR_NETWORK_UPDATE_COMMAND_MODIFY) {
virReportError(VIR_ERR_NO_SUPPORT, "%s", virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s",
_("dhcp ranges cannot be modified, " _("dhcp ranges cannot be modified, "
"only added or deleted")); "only added or deleted"));
goto cleanup; goto cleanup;
@ -3795,7 +3795,7 @@ virNetworkDefUpdateForwardInterface(virNetworkDefPtr def,
goto cleanup; goto cleanup;
if (command == VIR_NETWORK_UPDATE_COMMAND_MODIFY) { 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, " _("forward interface entries cannot be modified, "
"only added or deleted")); "only added or deleted"));
goto cleanup; goto cleanup;
@ -3996,7 +3996,7 @@ virNetworkDefUpdateDNSHost(virNetworkDefPtr def,
memset(&host, 0, sizeof(host)); memset(&host, 0, sizeof(host));
if (command == VIR_NETWORK_UPDATE_COMMAND_MODIFY) { 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, " _("DNS HOST records cannot be modified, "
"only added or deleted")); "only added or deleted"));
goto cleanup; goto cleanup;
@ -4090,7 +4090,7 @@ virNetworkDefUpdateDNSSrv(virNetworkDefPtr def,
memset(&srv, 0, sizeof(srv)); memset(&srv, 0, sizeof(srv));
if (command == VIR_NETWORK_UPDATE_COMMAND_MODIFY) { 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, " _("DNS SRV records cannot be modified, "
"only added or deleted")); "only added or deleted"));
goto cleanup; goto cleanup;
@ -4174,7 +4174,7 @@ virNetworkDefUpdateDNSTxt(virNetworkDefPtr def,
memset(&txt, 0, sizeof(txt)); memset(&txt, 0, sizeof(txt));
if (command == VIR_NETWORK_UPDATE_COMMAND_MODIFY) { 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, " _("DNS TXT records cannot be modified, "
"only added or deleted")); "only added or deleted"));
goto cleanup; goto cleanup;
@ -4291,7 +4291,7 @@ virNetworkDefUpdateSection(virNetworkDefPtr def,
ret = virNetworkDefUpdateDNSSrv(def, command, parentIndex, ctxt, flags); ret = virNetworkDefUpdateDNSSrv(def, command, parentIndex, ctxt, flags);
break; break;
default: default:
virReportError(VIR_ERR_NO_SUPPORT, "%s", virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s",
_("can't update unrecognized section of network")); _("can't update unrecognized section of network"));
break; break;
} }