From nobody Sun May 5 16:09:35 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.37 as permitted sender) client-ip=209.132.183.37; envelope-from=libvir-list-bounces@redhat.com; helo=mx5-phx2.redhat.com; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.37 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; Return-Path: Received: from mx5-phx2.redhat.com (mx5-phx2.redhat.com [209.132.183.37]) by mx.zohomail.com with SMTPS id 1486480879837935.2504126363373; Tue, 7 Feb 2017 07:21:19 -0800 (PST) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by mx5-phx2.redhat.com (8.14.4/8.14.4) with ESMTP id v17FHRFM052563; Tue, 7 Feb 2017 10:17:27 -0500 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v17FH42F023402 for ; Tue, 7 Feb 2017 10:17:04 -0500 Received: from mx1.redhat.com (ext-mx01.extmail.prod.ext.phx2.redhat.com [10.5.110.25]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id v17FH42s019336 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO) for ; Tue, 7 Feb 2017 10:17:04 -0500 Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 297437FB65 for ; Tue, 7 Feb 2017 15:16:55 +0000 (UTC) Received: from pps.filterd (m0098409.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.20/8.16.0.20) with SMTP id v17F9Zbo008283 for ; Tue, 7 Feb 2017 10:16:53 -0500 Received: from e06smtp13.uk.ibm.com (e06smtp13.uk.ibm.com [195.75.94.109]) by mx0a-001b2d01.pphosted.com with ESMTP id 28eupjbvdc-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Tue, 07 Feb 2017 10:16:53 -0500 Received: from localhost by e06smtp13.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 7 Feb 2017 15:16:51 -0000 Received: from d06dlp02.portsmouth.uk.ibm.com (9.149.20.14) by e06smtp13.uk.ibm.com (192.168.101.143) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Tue, 7 Feb 2017 15:16:46 -0000 Received: from b06cxnps4074.portsmouth.uk.ibm.com (d06relay11.portsmouth.uk.ibm.com [9.149.109.196]) by d06dlp02.portsmouth.uk.ibm.com (Postfix) with ESMTP id 34ECA2190023; Tue, 7 Feb 2017 15:15:50 +0000 (GMT) Received: from d06av26.portsmouth.uk.ibm.com (d06av26.portsmouth.uk.ibm.com [9.149.105.62]) by b06cxnps4074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id v17FGkHi64618586; Tue, 7 Feb 2017 15:16:46 GMT Received: from d06av26.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 91018AE051; Tue, 7 Feb 2017 14:14:40 +0000 (GMT) Received: from d06av26.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 5E923AE057; Tue, 7 Feb 2017 14:14:40 +0000 (GMT) Received: from fiuczyvm.boeblingen.de.ibm.com (unknown [9.152.222.92]) by d06av26.portsmouth.uk.ibm.com (Postfix) with ESMTP; Tue, 7 Feb 2017 14:14:40 +0000 (GMT) From: Boris Fiuczynski To: libvir-list@redhat.com, mprivozn@redhat.com, laine@laine.org Date: Tue, 7 Feb 2017 16:16:42 +0100 In-Reply-To: <1486480604-29957-1-git-send-email-fiuczy@linux.vnet.ibm.com> References: <1486480604-29957-1-git-send-email-fiuczy@linux.vnet.ibm.com> X-TM-AS-GCONF: 00 X-Content-Scanned: Fidelis XPS MAILER x-cbid: 17020715-0012-0000-0000-000004C8E9C0 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17020715-0013-0000-0000-0000172AEBB7 Message-Id: <1486480604-29957-2-git-send-email-fiuczy@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2017-02-07_08:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=9 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1612050000 definitions=main-1702070145 X-Greylist: Sender passed SPF test, Sender IP whitelisted by DNSRBL, ACL 200 matched, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Tue, 07 Feb 2017 15:16:55 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Tue, 07 Feb 2017 15:16:55 +0000 (UTC) for IP:'148.163.156.1' DOMAIN:'mx0a-001b2d01.pphosted.com' HELO:'mx0a-001b2d01.pphosted.com' FROM:'fiuczy@linux.vnet.ibm.com' RCPT:'' X-RedHat-Spam-Score: -1.787 (BAYES_50, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2) 148.163.156.1 mx0a-001b2d01.pphosted.com 148.163.156.1 mx0a-001b2d01.pphosted.com X-Scanned-By: MIMEDefang 2.68 on 10.5.11.24 X-Scanned-By: MIMEDefang 2.78 on 10.5.110.25 X-loop: libvir-list@redhat.com Cc: stzi@linux.vnet.ibm.com Subject: [libvirt] [PATCH v3 1/3] libvirtd: add openvitch timeout value 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 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" 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 Reviewed-by: Bjoern Walk --- 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" =20 @@ -170,6 +171,8 @@ daemonConfigNew(bool privileged ATTRIBUTE_UNUSED) data->admin_keepalive_interval =3D 5; data->admin_keepalive_count =3D 5; =20 + data->ovs_timeout =3D VIR_NETDEV_OVS_DEFAULT_TIMEOUT; + localhost =3D virGetHostname(); if (localhost =3D=3D 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_ke= epalive_count) < 0) goto error; =20 + if (virConfGetValueUInt(conf, "ovs_timeout", &data->ovs_timeout) < 0) + goto error; + return 0; =20 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 { =20 int admin_keepalive_interval; unsigned int admin_keepalive_count; + + unsigned int ovs_timeout; }; =20 =20 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 =3D =20 let misc_entry =3D str_entry "host_uuid" | str_entry "host_uuid_source" + | int_entry "ovs_timeout" =20 (* Each enty in the config is one of the following three ... *) let entry =3D 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 =3D 5 #admin_keepalive_count =3D 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 =3D 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 =3D { "admin_keepalive_required" =3D "1" } { "admin_keepalive_interval" =3D "5" } { "admin_keepalive_count" =3D "5" } + { "ovs_timeout" =3D "5" } diff --git a/src/util/virnetdevopenvswitch.h b/src/util/virnetdevopenvswitc= h.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" =20 +# define VIR_NETDEV_OVS_DEFAULT_TIMEOUT 5 =20 int virNetDevOpenvswitchAddPort(const char *brname, const char *ifname, --=20 2.5.5 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sun May 5 16:09:35 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.24 as permitted sender) client-ip=209.132.183.24; envelope-from=libvir-list-bounces@redhat.com; helo=mx3-phx2.redhat.com; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.24 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; Return-Path: Received: from mx3-phx2.redhat.com (mx3-phx2.redhat.com [209.132.183.24]) by mx.zohomail.com with SMTPS id 1486480876567542.1682702911473; Tue, 7 Feb 2017 07:21:16 -0800 (PST) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by mx3-phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v17FH1bc027205; Tue, 7 Feb 2017 10:17:01 -0500 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v17FH0gS023382 for ; Tue, 7 Feb 2017 10:17:00 -0500 Received: from mx1.redhat.com (ext-mx08.extmail.prod.ext.phx2.redhat.com [10.5.110.32]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id v17FH0P7019248 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO) for ; Tue, 7 Feb 2017 10:17:00 -0500 Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 23670C05AA42 for ; Tue, 7 Feb 2017 15:16:59 +0000 (UTC) Received: from pps.filterd (m0098404.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.20/8.16.0.20) with SMTP id v17FCMnb048415 for ; Tue, 7 Feb 2017 10:16:57 -0500 Received: from e06smtp12.uk.ibm.com (e06smtp12.uk.ibm.com [195.75.94.108]) by mx0a-001b2d01.pphosted.com with ESMTP id 28feqjf1x3-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Tue, 07 Feb 2017 10:16:57 -0500 Received: from localhost by e06smtp12.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 7 Feb 2017 15:16:54 -0000 Received: from d06dlp01.portsmouth.uk.ibm.com (9.149.20.13) by e06smtp12.uk.ibm.com (192.168.101.142) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Tue, 7 Feb 2017 15:16:48 -0000 Received: from b06cxnps4075.portsmouth.uk.ibm.com (d06relay12.portsmouth.uk.ibm.com [9.149.109.197]) by d06dlp01.portsmouth.uk.ibm.com (Postfix) with ESMTP id 2E6DC17D805A; Tue, 7 Feb 2017 15:19:51 +0000 (GMT) Received: from d06av26.portsmouth.uk.ibm.com (d06av26.portsmouth.uk.ibm.com [9.149.105.62]) by b06cxnps4075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id v17FGlg34718880; Tue, 7 Feb 2017 15:16:47 GMT Received: from d06av26.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id CB2E6AE04D; Tue, 7 Feb 2017 14:14:41 +0000 (GMT) Received: from d06av26.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 9E68BAE045; Tue, 7 Feb 2017 14:14:41 +0000 (GMT) Received: from fiuczyvm.boeblingen.de.ibm.com (unknown [9.152.222.92]) by d06av26.portsmouth.uk.ibm.com (Postfix) with ESMTP; Tue, 7 Feb 2017 14:14:41 +0000 (GMT) From: Boris Fiuczynski To: libvir-list@redhat.com, mprivozn@redhat.com, laine@laine.org Date: Tue, 7 Feb 2017 16:16:43 +0100 In-Reply-To: <1486480604-29957-1-git-send-email-fiuczy@linux.vnet.ibm.com> References: <1486480604-29957-1-git-send-email-fiuczy@linux.vnet.ibm.com> X-TM-AS-GCONF: 00 X-Content-Scanned: Fidelis XPS MAILER x-cbid: 17020715-0008-0000-0000-000003E3EEFA X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17020715-0009-0000-0000-00001C60E30F Message-Id: <1486480604-29957-3-git-send-email-fiuczy@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2017-02-07_08:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=2 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1612050000 definitions=main-1702070145 X-Greylist: Sender passed SPF test, Sender IP whitelisted by DNSRBL, ACL 200 matched, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Tue, 07 Feb 2017 15:16:59 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Tue, 07 Feb 2017 15:16:59 +0000 (UTC) for IP:'148.163.156.1' DOMAIN:'mx0a-001b2d01.pphosted.com' HELO:'mx0a-001b2d01.pphosted.com' FROM:'fiuczy@linux.vnet.ibm.com' RCPT:'' X-RedHat-Spam-Score: -1.787 (BAYES_50, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2) 148.163.156.1 mx0a-001b2d01.pphosted.com 148.163.156.1 mx0a-001b2d01.pphosted.com X-Scanned-By: MIMEDefang 2.68 on 10.5.11.24 X-Scanned-By: MIMEDefang 2.78 on 10.5.110.32 X-loop: libvir-list@redhat.com Cc: stzi@linux.vnet.ibm.com Subject: [libvirt] [PATCH v3 2/3] network: allow to specify timeout for openvswitch calls 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 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" 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 Reviewed-by: Bjoern Walk --- 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; =20 =20 # util/virnetdevtap.h diff --git a/src/util/virnetdevopenvswitch.c b/src/util/virnetdevopenvswitc= h.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 * Kyle Mestery * Ansis Atteka + * Boris Fiuczynski */ =20 #include @@ -38,6 +40,23 @@ =20 VIR_LOG_INIT("util.netdevopenvswitch"); =20 +/* + * Set openvswitch default timout + */ +static unsigned int virNetDevOpenvswitchTimeout =3D VIR_NETDEV_OVS_DEFAULT= _TIMEOUT; + +/** + * virNetDevOpenvswitchSetTimeout: + * @timeout: the timeout in seconds + * + * Set the openvswitch timeout + */ +void +virNetDevOpenvswitchSetTimeout(unsigned int timeout) +{ + virNetDevOpenvswitchTimeout =3D timeout; +} + /** * virNetDevOpenvswitchAddPort: * @brname: the bridge name @@ -66,6 +85,7 @@ int virNetDevOpenvswitchAddPort(const char *brname, const= char *ifname, char *ifaceid_ex_id =3D NULL; char *profile_ex_id =3D NULL; char *vmid_ex_id =3D NULL; + char *ovs_timeout =3D NULL; virBuffer buf =3D VIR_BUFFER_INITIALIZER; =20 virMacAddrFormat(macaddr, macaddrstr); @@ -86,10 +106,12 @@ int virNetDevOpenvswitchAddPort(const char *brname, co= nst char *ifname, ovsport->profileID) < 0) goto cleanup; } + if (virAsprintf(&ovs_timeout, "--timeout=3D%d", virNetDevOpenvswitchTi= meout) < 0) + goto cleanup; =20 cmd =3D virCommandNew(OVSVSCTL); =20 - virCommandAddArgList(cmd, "--timeout=3D5", "--", "--if-exists", "del-p= ort", + virCommandAddArgList(cmd, ovs_timeout, "--", "--if-exists", "del-port", ifname, "--", "add-port", brname, ifname, NULL); =20 if (virtVlan && virtVlan->nTags > 0) { @@ -165,6 +187,7 @@ int virNetDevOpenvswitchAddPort(const char *brname, con= st 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 =3D -1; virCommandPtr cmd =3D NULL; + char *ovs_timeout =3D NULL; + + if (virAsprintf(&ovs_timeout, "--timeout=3D%d", virNetDevOpenvswitchTi= meout) < 0) + goto cleanup; =20 cmd =3D virCommandNew(OVSVSCTL); - virCommandAddArgList(cmd, "--timeout=3D5", "--", "--if-exists", "del-p= ort", ifname, NULL); + virCommandAddArgList(cmd, ovs_timeout, "--", "--if-exists", "del-port"= , ifname, NULL); =20 if (virCommandRun(cmd, NULL) < 0) { virReportError(VIR_ERR_INTERNAL_ERROR, @@ -194,6 +221,7 @@ int virNetDevOpenvswitchRemovePort(const char *brname A= TTRIBUTE_UNUSED, const ch ret =3D 0; cleanup: virCommandFree(cmd); + VIR_FREE(ovs_timeout); return ret; } =20 @@ -211,8 +239,12 @@ int virNetDevOpenvswitchGetMigrateData(char **migrate,= const char *ifname) virCommandPtr cmd =3D NULL; size_t len; int ret =3D -1; + char *ovs_timeout =3D NULL; =20 - cmd =3D virCommandNewArgList(OVSVSCTL, "--timeout=3D5", "--if-exists",= "get", "Interface", + if (virAsprintf(&ovs_timeout, "--timeout=3D%d", virNetDevOpenvswitchTi= meout) < 0) + goto cleanup; + + cmd =3D virCommandNewArgList(OVSVSCTL, ovs_timeout, "--if-exists", "ge= t", "Interface", ifname, "external_ids:PortData", NULL); =20 virCommandSetOutputBuffer(cmd, migrate); @@ -233,6 +265,7 @@ int virNetDevOpenvswitchGetMigrateData(char **migrate, = const char *ifname) ret =3D 0; cleanup: virCommandFree(cmd); + VIR_FREE(ovs_timeout); return ret; } =20 @@ -249,13 +282,17 @@ int virNetDevOpenvswitchSetMigrateData(char *migrate,= const char *ifname) { virCommandPtr cmd =3D NULL; int ret =3D -1; + char *ovs_timeout =3D NULL; =20 if (!migrate) { VIR_DEBUG("No OVS port data for interface %s", ifname); return 0; } =20 - cmd =3D virCommandNewArgList(OVSVSCTL, "--timeout=3D5", "set", + if (virAsprintf(&ovs_timeout, "--timeout=3D%d", virNetDevOpenvswitchTi= meout) < 0) + goto cleanup; + + cmd =3D virCommandNewArgList(OVSVSCTL, ovs_timeout, "set", "Interface", ifname, NULL); virCommandAddArgFormat(cmd, "external_ids:PortData=3D%s", migrate); =20 @@ -270,6 +307,7 @@ int virNetDevOpenvswitchSetMigrateData(char *migrate, c= onst char *ifname) ret =3D 0; cleanup: virCommandFree(cmd); + VIR_FREE(ovs_timeout); return ret; } =20 @@ -297,9 +335,13 @@ virNetDevOpenvswitchInterfaceStats(const char *ifname, long long tx_errs; long long tx_drop; int ret =3D -1; + char *ovs_timeout =3D NULL; + + if (virAsprintf(&ovs_timeout, "--timeout=3D%d", virNetDevOpenvswitchTi= meout) < 0) + goto cleanup; =20 /* Just ensure the interface exists in ovs */ - cmd =3D virCommandNewArgList(OVSVSCTL, "--timeout=3D5", + cmd =3D 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); =20 - cmd =3D virCommandNewArgList(OVSVSCTL, "--timeout=3D5", + cmd =3D 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); =20 - cmd =3D virCommandNewArgList(OVSVSCTL, "--timeout=3D5", + cmd =3D 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; } =20 @@ -399,6 +442,7 @@ virNetDevOpenvswitchGetVhostuserIfname(const char *path, size_t ntokens =3D 0; int status; int ret =3D -1; + char *ovs_timeout =3D NULL; =20 /* Openvswitch vhostuser path are hardcoded to * //openvswitch/ @@ -412,7 +456,10 @@ virNetDevOpenvswitchGetVhostuserIfname(const char *pat= h, goto cleanup; } =20 - cmd =3D virCommandNewArgList(OVSVSCTL, "--timeout=3D5", "get", "Interf= ace", + if (virAsprintf(&ovs_timeout, "--timeout=3D%d", virNetDevOpenvswitchTi= meout) < 0) + goto cleanup; + + cmd =3D 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/virnetdevopenvswitc= h.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 * Kyle Mestery * Ansis Atteka + * Boris Fiuczynski */ =20 #ifndef __VIR_NETDEV_OPENVSWITCH_H__ @@ -31,6 +33,8 @@ =20 # define VIR_NETDEV_OVS_DEFAULT_TIMEOUT 5 =20 +void virNetDevOpenvswitchSetTimeout(unsigned int timeout); + int virNetDevOpenvswitchAddPort(const char *brname, const char *ifname, const virMacAddr *macaddr, --=20 2.5.5 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sun May 5 16:09:35 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.39 as permitted sender) client-ip=209.132.183.39; envelope-from=libvir-list-bounces@redhat.com; helo=mx6-phx2.redhat.com; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.39 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; Return-Path: Received: from mx6-phx2.redhat.com (mx6-phx2.redhat.com [209.132.183.39]) by mx.zohomail.com with SMTPS id 14864808493481003.4230806596823; Tue, 7 Feb 2017 07:20:49 -0800 (PST) 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 v17FH16f002485; Tue, 7 Feb 2017 10:17:01 -0500 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 v17FH0lM023377 for ; Tue, 7 Feb 2017 10:17:00 -0500 Received: from mx1.redhat.com (ext-mx07.extmail.prod.ext.phx2.redhat.com [10.5.110.31]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id v17FH0RZ013121 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO) for ; Tue, 7 Feb 2017 10:17:00 -0500 Received: from mx0a-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 89D09C03BD7A for ; Tue, 7 Feb 2017 15:16:54 +0000 (UTC) Received: from pps.filterd (m0098413.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.20/8.16.0.20) with SMTP id v17FFmvS005009 for ; Tue, 7 Feb 2017 10:16:53 -0500 Received: from e06smtp08.uk.ibm.com (e06smtp08.uk.ibm.com [195.75.94.104]) by mx0b-001b2d01.pphosted.com with ESMTP id 28ferm6vqc-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Tue, 07 Feb 2017 10:16:52 -0500 Received: from localhost by e06smtp08.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 7 Feb 2017 15:16:51 -0000 Received: from d06dlp03.portsmouth.uk.ibm.com (9.149.20.15) by e06smtp08.uk.ibm.com (192.168.101.138) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Tue, 7 Feb 2017 15:16:49 -0000 Received: from b06cxnps3075.portsmouth.uk.ibm.com (d06relay10.portsmouth.uk.ibm.com [9.149.109.195]) by d06dlp03.portsmouth.uk.ibm.com (Postfix) with ESMTP id D94C71B08075; Tue, 7 Feb 2017 15:19:41 +0000 (GMT) Received: from d06av26.portsmouth.uk.ibm.com (d06av26.portsmouth.uk.ibm.com [9.149.105.62]) by b06cxnps3075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id v17FGmGC8388978; Tue, 7 Feb 2017 15:16:48 GMT Received: from d06av26.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 16625AE057; Tue, 7 Feb 2017 14:14:43 +0000 (GMT) Received: from d06av26.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id E2EBAAE068; Tue, 7 Feb 2017 14:14:42 +0000 (GMT) Received: from fiuczyvm.boeblingen.de.ibm.com (unknown [9.152.222.92]) by d06av26.portsmouth.uk.ibm.com (Postfix) with ESMTP; Tue, 7 Feb 2017 14:14:42 +0000 (GMT) From: Boris Fiuczynski To: libvir-list@redhat.com, mprivozn@redhat.com, laine@laine.org Date: Tue, 7 Feb 2017 16:16:44 +0100 In-Reply-To: <1486480604-29957-1-git-send-email-fiuczy@linux.vnet.ibm.com> References: <1486480604-29957-1-git-send-email-fiuczy@linux.vnet.ibm.com> X-TM-AS-GCONF: 00 X-Content-Scanned: Fidelis XPS MAILER x-cbid: 17020715-0032-0000-0000-00000718B62B X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17020715-0033-0000-0000-00002358392F Message-Id: <1486480604-29957-4-git-send-email-fiuczy@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2017-02-07_08:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=0 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1612050000 definitions=main-1702070145 X-Greylist: Sender passed SPF test, Sender IP whitelisted by DNSRBL, ACL 200 matched, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Tue, 07 Feb 2017 15:16:54 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Tue, 07 Feb 2017 15:16:54 +0000 (UTC) for IP:'148.163.158.5' DOMAIN:'mx0b-001b2d01.pphosted.com' HELO:'mx0a-001b2d01.pphosted.com' FROM:'fiuczy@linux.vnet.ibm.com' RCPT:'' X-RedHat-Spam-Score: -1.787 (BAYES_50, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2) 148.163.158.5 mx0b-001b2d01.pphosted.com 148.163.158.5 mx0b-001b2d01.pphosted.com X-Scanned-By: MIMEDefang 2.68 on 10.5.11.23 X-Scanned-By: MIMEDefang 2.78 on 10.5.110.31 X-loop: libvir-list@redhat.com Cc: stzi@linux.vnet.ibm.com Subject: [libvirt] [PATCH v3 3/3] libvirtd: set openvswitch timeout value based on config data 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 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" 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 Reviewed-by: Bjoern Walk --- 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" =20 #ifdef WITH_DRIVER_MODULES # include "driver.h" @@ -658,6 +659,16 @@ daemonSetupNetworking(virNetServerPtr srv, =20 =20 /* + * 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); } =20 + daemonSetupNetDevOpenvswitch(config); + if (daemonSetupAccessManager(config) < 0) { VIR_ERROR(_("Can't initialize access manager")); exit(EXIT_FAILURE); --=20 2.5.5 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list