From nobody Sun May 5 03:43:14 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; dkim=fail; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1571423887; cv=none; d=zoho.com; s=zohoarc; b=NCgOaU+q7TqFAIn5Nw3hKrohOg0n/fgQubF8VT134gOXMcDGKhNTLFIInwS9DHU46rTO+V2GwYvgBUouf9oZ8f7MPWSdFoVGoMyfzl2rCZqf1zUiSUfIczi5ac+3LYtKyC6+faHuFiGfs7BJIOLpBIqzOu2hT2UEr9k1jvkg8Fs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1571423887; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=zAfGTlSboMRnCb4XzqV+2ZL6DiUwCSG93bGYYuvtouU=; b=GLaOVkufmNKhXuiMcWToD14VEnHyv3srrtby7Z3OyJn4EM+fMbrvDQnnMxBBsdMptlEjZ1Ms2n+10mH9qHg2GKSjO0WMK8kGUf2DVZ/UKamyb/kB0Deajhh9y3D3Y65YQ/RnoHS1p+sAbxqT77l37m2ID5808/rBQeCu5LqPID8= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=fail; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1571423887589999.2145095708345; Fri, 18 Oct 2019 11:38:07 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 048F63C916; Fri, 18 Oct 2019 18:38:06 +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 CDD7D600C4; Fri, 18 Oct 2019 18:38:05 +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 860D2180085A; Fri, 18 Oct 2019 18:38:05 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x9IIarjG013240 for ; Fri, 18 Oct 2019 14:36:53 -0400 Received: by smtp.corp.redhat.com (Postfix) id 7EEB75D717; Fri, 18 Oct 2019 18:36:53 +0000 (UTC) Received: from mx1.redhat.com (ext-mx08.extmail.prod.ext.phx2.redhat.com [10.5.110.32]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 3433D5D713; Fri, 18 Oct 2019 18:36:51 +0000 (UTC) Received: from mail-qt1-f169.google.com (mail-qt1-f169.google.com [209.85.160.169]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id DE210C05AA6C; Fri, 18 Oct 2019 18:36:49 +0000 (UTC) Received: by mail-qt1-f169.google.com with SMTP id j31so10485547qta.5; Fri, 18 Oct 2019 11:36:49 -0700 (PDT) Received: from localhost.localdomain ([187.119.225.130]) by smtp.gmail.com with ESMTPSA id y26sm3883005qtk.22.2019.10.18.11.36.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 18 Oct 2019 11:36:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=/MU+8OEUKjVyfkZeaeQIKEz6Qo/8x/fj5QJJF2+dEVw=; b=ilTsScCsUtbs1c+4pstB0gEERQ3sobks54ihzU/kWuraSfs0J2vG74EvHlQqd3F5YW 1wxPlpn0f/KfwwMcEo3F72pniGCTIqbN1xE8GRUBpgYcPFWoDhFMjR7c+9xTMG0AnAdE oLIAB4xE6I+DjG1/ZauTaGGnL0LdSTnpL7F4lDQIR0aODQJo9AhFNKfVrJPMHbicy9KP etUju8mM3Wv/nIDvIA8F70z8deb47QZ5bv4jTVJl7KI3hkUP+6a9cJGBiP6UofB/jdiC 8Zl1bOpW9PJncRvuWY9gxmb54Eo9I0kDe8ERJkgqfoNrf58pqPI7hM2VCypRkBVgPL54 FrlQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=/MU+8OEUKjVyfkZeaeQIKEz6Qo/8x/fj5QJJF2+dEVw=; b=XvfTcTi6cAR411c/n3OHUyY1P9X3LS+jty7pvcMlWTTVJHnEaHzm1XNeV3r/3BLFBF 0ATxfxQ5fBlPXaTxFIj+GkQ9BMZRoX/CKT2IBVPHnBvzafsFbakrE5SACEGUg1lqdDau 7Z+vS96KSxjLE6YzCQ8NVn2myM28nG1CBNIqpAfb1oAVf5BNjLCe/6yKu9UFNO1x5kj4 V/mmRrnYKCWNPnFaF1AXog7dKFhoyMhK9c42o2KRrI+B+9qeJu7fxWSEYisOKKNuV2mM xtyVgrX5ZfpGpDc1S2TiDiSv3PzowEChQ4jsnIAsmnNduFopGyps5nYZTLZGQZpm67rS yDKw== X-Gm-Message-State: APjAAAW4rAoVqrCBGSTVjRQZ4zcsUsOjLbPqdoF7YaJPrs2NpHbJH7nx 8lFcHSp1J8ekjHAgIe2tW/bxrB8+ X-Google-Smtp-Source: APXvYqzv+xL2GAuWW2mv4sedM56Aqf6BdzTEcp/6gR/6hf4wxk1BUzysKeCN3tgtzflpnB8fpqhSvg== X-Received: by 2002:a0c:e6a6:: with SMTP id j6mr11142642qvn.74.1571423808900; Fri, 18 Oct 2019 11:36:48 -0700 (PDT) From: Daniel Henrique Barboza To: libvir-list@redhat.com Date: Fri, 18 Oct 2019 15:36:32 -0300 Message-Id: <20191018183634.15338-2-danielhb413@gmail.com> In-Reply-To: <20191018183634.15338-1-danielhb413@gmail.com> References: <20191018183634.15338-1-danielhb413@gmail.com> MIME-Version: 1.0 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Fri, 18 Oct 2019 18:36:50 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Fri, 18 Oct 2019 18:36:50 +0000 (UTC) for IP:'209.85.160.169' DOMAIN:'mail-qt1-f169.google.com' HELO:'mail-qt1-f169.google.com' FROM:'danielhb413@gmail.com' RCPT:'' X-RedHat-Spam-Score: 0.153 (DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_PASS) 209.85.160.169 mail-qt1-f169.google.com 209.85.160.169 mail-qt1-f169.google.com X-Scanned-By: MIMEDefang 2.78 on 10.5.110.32 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@redhat.com Cc: Daniel Henrique Barboza , crobinso@redhat.com Subject: [libvirt] [PATCH v3 1/3] qemu_hotplug.c: adding qemuDomainGetUnplugTimeout 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: , Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Fri, 18 Oct 2019 18:38:06 +0000 (UTC) X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" For some architectures and setups, device removal can take longer than the default 5 seconds. This results in commands such as 'virsh setvcpus' to fire timeout messages even if the operation were successful in the guest, confusing the user. This patch sets a new 10 seconds unplug timeout for PPC64 guests. All other archs will keep the default 5 seconds timeout. Instead of putting 'if PPC64' conditionals inside qemu_hotplug.c to set the new timeout value, a new function called qemuDomainGetUnplugTimeout was added. The timeout value is then retrieved when needed, by passing the correspondent DomainDef object. This approach allows for different guest architectures to have distint unplug timeout intervals, regardless of the host architecture. This design also makes it easier to modify/enhance the unplug timeout logic in the future (allow for special timeouts for TCG domains, for example). A new mock file was created to work with qemuhotplugtest.c, given that the test timeout is significantly shorter than the actual timeout value in qemu_hotplug.c. The now unused 'qemuDomainRemoveDeviceWaitTime' global can't be simply erased from qemu_hotplug.c though. Next patch will remove it properly. Suggested-by: Cole Robinson Signed-off-by: Daniel Henrique Barboza --- src/qemu/qemu_hotplug.c | 20 +++++++++++++++++++- src/qemu/qemu_hotplug.h | 2 ++ tests/Makefile.am | 13 ++++++++++++- tests/qemuhotplugmock.c | 33 +++++++++++++++++++++++++++++++++ tests/qemuhotplugtest.c | 3 ++- 5 files changed, 68 insertions(+), 3 deletions(-) create mode 100644 tests/qemuhotplugmock.c diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c index bf301919cc..a7955e8062 100644 --- a/src/qemu/qemu_hotplug.c +++ b/src/qemu/qemu_hotplug.c @@ -63,6 +63,13 @@ VIR_LOG_INIT("qemu.qemu_hotplug"); =20 #define CHANGE_MEDIA_TIMEOUT 5000 =20 +/* Timeout in miliseconds for device removal. PPC64 domains + * can experience a bigger delay in unplug operations during + * heavy guest activity (vcpu being the most notable case), thus + * the timeout for PPC64 is also bigger. */ +#define QEMU_UNPLUG_TIMEOUT 1000ull * 5 +#define QEMU_UNPLUG_TIMEOUT_PPC64 1000ull * 10 + /* Wait up to 5 seconds for device removal to finish. */ unsigned long long qemuDomainRemoveDeviceWaitTime =3D 1000ull * 5; =20 @@ -5112,6 +5119,17 @@ qemuDomainResetDeviceRemoval(virDomainObjPtr vm) priv->unplug.eventSeen =3D false; } =20 + +unsigned long long +qemuDomainGetUnplugTimeout(virDomainObjPtr vm) +{ + if (qemuDomainIsPSeries(vm->def)) + return QEMU_UNPLUG_TIMEOUT_PPC64; + + return QEMU_UNPLUG_TIMEOUT; +} + + /* Returns: * -1 Unplug of the device failed * @@ -5130,7 +5148,7 @@ qemuDomainWaitForDeviceRemoval(virDomainObjPtr vm) =20 if (virTimeMillisNow(&until) < 0) return 1; - until +=3D qemuDomainRemoveDeviceWaitTime; + until +=3D qemuDomainGetUnplugTimeout(vm); =20 while (priv->unplug.alias) { if ((rc =3D virDomainObjWaitUntil(vm, until)) =3D=3D 1) diff --git a/src/qemu/qemu_hotplug.h b/src/qemu/qemu_hotplug.h index 6d2cd34dbc..1dfc601110 100644 --- a/src/qemu/qemu_hotplug.h +++ b/src/qemu/qemu_hotplug.h @@ -161,3 +161,5 @@ int qemuDomainDetachDBusVMState(virQEMUDriverPtr driver, virDomainObjPtr vm, const char *id, qemuDomainAsyncJob asyncJob); + +unsigned long long qemuDomainGetUnplugTimeout(virDomainObjPtr vm); diff --git a/tests/Makefile.am b/tests/Makefile.am index a9acd88670..8674b1f9da 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -223,6 +223,7 @@ test_libraries =3D libshunload.la \ libvirhostcpumock.la \ libdomaincapsmock.la \ libvirfilecachemock.la \ + libqemuhotplugmock.la \ $(NULL) =20 if WITH_REMOTE @@ -565,6 +566,11 @@ libqemucpumock_la_SOURCES =3D \ libqemucpumock_la_LDFLAGS =3D $(MOCKLIBS_LDFLAGS) libqemucpumock_la_LIBADD =3D $(MOCKLIBS_LIBS) =20 +libqemuhotplugmock_la_SOURCES =3D \ + qemuhotplugmock.c +libqemuhotplugmock_la_LDFLAGS =3D $(MOCKLIBS_LDFLAGS) +libqemuhotplugmock_la_LIBADD =3D $(MOCKLIBS_LIBS) + qemuxml2argvtest_SOURCES =3D \ qemuxml2argvtest.c testutilsqemu.c testutilsqemu.h \ testutils.c testutils.h \ @@ -642,7 +648,11 @@ qemuhotplugtest_SOURCES =3D \ testutils.c testutils.h \ testutilsqemu.c testutilsqemu.h \ $(NULL) -qemuhotplugtest_LDADD =3D libqemumonitortestutils.la $(qemu_LDADDS) +qemuhotplugtest_LDADD =3D \ + libqemutestdriver.la \ + libqemumonitortestutils.la \ + $(qemu_LDADDS) \ + $(NULL) =20 qemublocktest_SOURCES =3D \ qemublocktest.c \ @@ -716,6 +726,7 @@ EXTRA_DIST +=3D qemuxml2argvtest.c qemuxml2xmltest.c \ qemusecuritymock.c \ qemufirmwaretest.c \ qemuvhostusertest.c \ + qemuhotplugmock.c \ $(QEMUMONITORTESTUTILS_SOURCES) endif ! WITH_QEMU =20 diff --git a/tests/qemuhotplugmock.c b/tests/qemuhotplugmock.c new file mode 100644 index 0000000000..43a9d79051 --- /dev/null +++ b/tests/qemuhotplugmock.c @@ -0,0 +1,33 @@ +/* + * Copyright (C) 2019 IBM Corporation + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library. If not, see + * . + */ + +#include + +#include "qemu/qemu_hotplug.h" +#include "conf/domain_conf.h" + +unsigned long long +qemuDomainGetUnplugTimeout(virDomainObjPtr vm G_GNUC_UNUSED) +{ + /* Wait only 100ms for DEVICE_DELETED event. Give a greater + * timeout in case of PSeries guest to be consistent with the + * original logic. */ + if (qemuDomainIsPSeries(vm->def)) + return 200; + return 100; +} diff --git a/tests/qemuhotplugtest.c b/tests/qemuhotplugtest.c index d3da08875a..5f2fc6a598 100644 --- a/tests/qemuhotplugtest.c +++ b/tests/qemuhotplugtest.c @@ -888,4 +888,5 @@ mymain(void) =20 VIR_TEST_MAIN_PRELOAD(mymain, VIR_TEST_MOCK("virpci"), - VIR_TEST_MOCK("virprocess")); + VIR_TEST_MOCK("virprocess"), + VIR_TEST_MOCK("qemuhotplug")); --=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sun May 5 03:43:14 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; dkim=fail; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1571423891; cv=none; d=zoho.com; s=zohoarc; b=IeeHK89vgorUZU1p0q1e3VFKLdpWCCxZs4f9Ail8dHfirrcWThEOeX7IvTGK4lKhyd9DhrAUXty33h6KHKbUImACNakpcqGEK1eAD4UOPqrjPXDDjA0NnRyh4TiY21bfnwkpLzmpEbBAV6bzG2Y6+unPKGaNT1hKHFpY2peaDmg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1571423891; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=z/PDr+BQVXNpTav/DGxMm5WE6GoPi8NLomFXVorzByc=; b=Z2d2qiWFipkz2nmC/Xu6AXbjfd5ihvmit8BztN6/l5WOUGJqi6WAhhwXR/EnpVugf6rW0obKQomsjX3BU6NeMXgtFXx5NwKBaazvXll/0FmcWoHfnnlnVZ+VaF405VOQbo5y/mg6lJAtDZ6oniVzKVHhrmMahUQglK8Pi8XJVxg= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=fail; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1571423891521124.45303238317729; Fri, 18 Oct 2019 11:38:11 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id B918E89F2BF; Fri, 18 Oct 2019 18:38:09 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 932A35D717; Fri, 18 Oct 2019 18:38:09 +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 50D1F4E58B; Fri, 18 Oct 2019 18:38:09 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x9IIarsn013245 for ; Fri, 18 Oct 2019 14:36:53 -0400 Received: by smtp.corp.redhat.com (Postfix) id EDEB91001B20; Fri, 18 Oct 2019 18:36:53 +0000 (UTC) Received: from mx1.redhat.com (ext-mx22.extmail.prod.ext.phx2.redhat.com [10.5.110.63]) by smtp.corp.redhat.com (Postfix) with ESMTPS id E46911001B11; Fri, 18 Oct 2019 18:36:53 +0000 (UTC) Received: from mail-qk1-f194.google.com (mail-qk1-f194.google.com [209.85.222.194]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id E784D18CB91B; Fri, 18 Oct 2019 18:36:52 +0000 (UTC) Received: by mail-qk1-f194.google.com with SMTP id f18so5607975qkm.1; Fri, 18 Oct 2019 11:36:52 -0700 (PDT) Received: from localhost.localdomain ([187.119.225.130]) by smtp.gmail.com with ESMTPSA id y26sm3883005qtk.22.2019.10.18.11.36.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 18 Oct 2019 11:36:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=PCrfLzsDgjBHYHrXCsT+RZ3WFFBR4bKlVmPOWfu66jk=; b=RN0lHy51Dk4B1jEOXfjFmb3wvxq8GEmCPnQZNkNSDrWYXA8OPN6NkbVkmgbGrLlBhN TK+P9E/AO95I37UyWeYWcewPvfZD/9yI/Jrwr4cqQVL31k5dwucFcv/p2CkCJLJD5WrT bcRSRFkCi778xAO4Ce64o7I0ZnZBhvi7J/kurdfDHLszjvuJC5KStyDv3r956vYy1vJS kkXSpLrpOxfXeg7S4oTTuYU9rZLaQa72lcauaJaioX9WED0V7ZqNUd2Vs9ixQ1CrOVqn dyiTOHgR2lQptzgbUrSAhPXxkmGKLhqO7NRw698UbDCbg3XDxhA/KWqZEJocw9nnOgO6 tpSg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=PCrfLzsDgjBHYHrXCsT+RZ3WFFBR4bKlVmPOWfu66jk=; b=CypXvoUmyPwZ5/UuHUL66tLUlhF+XT8Ls+KMGQc7GbhXcCw57HPxtZw39ErwN2oyUQ Nqnm2URgeZK28z/JWmf10RCCZSHCWFejwXmfSXI9ihjeBfhsty8OKg7zx4KxstJlpyc+ j643YLUFqc+G2BVVHUqf8yGZw8ckDZa2adgwd9zPiJ9N7zWNnTWXl4qqhLQxqpL7cpi1 ra54ae5+dy54eYQLjeKpDtSWsgUYyP6JGLXR+cSGVL9d0tYsHmoEVs54CDpiuHU20rIF MkHV8fkl+ghwgaWdJdArP5LfZmKa+yRquWaeJObaClc/XccjcSzF28EkOUo9tyH0x95U /5lQ== X-Gm-Message-State: APjAAAXe7ZViItuAvYn21wQLHCfL64ceg6PMfrgFwkHlQJ+TP939m3jy pgcw0vqY35sobrYwVEca12eXk4Y2am8= X-Google-Smtp-Source: APXvYqzXX89az9JmeeocJvzHi+pY0s4sx7GR/iWz161ulhcyiIRUpXHYKUnoUoD+thmKIQlkEoM44w== X-Received: by 2002:a37:9202:: with SMTP id u2mr10254902qkd.8.1571423811982; Fri, 18 Oct 2019 11:36:51 -0700 (PDT) From: Daniel Henrique Barboza To: libvir-list@redhat.com Date: Fri, 18 Oct 2019 15:36:33 -0300 Message-Id: <20191018183634.15338-3-danielhb413@gmail.com> In-Reply-To: <20191018183634.15338-1-danielhb413@gmail.com> References: <20191018183634.15338-1-danielhb413@gmail.com> MIME-Version: 1.0 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.6.2 (mx1.redhat.com [10.5.110.63]); Fri, 18 Oct 2019 18:36:53 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.6.2 (mx1.redhat.com [10.5.110.63]); Fri, 18 Oct 2019 18:36:53 +0000 (UTC) for IP:'209.85.222.194' DOMAIN:'mail-qk1-f194.google.com' HELO:'mail-qk1-f194.google.com' FROM:'danielhb413@gmail.com' RCPT:'' X-RedHat-Spam-Score: 0.15 (DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_PASS) 209.85.222.194 mail-qk1-f194.google.com 209.85.222.194 mail-qk1-f194.google.com X-Scanned-By: MIMEDefang 2.84 on 10.5.110.63 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-loop: libvir-list@redhat.com Cc: Daniel Henrique Barboza , crobinso@redhat.com Subject: [libvirt] [PATCH v3 2/3] qemu: Remove qemu_hotplugpriv.h and qemuDomainRemoveDeviceWaitTime 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: , Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.6.2 (mx1.redhat.com [10.5.110.68]); Fri, 18 Oct 2019 18:38:10 +0000 (UTC) X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" qemu_hotplugpriv.h is a header file created to share a global variable called 'qemuDomainRemoveDeviceWaitTime', declared in qemu_hotplug.c, to other files that would want to change the timeout value (currently, only tests/qemuhotplugtest.c). Previous patch deprecated the variable, using qemu_driver->unplugTimeout to set the timeout instead. This means that the header file is now unused, and can be safely discarded. Signed-off-by: Daniel Henrique Barboza --- src/qemu/Makefile.inc.am | 1 - src/qemu/qemu_hotplug.c | 5 ----- src/qemu/qemu_hotplugpriv.h | 32 -------------------------------- tests/qemuhotplugtest.c | 4 ---- 4 files changed, 42 deletions(-) delete mode 100644 src/qemu/qemu_hotplugpriv.h diff --git a/src/qemu/Makefile.inc.am b/src/qemu/Makefile.inc.am index e66da76c0a..1827ef6e04 100644 --- a/src/qemu/Makefile.inc.am +++ b/src/qemu/Makefile.inc.am @@ -29,7 +29,6 @@ QEMU_DRIVER_SOURCES =3D \ qemu/qemu_hostdev.h \ qemu/qemu_hotplug.c \ qemu/qemu_hotplug.h \ - qemu/qemu_hotplugpriv.h \ qemu/qemu_conf.c \ qemu/qemu_conf.h \ qemu/qemu_interop_config.c \ diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c index a7955e8062..32100b140e 100644 --- a/src/qemu/qemu_hotplug.c +++ b/src/qemu/qemu_hotplug.c @@ -23,8 +23,6 @@ #include =20 #include "qemu_hotplug.h" -#define LIBVIRT_QEMU_HOTPLUGPRIV_H_ALLOW -#include "qemu_hotplugpriv.h" #include "qemu_alias.h" #include "qemu_capabilities.h" #include "qemu_domain.h" @@ -70,9 +68,6 @@ VIR_LOG_INIT("qemu.qemu_hotplug"); #define QEMU_UNPLUG_TIMEOUT 1000ull * 5 #define QEMU_UNPLUG_TIMEOUT_PPC64 1000ull * 10 =20 -/* Wait up to 5 seconds for device removal to finish. */ -unsigned long long qemuDomainRemoveDeviceWaitTime =3D 1000ull * 5; - =20 static void qemuDomainResetDeviceRemoval(virDomainObjPtr vm); diff --git a/src/qemu/qemu_hotplugpriv.h b/src/qemu/qemu_hotplugpriv.h deleted file mode 100644 index a5c443ba85..0000000000 --- a/src/qemu/qemu_hotplugpriv.h +++ /dev/null @@ -1,32 +0,0 @@ -/* - * qemu_hotplugpriv.h: private declarations for QEMU device hotplug manage= ment - * - * Copyright (C) 2013 Red Hat, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see - * . - * - */ - -#ifndef LIBVIRT_QEMU_HOTPLUGPRIV_H_ALLOW -# error "qemu_hotplugpriv.h may only be included by qemu_hotplug.c or test= suites" -#endif /* LIBVIRT_QEMU_HOTPLUGPRIV_H_ALLOW */ - -#pragma once - -/* - * This header file should never be used outside unit tests. - */ - -extern unsigned long long qemuDomainRemoveDeviceWaitTime; diff --git a/tests/qemuhotplugtest.c b/tests/qemuhotplugtest.c index 5f2fc6a598..140ab902ce 100644 --- a/tests/qemuhotplugtest.c +++ b/tests/qemuhotplugtest.c @@ -22,8 +22,6 @@ #include "qemu/qemu_alias.h" #include "qemu/qemu_conf.h" #include "qemu/qemu_hotplug.h" -#define LIBVIRT_QEMU_HOTPLUGPRIV_H_ALLOW -#include "qemu/qemu_hotplugpriv.h" #include "qemumonitortestutils.h" #include "testutils.h" #include "testutilsqemu.h" @@ -643,8 +641,6 @@ mymain(void) =20 driver.hostdevMgr =3D virHostdevManagerGetDefault(); =20 - /* wait only 100ms for DEVICE_DELETED event */ - qemuDomainRemoveDeviceWaitTime =3D 100; =20 #define DO_TEST(file, ACTION, dev, fial, kep, ...) \ do { \ --=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sun May 5 03:43:14 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; dkim=fail; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1571423867; cv=none; d=zoho.com; s=zohoarc; b=GNStMFrqzhCerrqIbJX3rVP0a510no6/eDy16Ip7RuEBEhMP/VuErUnqRjIinJv8BW0l/WZsj8Ub7tMdgGRqQ71mhLezOjecqrn+C1nmJ7KbJCCf2MXFfjN3ubMBoF3LJ5zglcDuTZnDhfHELFcjqyurhUFkxh24FkTFzTLzv0E= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1571423867; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=D1pUclGuzVQkK4ASpRTG2fSZ92Zw5IyLBzMZHKS6EA0=; b=JJ30TcCbaKDZtaOXlR6t/vT3oyrSZsUhdnYE7fnUq2FkhrvjADfbK/YCVexIl8ckuukJTRq+LFbt/nUepadCELu07XZsjje/17VaBOATKTfwCv3R6KifFL7xLbE0Baxqaeubdgdpru+2ZIvDOKk7xLRDrAkV8Gc9LpuwUPNqzpk= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=fail; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1571423867704132.27170747088064; Fri, 18 Oct 2019 11:37:47 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id BBB3A5AFF8; Fri, 18 Oct 2019 18:37:45 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 9280F10027A8; Fri, 18 Oct 2019 18:37:45 +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 490644EE69; Fri, 18 Oct 2019 18:37:45 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x9IIawxP013261 for ; Fri, 18 Oct 2019 14:36:58 -0400 Received: by smtp.corp.redhat.com (Postfix) id 7AFCC5C21E; Fri, 18 Oct 2019 18:36:58 +0000 (UTC) Received: from mx1.redhat.com (ext-mx25.extmail.prod.ext.phx2.redhat.com [10.5.110.66]) by smtp.corp.redhat.com (Postfix) with ESMTPS id CCB0A5C1B5; Fri, 18 Oct 2019 18:36:55 +0000 (UTC) Received: from mail-qk1-f196.google.com (mail-qk1-f196.google.com [209.85.222.196]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 32CCA10C0946; Fri, 18 Oct 2019 18:36:55 +0000 (UTC) Received: by mail-qk1-f196.google.com with SMTP id w2so6228630qkf.2; Fri, 18 Oct 2019 11:36:55 -0700 (PDT) Received: from localhost.localdomain ([187.119.225.130]) by smtp.gmail.com with ESMTPSA id y26sm3883005qtk.22.2019.10.18.11.36.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 18 Oct 2019 11:36:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=yXtaYCSnMa/mtG+84gRXJtmrASvD1O+JISEPZz9EgGU=; b=m6QD4vNISRoAOlrNyXtf5UF2AMRLquBVUJjXSBx/8twHGUcPuB+lS4bTvvvcEla3VA nvFzPc1dcTG7wO5OcowGGRfyD+klrDcQikibk3/WZ/SCwNn/+RcvCRXtunN8NOuak52J yk3GV94YGeBopdGocRcyaOvjXlT/pW1mQ6GRZZeb+Ua9XOWsEal1xv4azTqerLSD4c58 jJSSyh+ujYHjtCIworNRLq5IFRnjmzepqXzM2jmYdJUjEfr4Zhhw6MJF4I7A686pAi+f JNIG+8CH4p+ckuz1f8xEp1AA5YWj1scPWyrKeecCZLkD01sgg9KfyE2YIRlWyiJVZriM tOyw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=yXtaYCSnMa/mtG+84gRXJtmrASvD1O+JISEPZz9EgGU=; b=JYJTWLzZ+MXsKz6ILY5MNU4SDwH768tXNE6oX1pOfSpKZo8mdAzQTHS0xTs8xAA0Bn kCR5kQPfYfiARrT53rAyAdguwES4IVTUPy01n+0zOjoloE8TZ30Ox2auLEBOheiO99f/ 5CggyBHxAqctNWZA2Rp3ntHxgYayWSS1XKpUoB+GCl/ipbuJWS/RR9y0HFXFtC1U0MPy 9MA5ALZrRnZT3hXm8urddJXVnuEX1VVHW4wc3wlAmAQBbQ0GLE4J3lfDAw7RLnJonAEP a9d4cyUGtYPRV8THxy2WPlH8wIFVIJ2n6qfdYKb990h3xtRaLDw4xQJLXM0WGijQSgd4 WLPA== X-Gm-Message-State: APjAAAUuTS7VqCTD/bGNLael+/hyOow7H2pieXaE0ukZ8MF/Tmc/YPHT 17TnyBZt/AtKBvUZGWh7kXgyOx8lsPo= X-Google-Smtp-Source: APXvYqyQXkVs8dCQ06Xk/ubnSvv8912XTFyPfeTFoO+y4jcpksntMTuLvJVel6XXY5xFzvAucQRTTw== X-Received: by 2002:a05:620a:1225:: with SMTP id v5mr10503412qkj.231.1571423814315; Fri, 18 Oct 2019 11:36:54 -0700 (PDT) From: Daniel Henrique Barboza To: libvir-list@redhat.com Date: Fri, 18 Oct 2019 15:36:34 -0300 Message-Id: <20191018183634.15338-4-danielhb413@gmail.com> In-Reply-To: <20191018183634.15338-1-danielhb413@gmail.com> References: <20191018183634.15338-1-danielhb413@gmail.com> MIME-Version: 1.0 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.6.2 (mx1.redhat.com [10.5.110.66]); Fri, 18 Oct 2019 18:36:55 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.6.2 (mx1.redhat.com [10.5.110.66]); Fri, 18 Oct 2019 18:36:55 +0000 (UTC) for IP:'209.85.222.196' DOMAIN:'mail-qk1-f196.google.com' HELO:'mail-qk1-f196.google.com' FROM:'danielhb413@gmail.com' RCPT:'' X-RedHat-Spam-Score: 0.15 (DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_PASS) 209.85.222.196 mail-qk1-f196.google.com 209.85.222.196 mail-qk1-f196.google.com X-Scanned-By: MIMEDefang 2.84 on 10.5.110.66 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com Cc: Daniel Henrique Barboza , crobinso@redhat.com Subject: [libvirt] [PATCH v3 3/3] qemu_hotplug.c: user-friendlier setvcpus timeout error message 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: , 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.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Fri, 18 Oct 2019 18:37:46 +0000 (UTC) X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" The current 'setvcpus' timeout message requires a deeper understanding of QEMU/Libvirt internals to proper react to it. One who knows how setvcpus unplug work (it is an asynchronous operation between QEMU and guest that Libvirt can't know for sure if it failed, unless an explicit error happened during the timeout period) will read the message and not assume a failed operation. But the regular user, most often than not, will read it and believe that the unplug operation failed. This leads to situations where the user isn't exactly relieved when accessing the guest and seeing that the unplug operation worked. Instead, the user feel mislead by the timeout message setvcpus threw. Changing the timeout message to let the user know that the unplug status is not known, and manual inspection in the guest is required, is not a silver bullet. But it gives a more realistic expectation of what happened, as best as we can tell from Libvirt side anyways. Signed-off-by: Daniel Henrique Barboza --- src/qemu/qemu_hotplug.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c index 32100b140e..72015e02e2 100644 --- a/src/qemu/qemu_hotplug.c +++ b/src/qemu/qemu_hotplug.c @@ -6007,8 +6007,9 @@ qemuDomainHotplugDelVcpu(virQEMUDriverPtr driver, =20 if ((rc =3D qemuDomainWaitForDeviceRemoval(vm)) <=3D 0) { if (rc =3D=3D 0) - virReportError(VIR_ERR_OPERATION_FAILED, "%s", - _("vcpu unplug request timed out")); + virReportError(VIR_ERR_OPERATION_TIMEOUT, "%s", + _("vcpu unplug request timed out. Unplug result= " + "must be manually inspected in the domain")); =20 goto cleanup; } --=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list