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@xxxxxxxxxxxxxxxxxx> Reviewed-by: Bjoern Walk <bwalk@xxxxxxxxxxxxxxxxxx> --- 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 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list