From nobody Mon Feb 9 06:32:42 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) client-ip=170.10.129.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1682065530; cv=none; d=zohomail.com; s=zohoarc; b=UKtoWi5a4Pb7G4o/DvA4KJgMRwMepyaIqePl1ZQTeQcPGwtJMKB8WobMEwt3y1XKWheEr011npqn7fr8qEs0zb4Q26GauSB+i5gOj7GLHueNzjWwzGyw8tr1P9nzn8yw4Epg/Ymp8P+cPoW/6IXYOhn91Wneplaj0qUdoaqpRPo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1682065530; h=Content-Type:Content-Transfer-Encoding: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=S74bVJMr0flcqN5PFjOFlyYUYNQuF2kUrCHcMNc/BlM=; b=JqYQlrVnuaqyp/NPyqJMODlY+5uiAG4Q/gSBJv0Xba0ou9wNZki/UW/YS+DVu4CXzJ3fBwW4Xp12JoGm+s2PILbCFIItBmLarShYyaAblgH4AYajg2eUFQtTPXgTY3FkQ51BDcNW3QNKcQg08QBz3NmFJGum4DM266QOm3mzkEQ= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mx.zohomail.com with SMTPS id 1682065530858331.9637772276019; Fri, 21 Apr 2023 01:25:30 -0700 (PDT) Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-265-Td_RN7pwMOmCFCxBlkO80g-1; Fri, 21 Apr 2023 04:25:28 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 7C5E585A588; Fri, 21 Apr 2023 08:25:26 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (unknown [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id 69B68C16024; Fri, 21 Apr 2023 08:25:26 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (localhost [IPv6:::1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 560231946A47; Fri, 21 Apr 2023 08:25:26 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id E279E1946A66 for ; Fri, 21 Apr 2023 08:25:15 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id D84A963A51; Fri, 21 Apr 2023 08:25:15 +0000 (UTC) Received: from localhost.localdomain (unknown [10.43.2.39]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7FBBF63A5D for ; Fri, 21 Apr 2023 08:25:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1682065529; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=S74bVJMr0flcqN5PFjOFlyYUYNQuF2kUrCHcMNc/BlM=; b=gSLf1F+1c3+yWQMY6QhQK4xf7M7Ocs6ar1D6GDsQXCm0p/83+oPvcdJDg7DHN4bQp0vbER XLjt4KVUnMVHhOFR4IfKN8wWZBI7nzqwFHU2E7Ncb0i4c+4YeYbpp6T6IeK2oUHftDAOWe 6If5ebW4pXg2TQDSQIoqTb3WG8ez8NA= X-MC-Unique: Td_RN7pwMOmCFCxBlkO80g-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Michal Privoznik To: libvir-list@redhat.com Subject: [PATCH 06/11] qemuhotplugtest: Call qemuDomainUpdateDeviceLive() directly Date: Fri, 21 Apr 2023 10:25:05 +0200 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.5 X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 3.1 on 10.11.54.8 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1682065532921100001 Content-Type: text/plain; charset="utf-8"; x-default="true" There's no reason for qemuhotplugtest to reimplement which device update function to call (testQemuHotplugUpdate()) when qemuDomainUpdateDeviceLive() already does that. Thus, drop testQemuHotplugUpdate() and call qemuDomainUpdateDeviceLive() directly. BTW: this also shows why reimplementing qemuDomainUpdateDeviceLive() is bad idea: The "disk-cdrom-nochange" test is succeeding only because testQemuHotplugUpdate() supports graphics and returns an (expected) error for every other devtype. NB, there's still missing check that the resulting XML is the expected one (just like we do for attach and detach), but that's pre-existing and will be fixed later. Signed-off-by: Michal Privoznik Reviewed-by: Kristina Hanicova --- tests/qemuhotplugtest.c | 57 +++-------------------------------------- 1 file changed, 3 insertions(+), 54 deletions(-) diff --git a/tests/qemuhotplugtest.c b/tests/qemuhotplugtest.c index e3744964d5..b4c03d5374 100644 --- a/tests/qemuhotplugtest.c +++ b/tests/qemuhotplugtest.c @@ -109,57 +109,6 @@ qemuHotplugCreateObjects(virDomainXMLOption *xmlopt, return 0; } =20 -static int -testQemuHotplugUpdate(virDomainObj *vm, - virDomainDeviceDef *dev) -{ - int ret =3D -1; - - /* XXX Ideally, we would call qemuDomainUpdateDeviceLive here. But th= at - * would require us to provide virConnectPtr and virDomainPtr (they're= used - * in case of updating a disk device. So for now, we will proceed with - * breaking the function into pieces. If we ever learn how to fake tho= se - * required object, we can replace this code then. */ - switch (dev->type) { - case VIR_DOMAIN_DEVICE_GRAPHICS: - ret =3D qemuDomainChangeGraphics(&driver, vm, dev->data.graphics); - break; - - case VIR_DOMAIN_DEVICE_DISK: - case VIR_DOMAIN_DEVICE_LEASE: - case VIR_DOMAIN_DEVICE_FS: - case VIR_DOMAIN_DEVICE_NET: - case VIR_DOMAIN_DEVICE_INPUT: - case VIR_DOMAIN_DEVICE_SOUND: - case VIR_DOMAIN_DEVICE_VIDEO: - case VIR_DOMAIN_DEVICE_HOSTDEV: - case VIR_DOMAIN_DEVICE_WATCHDOG: - case VIR_DOMAIN_DEVICE_CONTROLLER: - case VIR_DOMAIN_DEVICE_HUB: - case VIR_DOMAIN_DEVICE_REDIRDEV: - case VIR_DOMAIN_DEVICE_NONE: - case VIR_DOMAIN_DEVICE_SMARTCARD: - case VIR_DOMAIN_DEVICE_CHR: - case VIR_DOMAIN_DEVICE_MEMBALLOON: - case VIR_DOMAIN_DEVICE_NVRAM: - case VIR_DOMAIN_DEVICE_LAST: - case VIR_DOMAIN_DEVICE_RNG: - case VIR_DOMAIN_DEVICE_TPM: - case VIR_DOMAIN_DEVICE_PANIC: - case VIR_DOMAIN_DEVICE_SHMEM: - case VIR_DOMAIN_DEVICE_MEMORY: - case VIR_DOMAIN_DEVICE_IOMMU: - case VIR_DOMAIN_DEVICE_VSOCK: - case VIR_DOMAIN_DEVICE_AUDIO: - case VIR_DOMAIN_DEVICE_CRYPTO: - VIR_TEST_VERBOSE("device type '%s' cannot be updated", - virDomainDeviceTypeToString(dev->type)); - break; - } - - return ret; -} - static int testQemuHotplugCheckResult(virDomainObj *vm, const char *expected, @@ -300,7 +249,7 @@ testQemuHotplug(const void *data) break; =20 case UPDATE: - ret =3D testQemuHotplugUpdate(vm, dev); + ret =3D qemuDomainUpdateDeviceLive(vm, dev, &driver, false); } =20 virObjectLock(priv->mon); @@ -632,8 +581,8 @@ mymain(void) DO_TEST_UPDATE("x86_64", "graphics-spice-listen-network", "graphics-sp= ice-listen-network-password", false, false, "set_password", QMP_OK, "expire_password", QMP_OK); cfg->spiceTLS =3D false; - /* Strange huh? Currently, only graphics can be updated :-P */ - DO_TEST_UPDATE("x86_64", "disk-cdrom", "disk-cdrom-nochange", true, fa= lse, NULL); + + DO_TEST_UPDATE("x86_64", "disk-cdrom", "disk-cdrom-nochange", false, f= alse, NULL); =20 DO_TEST_ATTACH("x86_64", "console-compat-2-live", "console-virtio", fa= lse, true, "chardev-add", "{\"return\": {\"pty\": \"/dev/pts/26\"}= }", --=20 2.39.2