From nobody Sat Apr 27 13:18:44 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1536835690650391.3136580303036; Thu, 13 Sep 2018 03:48:10 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.24]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id C93FB5F789; Thu, 13 Sep 2018 10:48:07 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id EA485308BDA4; Thu, 13 Sep 2018 10:48:06 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id C316918005D0; Thu, 13 Sep 2018 10:48:04 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.26]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w8DAm3Sw016287 for ; Thu, 13 Sep 2018 06:48:03 -0400 Received: by smtp.corp.redhat.com (Postfix) id 226273091323; Thu, 13 Sep 2018 10:48:03 +0000 (UTC) Received: from mx1.redhat.com (ext-mx13.extmail.prod.ext.phx2.redhat.com [10.5.110.42]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 1B43C30912F4 for ; Thu, 13 Sep 2018 10:47:59 +0000 (UTC) Received: from mxhk.zte.com.cn (mxhk.zte.com.cn [63.217.80.70]) (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 6D137310E9AC for ; Thu, 13 Sep 2018 10:47:51 +0000 (UTC) Received: from mse01.zte.com.cn (unknown [10.30.3.20]) by Forcepoint Email with ESMTPS id 8D7AD1E45415E3322248 for ; Thu, 13 Sep 2018 18:47:48 +0800 (CST) Received: from notes_smtp.zte.com.cn ([10.30.1.239]) by mse01.zte.com.cn with ESMTP id w8DAld96019716 for ; Thu, 13 Sep 2018 18:47:39 +0800 (GMT-8) (envelope-from wang.yi59@zte.com.cn) Received: from fox-host8.localdomain ([10.74.120.8]) by szsmtp06.zte.com.cn (Lotus Domino Release 8.5.3FP6) with ESMTP id 2018091318475797-8816212 ; Thu, 13 Sep 2018 18:47:57 +0800 From: Yi Wang To: libvir-list@redhat.com Date: Thu, 13 Sep 2018 18:47:55 +0800 Message-Id: <1536835675-39311-1-git-send-email-wang.yi59@zte.com.cn> X-MIMETrack: Itemize by SMTP Server on SZSMTP06/server/zte_ltd(Release 8.5.3FP6|November 21, 2013) at 2018-09-13 18:47:58, Serialize by Router on notes_smtp/zte_ltd(Release 9.0.1FP7|August 17, 2016) at 2018-09-13 18:47:27, Serialize complete at 2018-09-13 18:47:27 X-MAIL: mse01.zte.com.cn w8DAld96019716 X-Greylist: Sender passed SPF test, Sender IP whitelisted by DNSRBL, ACL 212 matched, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.42]); Thu, 13 Sep 2018 10:47:52 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.42]); Thu, 13 Sep 2018 10:47:52 +0000 (UTC) for IP:'63.217.80.70' DOMAIN:'mxhk.zte.com.cn' HELO:'mxhk.zte.com.cn' FROM:'wang.yi59@zte.com.cn' RCPT:'' X-RedHat-Spam-Score: -2.301 (RCVD_IN_DNSWL_MED, SPF_PASS) 63.217.80.70 mxhk.zte.com.cn 63.217.80.70 mxhk.zte.com.cn X-Scanned-By: MIMEDefang 2.84 on 10.5.110.42 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.26 X-loop: libvir-list@redhat.com Cc: Yi Wang , zhong.weidong@zte.com.cn, Liu.Jianjun3@zte.com.cn, xu.xi8@zte.com.cn Subject: [libvirt] [PATCH v7] qemu: Introduce state_lock_timeout to qemu.conf 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-Scanned-By: MIMEDefang 2.84 on 10.5.11.24 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Thu, 13 Sep 2018 10:48:08 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" When doing some job holding state lock for a long time, we may come across error: "Timed out during operation: cannot acquire state change lock" Well, sometimes it's not a problem and users want to continue to wait, and this patch allow users decide how long time they can wait the state lock. Signed-off-by: Yi Wang Reviewed-by: Xi Xu --- changes in v7: - fix multiplication issue in BeginJobInternal changes in v6: - modify the description in qemu.conf - move the multiplication to BeginJobInternal changes in v5: - adjust position of state lock in aug file - fix state lock time got from conf file from milliseconds to seconds changes in v4: - fix syntax-check error changes in v3: - add user-friendly description and nb of state lock - check validity of stateLockTimeout changes in v2: - change default value to 30 in qemu.conf - set the default value in virQEMUDriverConfigNew() --- src/qemu/libvirtd_qemu.aug | 1 + src/qemu/qemu.conf | 7 +++++++ src/qemu/qemu_conf.c | 14 ++++++++++++++ src/qemu/qemu_conf.h | 2 ++ src/qemu/qemu_domain.c | 5 +---- src/qemu/test_libvirtd_qemu.aug.in | 1 + 6 files changed, 26 insertions(+), 4 deletions(-) diff --git a/src/qemu/libvirtd_qemu.aug b/src/qemu/libvirtd_qemu.aug index ddc4bbf..a5601e1 100644 --- a/src/qemu/libvirtd_qemu.aug +++ b/src/qemu/libvirtd_qemu.aug @@ -100,6 +100,7 @@ module Libvirtd_qemu =3D | str_entry "lock_manager" =20 let rpc_entry =3D int_entry "max_queued" + | int_entry "state_lock_timeout" | int_entry "keepalive_interval" | int_entry "keepalive_count" =20 diff --git a/src/qemu/qemu.conf b/src/qemu/qemu.conf index cd57b3c..f5e34f1 100644 --- a/src/qemu/qemu.conf +++ b/src/qemu/qemu.conf @@ -667,6 +667,13 @@ # #max_queued =3D 0 =20 + +# It is strongly recommended to not touch this setting +# +# Default is 30 +# +#state_lock_timeout =3D 60 + ################################################################### # Keepalive protocol: # This allows qemu driver to detect broken connections to remote diff --git a/src/qemu/qemu_conf.c b/src/qemu/qemu_conf.c index a4f545e..5be37dc 100644 --- a/src/qemu/qemu_conf.c +++ b/src/qemu/qemu_conf.c @@ -129,6 +129,9 @@ void qemuDomainCmdlineDefFree(qemuDomainCmdlineDefPtr d= ef) #endif =20 =20 +/* Give up waiting for mutex after 30 seconds */ +#define QEMU_JOB_WAIT_TIME (30) + virQEMUDriverConfigPtr virQEMUDriverConfigNew(bool privileged) { virQEMUDriverConfigPtr cfg; @@ -346,6 +349,8 @@ virQEMUDriverConfigPtr virQEMUDriverConfigNew(bool priv= ileged) cfg->glusterDebugLevel =3D 4; cfg->stdioLogD =3D true; =20 + cfg->stateLockTimeout =3D QEMU_JOB_WAIT_TIME; + if (!(cfg->namespaces =3D virBitmapNew(QEMU_DOMAIN_NS_LAST))) goto error; =20 @@ -863,6 +868,9 @@ int virQEMUDriverConfigLoadFile(virQEMUDriverConfigPtr = cfg, if (virConfGetValueUInt(conf, "keepalive_count", &cfg->keepAliveCount)= < 0) goto cleanup; =20 + if (virConfGetValueInt(conf, "state_lock_timeout", &cfg->stateLockTime= out) < 0) + goto cleanup; + if (virConfGetValueInt(conf, "seccomp_sandbox", &cfg->seccompSandbox) = < 0) goto cleanup; =20 @@ -1055,6 +1063,12 @@ virQEMUDriverConfigValidate(virQEMUDriverConfigPtr c= fg) return -1; } =20 + if (cfg->stateLockTimeout <=3D 0) { + virReportError(VIR_ERR_CONF_SYNTAX, "%s", + _("state_lock_timeout must be larger than zero")); + return -1; + } + return 0; } =20 diff --git a/src/qemu/qemu_conf.h b/src/qemu/qemu_conf.h index a8d84ef..97cf2e1 100644 --- a/src/qemu/qemu_conf.h +++ b/src/qemu/qemu_conf.h @@ -190,6 +190,8 @@ struct _virQEMUDriverConfig { int keepAliveInterval; unsigned int keepAliveCount; =20 + int stateLockTimeout; + int seccompSandbox; =20 char *migrateHost; diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index 886e3fb..4dea85f 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -6652,9 +6652,6 @@ qemuDomainObjCanSetJob(qemuDomainObjPrivatePtr priv, priv->job.agentActive =3D=3D QEMU_AGENT_JOB_NONE)); } =20 -/* Give up waiting for mutex after 30 seconds */ -#define QEMU_JOB_WAIT_TIME (1000ull * 30) - /** * qemuDomainObjBeginJobInternal: * @driver: qemu driver @@ -6714,7 +6711,7 @@ qemuDomainObjBeginJobInternal(virQEMUDriverPtr driver, } =20 priv->jobs_queued++; - then =3D now + QEMU_JOB_WAIT_TIME; + then =3D now + cfg->stateLockTimeout * 1000; =20 retry: if ((!async && job !=3D QEMU_JOB_DESTROY) && diff --git a/src/qemu/test_libvirtd_qemu.aug.in b/src/qemu/test_libvirtd_qe= mu.aug.in index f1e8806..8e072d0 100644 --- a/src/qemu/test_libvirtd_qemu.aug.in +++ b/src/qemu/test_libvirtd_qemu.aug.in @@ -82,6 +82,7 @@ module Test_libvirtd_qemu =3D { "relaxed_acs_check" =3D "1" } { "lock_manager" =3D "lockd" } { "max_queued" =3D "0" } +{ "state_lock_timeout" =3D "60" } { "keepalive_interval" =3D "5" } { "keepalive_count" =3D "5" } { "seccomp_sandbox" =3D "1" } --=20 1.8.3.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list