[libvirt] [PATCH v3 0/3] network: make openvswitch call timeout configurable

Since a successful completion of openvswitch calls is expected a longer timeout should be able to be chosen in order to account for loaded systems. Therefore this patch series provides the ability to specify the timeout value for openvswitch calls in the libvirtd configuration file. Boris Fiuczynski (3): libvirtd: add openvitch timeout value network: allow to specify timeout for openvswitch calls libvirtd: set openvswitch timeout value based on config data daemon/libvirtd-config.c | 6 ++++ daemon/libvirtd-config.h | 2 ++ daemon/libvirtd.aug | 1 + daemon/libvirtd.c | 13 +++++++++ daemon/libvirtd.conf | 9 ++++++ daemon/test_libvirtd.aug.in | 1 + src/libvirt_private.syms | 1 + src/util/virnetdevopenvswitch.c | 64 +++++++++++++++++++++++++++++++++++------ src/util/virnetdevopenvswitch.h | 5 ++++ 9 files changed, 94 insertions(+), 8 deletions(-) -- 2.5.5

Provide the ability to specify a default timeout value for successful completion of openvswitch calls in the libvirtd configuration file. Signed-off-by: Boris Fiuczynski <fiuczy@linux.vnet.ibm.com> Reviewed-by: Bjoern Walk <bwalk@linux.vnet.ibm.com> --- daemon/libvirtd-config.c | 6 ++++++ daemon/libvirtd-config.h | 2 ++ daemon/libvirtd.aug | 1 + daemon/libvirtd.conf | 9 +++++++++ daemon/test_libvirtd.aug.in | 1 + src/util/virnetdevopenvswitch.h | 1 + 6 files changed, 20 insertions(+) diff --git a/daemon/libvirtd-config.c b/daemon/libvirtd-config.c index b469189..6c0f00e 100644 --- a/daemon/libvirtd-config.c +++ b/daemon/libvirtd-config.c @@ -32,6 +32,7 @@ #include "configmake.h" #include "remote/remote_protocol.h" #include "remote/remote_driver.h" +#include "util/virnetdevopenvswitch.h" #include "virstring.h" #include "virutil.h" @@ -170,6 +171,8 @@ daemonConfigNew(bool privileged ATTRIBUTE_UNUSED) data->admin_keepalive_interval = 5; data->admin_keepalive_count = 5; + data->ovs_timeout = VIR_NETDEV_OVS_DEFAULT_TIMEOUT; + localhost = virGetHostname(); if (localhost == NULL) { /* we couldn't resolve the hostname; assume that we are @@ -388,6 +391,9 @@ daemonConfigLoadOptions(struct daemonConfig *data, if (virConfGetValueUInt(conf, "admin_keepalive_count", &data->admin_keepalive_count) < 0) goto error; + if (virConfGetValueUInt(conf, "ovs_timeout", &data->ovs_timeout) < 0) + goto error; + return 0; error: diff --git a/daemon/libvirtd-config.h b/daemon/libvirtd-config.h index ad3e80a..1edf5fa 100644 --- a/daemon/libvirtd-config.h +++ b/daemon/libvirtd-config.h @@ -92,6 +92,8 @@ struct daemonConfig { int admin_keepalive_interval; unsigned int admin_keepalive_count; + + unsigned int ovs_timeout; }; diff --git a/daemon/libvirtd.aug b/daemon/libvirtd.aug index 2b8df66..24fdf44 100644 --- a/daemon/libvirtd.aug +++ b/daemon/libvirtd.aug @@ -88,6 +88,7 @@ module Libvirtd = let misc_entry = str_entry "host_uuid" | str_entry "host_uuid_source" + | int_entry "ovs_timeout" (* Each enty in the config is one of the following three ... *) let entry = network_entry diff --git a/daemon/libvirtd.conf b/daemon/libvirtd.conf index 8466616..ac77811 100644 --- a/daemon/libvirtd.conf +++ b/daemon/libvirtd.conf @@ -467,3 +467,12 @@ # Keepalive settings for the admin interface #admin_keepalive_interval = 5 #admin_keepalive_count = 5 + +################################################################### +# Open vSwitch: +# This allows to specify a timeout for openvswitch calls made by +# libvirt. The ovs-vsctl utility is used for the configuration and +# its timeout option is set by default to 5 seconds to avoid +# potential infinite waits blocking libvirts processing. +# +#ovs_timeout = 5 diff --git a/daemon/test_libvirtd.aug.in b/daemon/test_libvirtd.aug.in index 1fb182c..1200952 100644 --- a/daemon/test_libvirtd.aug.in +++ b/daemon/test_libvirtd.aug.in @@ -63,3 +63,4 @@ module Test_libvirtd = { "admin_keepalive_required" = "1" } { "admin_keepalive_interval" = "5" } { "admin_keepalive_count" = "5" } + { "ovs_timeout" = "5" } diff --git a/src/util/virnetdevopenvswitch.h b/src/util/virnetdevopenvswitch.h index 8f5faf1..01f6233 100644 --- a/src/util/virnetdevopenvswitch.h +++ b/src/util/virnetdevopenvswitch.h @@ -29,6 +29,7 @@ # include "virnetdevvportprofile.h" # include "virnetdevvlan.h" +# define VIR_NETDEV_OVS_DEFAULT_TIMEOUT 5 int virNetDevOpenvswitchAddPort(const char *brname, const char *ifname, -- 2.5.5

On 02/07/2017 04:16 PM, Boris Fiuczynski wrote:
Provide the ability to specify a default timeout value for successful completion of openvswitch calls in the libvirtd configuration file.
Signed-off-by: Boris Fiuczynski <fiuczy@linux.vnet.ibm.com> Reviewed-by: Bjoern Walk <bwalk@linux.vnet.ibm.com> --- daemon/libvirtd-config.c | 6 ++++++ daemon/libvirtd-config.h | 2 ++ daemon/libvirtd.aug | 1 + daemon/libvirtd.conf | 9 +++++++++ daemon/test_libvirtd.aug.in | 1 + src/util/virnetdevopenvswitch.h | 1 + 6 files changed, 20 insertions(+)
diff --git a/daemon/libvirtd-config.c b/daemon/libvirtd-config.c index b469189..6c0f00e 100644 --- a/daemon/libvirtd-config.c +++ b/daemon/libvirtd-config.c @@ -32,6 +32,7 @@ #include "configmake.h" #include "remote/remote_protocol.h" #include "remote/remote_driver.h" +#include "util/virnetdevopenvswitch.h" #include "virstring.h" #include "virutil.h"
@@ -170,6 +171,8 @@ daemonConfigNew(bool privileged ATTRIBUTE_UNUSED) data->admin_keepalive_interval = 5; data->admin_keepalive_count = 5;
+ data->ovs_timeout = VIR_NETDEV_OVS_DEFAULT_TIMEOUT; + localhost = virGetHostname(); if (localhost == NULL) { /* we couldn't resolve the hostname; assume that we are @@ -388,6 +391,9 @@ daemonConfigLoadOptions(struct daemonConfig *data, if (virConfGetValueUInt(conf, "admin_keepalive_count", &data->admin_keepalive_count) < 0) goto error;
+ if (virConfGetValueUInt(conf, "ovs_timeout", &data->ovs_timeout) < 0) + goto error; + return 0;
error: diff --git a/daemon/libvirtd-config.h b/daemon/libvirtd-config.h index ad3e80a..1edf5fa 100644 --- a/daemon/libvirtd-config.h +++ b/daemon/libvirtd-config.h @@ -92,6 +92,8 @@ struct daemonConfig {
int admin_keepalive_interval; unsigned int admin_keepalive_count; + + unsigned int ovs_timeout; };
diff --git a/daemon/libvirtd.aug b/daemon/libvirtd.aug index 2b8df66..24fdf44 100644 --- a/daemon/libvirtd.aug +++ b/daemon/libvirtd.aug @@ -88,6 +88,7 @@ module Libvirtd =
let misc_entry = str_entry "host_uuid" | str_entry "host_uuid_source" + | int_entry "ovs_timeout"
(* Each enty in the config is one of the following three ... *) let entry = network_entry diff --git a/daemon/libvirtd.conf b/daemon/libvirtd.conf index 8466616..ac77811 100644 --- a/daemon/libvirtd.conf +++ b/daemon/libvirtd.conf @@ -467,3 +467,12 @@ # Keepalive settings for the admin interface #admin_keepalive_interval = 5 #admin_keepalive_count = 5 + +################################################################### +# Open vSwitch: +# This allows to specify a timeout for openvswitch calls made by +# libvirt. The ovs-vsctl utility is used for the configuration and +# its timeout option is set by default to 5 seconds to avoid +# potential infinite waits blocking libvirts processing.
s/blocking .../blocking libvirt./ ACK Michal

On 02/09/2017 09:01 AM, Michal Privoznik wrote:
On 02/07/2017 04:16 PM, Boris Fiuczynski wrote:
Provide the ability to specify a default timeout value for successful completion of openvswitch calls in the libvirtd configuration file.
Signed-off-by: Boris Fiuczynski <fiuczy@linux.vnet.ibm.com> Reviewed-by: Bjoern Walk <bwalk@linux.vnet.ibm.com> --- daemon/libvirtd-config.c | 6 ++++++ daemon/libvirtd-config.h | 2 ++ daemon/libvirtd.aug | 1 + daemon/libvirtd.conf | 9 +++++++++ daemon/test_libvirtd.aug.in | 1 + src/util/virnetdevopenvswitch.h | 1 + 6 files changed, 20 insertions(+)
diff --git a/daemon/libvirtd-config.c b/daemon/libvirtd-config.c index b469189..6c0f00e 100644 --- a/daemon/libvirtd-config.c +++ b/daemon/libvirtd-config.c @@ -32,6 +32,7 @@ #include "configmake.h" #include "remote/remote_protocol.h" #include "remote/remote_driver.h" +#include "util/virnetdevopenvswitch.h" #include "virstring.h" #include "virutil.h"
@@ -170,6 +171,8 @@ daemonConfigNew(bool privileged ATTRIBUTE_UNUSED) data->admin_keepalive_interval = 5; data->admin_keepalive_count = 5;
+ data->ovs_timeout = VIR_NETDEV_OVS_DEFAULT_TIMEOUT; + localhost = virGetHostname(); if (localhost == NULL) { /* we couldn't resolve the hostname; assume that we are @@ -388,6 +391,9 @@ daemonConfigLoadOptions(struct daemonConfig *data, if (virConfGetValueUInt(conf, "admin_keepalive_count", &data->admin_keepalive_count) < 0) goto error;
+ if (virConfGetValueUInt(conf, "ovs_timeout", &data->ovs_timeout) < 0) + goto error; + return 0;
error: diff --git a/daemon/libvirtd-config.h b/daemon/libvirtd-config.h index ad3e80a..1edf5fa 100644 --- a/daemon/libvirtd-config.h +++ b/daemon/libvirtd-config.h @@ -92,6 +92,8 @@ struct daemonConfig {
int admin_keepalive_interval; unsigned int admin_keepalive_count; + + unsigned int ovs_timeout; };
diff --git a/daemon/libvirtd.aug b/daemon/libvirtd.aug index 2b8df66..24fdf44 100644 --- a/daemon/libvirtd.aug +++ b/daemon/libvirtd.aug @@ -88,6 +88,7 @@ module Libvirtd =
let misc_entry = str_entry "host_uuid" | str_entry "host_uuid_source" + | int_entry "ovs_timeout"
(* Each enty in the config is one of the following three ... *) let entry = network_entry diff --git a/daemon/libvirtd.conf b/daemon/libvirtd.conf index 8466616..ac77811 100644 --- a/daemon/libvirtd.conf +++ b/daemon/libvirtd.conf @@ -467,3 +467,12 @@ # Keepalive settings for the admin interface #admin_keepalive_interval = 5 #admin_keepalive_count = 5 + +################################################################### +# Open vSwitch: +# This allows to specify a timeout for openvswitch calls made by +# libvirt. The ovs-vsctl utility is used for the configuration and +# its timeout option is set by default to 5 seconds to avoid +# potential infinite waits blocking libvirts processing.
s/blocking .../blocking libvirt./
ACK
Michal
Thanks -- Mit freundlichen Grüßen/Kind regards Boris Fiuczynski IBM Deutschland Research & Development GmbH Vorsitzender des Aufsichtsrats: Martina Köderitz Geschäftsführung: Dirk Wittkopp Sitz der Gesellschaft: Böblingen Registergericht: Amtsgericht Stuttgart, HRB 243294

This patchs allows to set the timeout value used for all openvswitch calls. The default timeout value remains as before at 5 seconds. Signed-off-by: Boris Fiuczynski <fiuczy@linux.vnet.ibm.com> Reviewed-by: Bjoern Walk <bwalk@linux.vnet.ibm.com> --- src/libvirt_private.syms | 1 + src/util/virnetdevopenvswitch.c | 64 +++++++++++++++++++++++++++++++++++------ src/util/virnetdevopenvswitch.h | 4 +++ 3 files changed, 61 insertions(+), 8 deletions(-) diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms index d556c7d..0a7de9a 100644 --- a/src/libvirt_private.syms +++ b/src/libvirt_private.syms @@ -2078,6 +2078,7 @@ virNetDevOpenvswitchGetVhostuserIfname; virNetDevOpenvswitchInterfaceStats; virNetDevOpenvswitchRemovePort; virNetDevOpenvswitchSetMigrateData; +virNetDevOpenvswitchSetTimeout; # util/virnetdevtap.h diff --git a/src/util/virnetdevopenvswitch.c b/src/util/virnetdevopenvswitch.c index e6cb096..3a11fb4 100644 --- a/src/util/virnetdevopenvswitch.c +++ b/src/util/virnetdevopenvswitch.c @@ -1,6 +1,7 @@ /* * Copyright (C) 2013 Red Hat, Inc. * Copyright (C) 2012 Nicira, Inc. + * Copyright (C) 2017 IBM Corporation * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,6 +21,7 @@ * Dan Wendlandt <dan@nicira.com> * Kyle Mestery <kmestery@cisco.com> * Ansis Atteka <aatteka@nicira.com> + * Boris Fiuczynski <fiuczy@linux.vnet.ibm.com> */ #include <config.h> @@ -38,6 +40,23 @@ VIR_LOG_INIT("util.netdevopenvswitch"); +/* + * Set openvswitch default timout + */ +static unsigned int virNetDevOpenvswitchTimeout = VIR_NETDEV_OVS_DEFAULT_TIMEOUT; + +/** + * virNetDevOpenvswitchSetTimeout: + * @timeout: the timeout in seconds + * + * Set the openvswitch timeout + */ +void +virNetDevOpenvswitchSetTimeout(unsigned int timeout) +{ + virNetDevOpenvswitchTimeout = timeout; +} + /** * virNetDevOpenvswitchAddPort: * @brname: the bridge name @@ -66,6 +85,7 @@ int virNetDevOpenvswitchAddPort(const char *brname, const char *ifname, char *ifaceid_ex_id = NULL; char *profile_ex_id = NULL; char *vmid_ex_id = NULL; + char *ovs_timeout = NULL; virBuffer buf = VIR_BUFFER_INITIALIZER; virMacAddrFormat(macaddr, macaddrstr); @@ -86,10 +106,12 @@ int virNetDevOpenvswitchAddPort(const char *brname, const char *ifname, ovsport->profileID) < 0) goto cleanup; } + if (virAsprintf(&ovs_timeout, "--timeout=%d", virNetDevOpenvswitchTimeout) < 0) + goto cleanup; cmd = virCommandNew(OVSVSCTL); - virCommandAddArgList(cmd, "--timeout=5", "--", "--if-exists", "del-port", + virCommandAddArgList(cmd, ovs_timeout, "--", "--if-exists", "del-port", ifname, "--", "add-port", brname, ifname, NULL); if (virtVlan && virtVlan->nTags > 0) { @@ -165,6 +187,7 @@ int virNetDevOpenvswitchAddPort(const char *brname, const char *ifname, VIR_FREE(ifaceid_ex_id); VIR_FREE(vmid_ex_id); VIR_FREE(profile_ex_id); + VIR_FREE(ovs_timeout); virCommandFree(cmd); return ret; } @@ -181,9 +204,13 @@ int virNetDevOpenvswitchRemovePort(const char *brname ATTRIBUTE_UNUSED, const ch { int ret = -1; virCommandPtr cmd = NULL; + char *ovs_timeout = NULL; + + if (virAsprintf(&ovs_timeout, "--timeout=%d", virNetDevOpenvswitchTimeout) < 0) + goto cleanup; cmd = virCommandNew(OVSVSCTL); - virCommandAddArgList(cmd, "--timeout=5", "--", "--if-exists", "del-port", ifname, NULL); + virCommandAddArgList(cmd, ovs_timeout, "--", "--if-exists", "del-port", ifname, NULL); if (virCommandRun(cmd, NULL) < 0) { virReportError(VIR_ERR_INTERNAL_ERROR, @@ -194,6 +221,7 @@ int virNetDevOpenvswitchRemovePort(const char *brname ATTRIBUTE_UNUSED, const ch ret = 0; cleanup: virCommandFree(cmd); + VIR_FREE(ovs_timeout); return ret; } @@ -211,8 +239,12 @@ int virNetDevOpenvswitchGetMigrateData(char **migrate, const char *ifname) virCommandPtr cmd = NULL; size_t len; int ret = -1; + char *ovs_timeout = NULL; - cmd = virCommandNewArgList(OVSVSCTL, "--timeout=5", "--if-exists", "get", "Interface", + if (virAsprintf(&ovs_timeout, "--timeout=%d", virNetDevOpenvswitchTimeout) < 0) + goto cleanup; + + cmd = virCommandNewArgList(OVSVSCTL, ovs_timeout, "--if-exists", "get", "Interface", ifname, "external_ids:PortData", NULL); virCommandSetOutputBuffer(cmd, migrate); @@ -233,6 +265,7 @@ int virNetDevOpenvswitchGetMigrateData(char **migrate, const char *ifname) ret = 0; cleanup: virCommandFree(cmd); + VIR_FREE(ovs_timeout); return ret; } @@ -249,13 +282,17 @@ int virNetDevOpenvswitchSetMigrateData(char *migrate, const char *ifname) { virCommandPtr cmd = NULL; int ret = -1; + char *ovs_timeout = NULL; if (!migrate) { VIR_DEBUG("No OVS port data for interface %s", ifname); return 0; } - cmd = virCommandNewArgList(OVSVSCTL, "--timeout=5", "set", + if (virAsprintf(&ovs_timeout, "--timeout=%d", virNetDevOpenvswitchTimeout) < 0) + goto cleanup; + + cmd = virCommandNewArgList(OVSVSCTL, ovs_timeout, "set", "Interface", ifname, NULL); virCommandAddArgFormat(cmd, "external_ids:PortData=%s", migrate); @@ -270,6 +307,7 @@ int virNetDevOpenvswitchSetMigrateData(char *migrate, const char *ifname) ret = 0; cleanup: virCommandFree(cmd); + VIR_FREE(ovs_timeout); return ret; } @@ -297,9 +335,13 @@ virNetDevOpenvswitchInterfaceStats(const char *ifname, long long tx_errs; long long tx_drop; int ret = -1; + char *ovs_timeout = NULL; + + if (virAsprintf(&ovs_timeout, "--timeout=%d", virNetDevOpenvswitchTimeout) < 0) + goto cleanup; /* Just ensure the interface exists in ovs */ - cmd = virCommandNewArgList(OVSVSCTL, "--timeout=5", + cmd = virCommandNewArgList(OVSVSCTL, ovs_timeout, "get", "Interface", ifname, "name", NULL); virCommandSetOutputBuffer(cmd, &output); @@ -314,7 +356,7 @@ virNetDevOpenvswitchInterfaceStats(const char *ifname, VIR_FREE(output); virCommandFree(cmd); - cmd = virCommandNewArgList(OVSVSCTL, "--timeout=5", + cmd = virCommandNewArgList(OVSVSCTL, ovs_timeout, "get", "Interface", ifname, "statistics:rx_bytes", "statistics:rx_packets", @@ -345,7 +387,7 @@ virNetDevOpenvswitchInterfaceStats(const char *ifname, VIR_FREE(output); virCommandFree(cmd); - cmd = virCommandNewArgList(OVSVSCTL, "--timeout=5", + cmd = virCommandNewArgList(OVSVSCTL, ovs_timeout, "get", "Interface", ifname, "statistics:rx_errors", "statistics:rx_dropped", @@ -375,6 +417,7 @@ virNetDevOpenvswitchInterfaceStats(const char *ifname, cleanup: VIR_FREE(output); virCommandFree(cmd); + VIR_FREE(ovs_timeout); return ret; } @@ -399,6 +442,7 @@ virNetDevOpenvswitchGetVhostuserIfname(const char *path, size_t ntokens = 0; int status; int ret = -1; + char *ovs_timeout = NULL; /* Openvswitch vhostuser path are hardcoded to * /<runstatedir>/openvswitch/<ifname> @@ -412,7 +456,10 @@ virNetDevOpenvswitchGetVhostuserIfname(const char *path, goto cleanup; } - cmd = virCommandNewArgList(OVSVSCTL, "--timeout=5", "get", "Interface", + if (virAsprintf(&ovs_timeout, "--timeout=%d", virNetDevOpenvswitchTimeout) < 0) + goto cleanup; + + cmd = virCommandNewArgList(OVSVSCTL, ovs_timeout, "get", "Interface", tmpIfname, "name", NULL); if (virCommandRun(cmd, &status) < 0 || status) { @@ -428,5 +475,6 @@ virNetDevOpenvswitchGetVhostuserIfname(const char *path, cleanup: virStringListFreeCount(tokens, ntokens); virCommandFree(cmd); + VIR_FREE(ovs_timeout); return ret; } diff --git a/src/util/virnetdevopenvswitch.h b/src/util/virnetdevopenvswitch.h index 01f6233..4f62be1 100644 --- a/src/util/virnetdevopenvswitch.h +++ b/src/util/virnetdevopenvswitch.h @@ -1,6 +1,7 @@ /* * Copyright (C) 2013 Red Hat, Inc. * Copyright (C) 2012 Nicira, Inc. + * Copyright (C) 2017 IBM Corporation * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,6 +21,7 @@ * Dan Wendlandt <dan@nicira.com> * Kyle Mestery <kmestery@cisco.com> * Ansis Atteka <aatteka@nicira.com> + * Boris Fiuczynski <fiuczy@linux.vnet.ibm.com> */ #ifndef __VIR_NETDEV_OPENVSWITCH_H__ @@ -31,6 +33,8 @@ # define VIR_NETDEV_OVS_DEFAULT_TIMEOUT 5 +void virNetDevOpenvswitchSetTimeout(unsigned int timeout); + int virNetDevOpenvswitchAddPort(const char *brname, const char *ifname, const virMacAddr *macaddr, -- 2.5.5

On 02/07/2017 04:16 PM, Boris Fiuczynski wrote:
This patchs allows to set the timeout value used for all openvswitch calls. The default timeout value remains as before at 5 seconds.
Signed-off-by: Boris Fiuczynski <fiuczy@linux.vnet.ibm.com> Reviewed-by: Bjoern Walk <bwalk@linux.vnet.ibm.com> --- src/libvirt_private.syms | 1 + src/util/virnetdevopenvswitch.c | 64 +++++++++++++++++++++++++++++++++++------ src/util/virnetdevopenvswitch.h | 4 +++ 3 files changed, 61 insertions(+), 8 deletions(-)
diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms index d556c7d..0a7de9a 100644 --- a/src/libvirt_private.syms +++ b/src/libvirt_private.syms @@ -2078,6 +2078,7 @@ virNetDevOpenvswitchGetVhostuserIfname; virNetDevOpenvswitchInterfaceStats; virNetDevOpenvswitchRemovePort; virNetDevOpenvswitchSetMigrateData; +virNetDevOpenvswitchSetTimeout;
# util/virnetdevtap.h diff --git a/src/util/virnetdevopenvswitch.c b/src/util/virnetdevopenvswitch.c index e6cb096..3a11fb4 100644 --- a/src/util/virnetdevopenvswitch.c +++ b/src/util/virnetdevopenvswitch.c @@ -1,6 +1,7 @@ /* * Copyright (C) 2013 Red Hat, Inc. * Copyright (C) 2012 Nicira, Inc. + * Copyright (C) 2017 IBM Corporation * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,6 +21,7 @@ * Dan Wendlandt <dan@nicira.com> * Kyle Mestery <kmestery@cisco.com> * Ansis Atteka <aatteka@nicira.com> + * Boris Fiuczynski <fiuczy@linux.vnet.ibm.com> */
#include <config.h> @@ -38,6 +40,23 @@
VIR_LOG_INIT("util.netdevopenvswitch");
+/* + * Set openvswitch default timout + */ +static unsigned int virNetDevOpenvswitchTimeout = VIR_NETDEV_OVS_DEFAULT_TIMEOUT;
Ah, yet another global variable. But I guess there is no other way how to achieve this since we don't have a struct where we'd keep internal state.
+ +/** + * virNetDevOpenvswitchSetTimeout: + * @timeout: the timeout in seconds + * + * Set the openvswitch timeout + */ +void +virNetDevOpenvswitchSetTimeout(unsigned int timeout) +{ + virNetDevOpenvswitchTimeout = timeout; +} + /** * virNetDevOpenvswitchAddPort: * @brname: the bridge name @@ -66,6 +85,7 @@ int virNetDevOpenvswitchAddPort(const char *brname, const char *ifname, char *ifaceid_ex_id = NULL; char *profile_ex_id = NULL; char *vmid_ex_id = NULL; + char *ovs_timeout = NULL; virBuffer buf = VIR_BUFFER_INITIALIZER;
virMacAddrFormat(macaddr, macaddrstr); @@ -86,10 +106,12 @@ int virNetDevOpenvswitchAddPort(const char *brname, const char *ifname, ovsport->profileID) < 0) goto cleanup; } + if (virAsprintf(&ovs_timeout, "--timeout=%d", virNetDevOpenvswitchTimeout) < 0) + goto cleanup;
cmd = virCommandNew(OVSVSCTL);
- virCommandAddArgList(cmd, "--timeout=5", "--", "--if-exists", "del-port", + virCommandAddArgList(cmd, ovs_timeout, "--", "--if-exists", "del-port", ifname, "--", "add-port", brname, ifname, NULL);
While this would work we have virCommandAddArgFormat which wraps exactly this: virCommandNew(OVSVSCTL); virCommandAddArgFormat(cmd, "--timeout=%u", virNetDevOpenvswitchTimeout); virCommandAddArgList(cmd, "--", "--if-exists", ..., NULL); Then we can take the extra step and wrap it in a static function so that --timeout=%u doesn't have to be copied all over the place. I will fix this before pushing. ACK with the change I'm suggesting. Michal

On 02/09/2017 09:01 AM, Michal Privoznik wrote:
+ if (virAsprintf(&ovs_timeout, "--timeout=%d", virNetDevOpenvswitchTimeout) < 0) + goto cleanup;
cmd = virCommandNew(OVSVSCTL);
- virCommandAddArgList(cmd, "--timeout=5", "--", "--if-exists", "del-port", + virCommandAddArgList(cmd, ovs_timeout, "--", "--if-exists", "del-port", ifname, "--", "add-port", brname, ifname, NULL); While this would work we have virCommandAddArgFormat which wraps exactly this: virCommandNew(OVSVSCTL); virCommandAddArgFormat(cmd, "--timeout=%u", virNetDevOpenvswitchTimeout); virCommandAddArgList(cmd, "--", "--if-exists", ..., NULL);
Then we can take the extra step and wrap it in a static function so that --timeout=%u doesn't have to be copied all over the place.
I will fix this before pushing. Thanks and the wrapper is a good idea.
ACK with the change I'm suggesting.
Michal
-- Mit freundlichen Grüßen/Kind regards Boris Fiuczynski IBM Deutschland Research & Development GmbH Vorsitzender des Aufsichtsrats: Martina Köderitz Geschäftsführung: Dirk Wittkopp Sitz der Gesellschaft: Böblingen Registergericht: Amtsgericht Stuttgart, HRB 243294

Since a successful completion of the calls to openvswitch is expected a longer timeout should be able to be chosen to account for loaded systems. Therefore this patch provides the ability to specify the timeout value for openvswitch calls in the libvirtd configuration file. Signed-off-by: Boris Fiuczynski <fiuczy@linux.vnet.ibm.com> Reviewed-by: Bjoern Walk <bwalk@linux.vnet.ibm.com> --- daemon/libvirtd.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/daemon/libvirtd.c b/daemon/libvirtd.c index b6d76ed..5c30c9e 100644 --- a/daemon/libvirtd.c +++ b/daemon/libvirtd.c @@ -58,6 +58,7 @@ #include "viraccessmanager.h" #include "virutil.h" #include "virgettext.h" +#include "util/virnetdevopenvswitch.h" #ifdef WITH_DRIVER_MODULES # include "driver.h" @@ -658,6 +659,16 @@ daemonSetupNetworking(virNetServerPtr srv, /* + * Set up the openvswitch timeout + */ +static void +daemonSetupNetDevOpenvswitch(struct daemonConfig *config) +{ + virNetDevOpenvswitchSetTimeout(config->ovs_timeout); +} + + +/* * Set up the logging environment * By default if daemonized all errors go to the logfile libvirtd.log, * but if verbose or error debugging is asked for then also output @@ -1267,6 +1278,8 @@ int main(int argc, char **argv) { exit(EXIT_FAILURE); } + daemonSetupNetDevOpenvswitch(config); + if (daemonSetupAccessManager(config) < 0) { VIR_ERROR(_("Can't initialize access manager")); exit(EXIT_FAILURE); -- 2.5.5

On 02/07/2017 04:16 PM, Boris Fiuczynski wrote:
Since a successful completion of the calls to openvswitch is expected a longer timeout should be able to be chosen to account for loaded systems. Therefore this patch provides the ability to specify the timeout value for openvswitch calls in the libvirtd configuration file.
Signed-off-by: Boris Fiuczynski <fiuczy@linux.vnet.ibm.com> Reviewed-by: Bjoern Walk <bwalk@linux.vnet.ibm.com> --- daemon/libvirtd.c | 13 +++++++++++++ 1 file changed, 13 insertions(+)
ACK Michal

On 02/09/2017 09:01 AM, Michal Privoznik wrote:
On 02/07/2017 04:16 PM, Boris Fiuczynski wrote:
Since a successful completion of the calls to openvswitch is expected a longer timeout should be able to be chosen to account for loaded systems. Therefore this patch provides the ability to specify the timeout value for openvswitch calls in the libvirtd configuration file.
Signed-off-by: Boris Fiuczynski <fiuczy@linux.vnet.ibm.com> Reviewed-by: Bjoern Walk <bwalk@linux.vnet.ibm.com> --- daemon/libvirtd.c | 13 +++++++++++++ 1 file changed, 13 insertions(+)
ACK
Michal
Thanks -- Mit freundlichen Grüßen/Kind regards Boris Fiuczynski IBM Deutschland Research & Development GmbH Vorsitzender des Aufsichtsrats: Martina Köderitz Geschäftsführung: Dirk Wittkopp Sitz der Gesellschaft: Böblingen Registergericht: Amtsgericht Stuttgart, HRB 243294

On 02/07/2017 04:16 PM, Boris Fiuczynski wrote:
Since a successful completion of openvswitch calls is expected a longer timeout should be able to be chosen in order to account for loaded systems. Therefore this patch series provides the ability to specify the timeout value for openvswitch calls in the libvirtd configuration file.
Boris Fiuczynski (3): libvirtd: add openvitch timeout value network: allow to specify timeout for openvswitch calls libvirtd: set openvswitch timeout value based on config data
daemon/libvirtd-config.c | 6 ++++ daemon/libvirtd-config.h | 2 ++ daemon/libvirtd.aug | 1 + daemon/libvirtd.c | 13 +++++++++ daemon/libvirtd.conf | 9 ++++++ daemon/test_libvirtd.aug.in | 1 + src/libvirt_private.syms | 1 + src/util/virnetdevopenvswitch.c | 64 +++++++++++++++++++++++++++++++++++------ src/util/virnetdevopenvswitch.h | 5 ++++ 9 files changed, 94 insertions(+), 8 deletions(-)
I've fixed all the issues I've found and was about to push it. But then I realized: docs/news.xml entry is missing. I can't push it without it, sorry. I can't do it to our news police :-) Just reply with proposed news entry and I can fix that. Michal

On 02/09/2017 09:01 AM, Michal Privoznik wrote:
On 02/07/2017 04:16 PM, Boris Fiuczynski wrote:
Since a successful completion of openvswitch calls is expected a longer timeout should be able to be chosen in order to account for loaded systems. Therefore this patch series provides the ability to specify the timeout value for openvswitch calls in the libvirtd configuration file.
Boris Fiuczynski (3): libvirtd: add openvitch timeout value network: allow to specify timeout for openvswitch calls libvirtd: set openvswitch timeout value based on config data
daemon/libvirtd-config.c | 6 ++++ daemon/libvirtd-config.h | 2 ++ daemon/libvirtd.aug | 1 + daemon/libvirtd.c | 13 +++++++++ daemon/libvirtd.conf | 9 ++++++ daemon/test_libvirtd.aug.in | 1 + src/libvirt_private.syms | 1 + src/util/virnetdevopenvswitch.c | 64 +++++++++++++++++++++++++++++++++++------ src/util/virnetdevopenvswitch.h | 5 ++++ 9 files changed, 94 insertions(+), 8 deletions(-)
I've fixed all the issues I've found and was about to push it. But then I realized: docs/news.xml entry is missing. I can't push it without it, sorry. I can't do it to our news police :-) Just reply with proposed news entry and I can fix that.
Michal
Well, it was worth a try... Just kidding! :-) It's a miss on my side. Sorry about it. Here is my proposal: <change> <summary> network: make openvswitch call timeout configurable </summary> <description> Adding the ability to specify the timeout value in seconds for openvswitch calls in the libvirtd configuration file. </description> </change> or in patch-like format From b148e8f512aefbcbb68aaba6b6873feb2bccfede Mon Sep 17 00:00:00 2001 From: Boris Fiuczynski <fiuczy@linux.vnet.ibm.com> Date: Thu, 9 Feb 2017 14:08:53 +0100 Subject: [PATCH] news: that I forgot to add Signed-off-by: Boris Fiuczynski <fiuczy@linux.vnet.ibm.com> --- docs/news.xml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/docs/news.xml b/docs/news.xml index 69ed6a7..d1ca497 100644 --- a/docs/news.xml +++ b/docs/news.xml @@ -43,6 +43,15 @@ and network. </description> </change> + <change> + <summary> + network: make openvswitch call timeout configurable + </summary> + <description> + Adding the ability to specify the timeout value in seconds for + openvswitch calls in the libvirtd configuration file. + </description> + </change> </section> <section title="Bug fixes"> <change> -- 2.5.5 -- Mit freundlichen Grüßen/Kind regards Boris Fiuczynski IBM Deutschland Research & Development GmbH Vorsitzender des Aufsichtsrats: Martina Köderitz Geschäftsführung: Dirk Wittkopp Sitz der Gesellschaft: Böblingen Registergericht: Amtsgericht Stuttgart, HRB 243294

On 02/09/2017 04:21 PM, Boris Fiuczynski wrote:
On 02/09/2017 09:01 AM, Michal Privoznik wrote:
On 02/07/2017 04:16 PM, Boris Fiuczynski wrote:
Since a successful completion of openvswitch calls is expected a longer timeout should be able to be chosen in order to account for loaded systems. Therefore this patch series provides the ability to specify the timeout value for openvswitch calls in the libvirtd configuration file.
Boris Fiuczynski (3): libvirtd: add openvitch timeout value network: allow to specify timeout for openvswitch calls libvirtd: set openvswitch timeout value based on config data
daemon/libvirtd-config.c | 6 ++++ daemon/libvirtd-config.h | 2 ++ daemon/libvirtd.aug | 1 + daemon/libvirtd.c | 13 +++++++++ daemon/libvirtd.conf | 9 ++++++ daemon/test_libvirtd.aug.in | 1 + src/libvirt_private.syms | 1 + src/util/virnetdevopenvswitch.c | 64 +++++++++++++++++++++++++++++++++++------ src/util/virnetdevopenvswitch.h | 5 ++++ 9 files changed, 94 insertions(+), 8 deletions(-)
I've fixed all the issues I've found and was about to push it. But then I realized: docs/news.xml entry is missing. I can't push it without it, sorry. I can't do it to our news police :-) Just reply with proposed news entry and I can fix that.
Michal
Well, it was worth a try... Just kidding! :-)
Ha ha.
It's a miss on my side. Sorry about it.
No problem. It's a new concept. Even us, full time contributors often forget about that.
Here is my proposal:
<change> <summary> network: make openvswitch call timeout configurable </summary> <description> Adding the ability to specify the timeout value in seconds for openvswitch calls in the libvirtd configuration file. </description> </change>
Yeah, this will do. Pushed. Thanks. Michal
participants (2)
-
Boris Fiuczynski
-
Michal Privoznik