From nobody Sun Dec 14 06:21:58 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=pass(p=reject dis=none) header.from=lists.libvirt.org ARC-Seal: i=1; a=rsa-sha256; t=1750709280; cv=none; d=zohomail.com; s=zohoarc; b=b3JEm8oL33Rxt+pV61rmZrF44+n34mJVB+r6k3Z4tMqdyiFF3+V/TtopOk3aG62fmwLgUIhE7H6sTIvi9P+Q6UbW+0obce2jSJEbqbkGp92mv4P1Qha3mZWiTuQo4vbn8V/iNP18yoB/MIbBspIamcykuiX6EF6iXHa36+GFxUA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1750709280; h=Content-Type:Content-Transfer-Encoding:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Reply-To:References:Subject:Subject:To:To:Message-Id:Cc; bh=AO40OoyEOZOaFrroJkVtol3vw07XTCX3OTrKeM7k8Jw=; b=ExLBpAP81JCBOrkI1zkE+eNgH/ub2DmM+Y6HfK5DUVvVybfwNqyQcKkDUIuWLDK2kB9JZUxk/kvMcEaRQAcmAgErwE36Y1W0Aanr2etdr3DD75VBwc7gP+A0ymF4VXm1FbAekWmKnRdugj8R4mULSh9DxaB+VZ3RKgS/sd9hvLM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 1750709280496873.7414024149501; Mon, 23 Jun 2025 13:08:00 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 996) id 8DC3394E; Mon, 23 Jun 2025 16:07:59 -0400 (EDT) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id 4242BCAA; Mon, 23 Jun 2025 16:00:13 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 996) id 3DBE1D82; Mon, 23 Jun 2025 16:00:01 -0400 (EDT) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id 440C7128C for ; Mon, 23 Jun 2025 15:59:38 -0400 (EDT) Received: from mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-601-JvzkjOUBNoGxJKjTEV5-Nw-1; Mon, 23 Jun 2025 15:59:36 -0400 Received: from mx-prod-int-04.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-04.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.40]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 5DFD6180120C for ; Mon, 23 Jun 2025 19:59:35 +0000 (UTC) Received: from speedmetal.redhat.com (unknown [10.45.242.5]) by mx-prod-int-04.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 96B8419560AB for ; Mon, 23 Jun 2025 19:59:34 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_INVALID,DKIM_SIGNED, MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H5, RCVD_IN_MSPIKE_WL,RCVD_IN_VALIDITY_RPBL_BLOCKED, RCVD_IN_VALIDITY_SAFE_BLOCKED,SPF_HELO_NONE autolearn=unavailable autolearn_force=no version=3.4.4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1750708777; h=from:from: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; bh=aWVwFVPGuAK6PBacswqJ8IbtjmsaYZMEHX/xbOrzKDo=; b=gFoOEkWt/Y5GGoZd7kf429E6lVlc31mmZKHA0ebw56XE0UdcqACZOS9EoeT5Mhn2Q6jJrG a7YFsfUHosKVNcW1QaM9qevA+G3f1h4H+0jx02oku4litqrwXIXNfYQTOgaE2U/cyPfLYn sPDpQFyULazzInOLjAs4+gn1lVolcOE= X-MC-Unique: JvzkjOUBNoGxJKjTEV5-Nw-1 X-Mimecast-MFC-AGG-ID: JvzkjOUBNoGxJKjTEV5-Nw_1750708775 To: devel@lists.libvirt.org Subject: [PATCH v2 11/13] qemu: monitor: Introduce 'qemuMonitorSetUSBDiskAttached' Date: Mon, 23 Jun 2025 21:59:16 +0200 Message-ID: <8a2d5f9fd556e015e7dd7d4ff480449924b3114e.1750705681.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.40 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: 0fud8lVlnVN-pM9PpAy5P9Hp1BmO7-rdybTnOxTzjAU_1750708775 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Message-ID-Hash: LFHBL5JJCOAZT7Q2YJD3ZBIRXRXTVJZK X-Message-ID-Hash: LFHBL5JJCOAZT7Q2YJD3ZBIRXRXTVJZK X-MailFrom: pkrempa@redhat.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-config-1; header-match-config-2; header-match-config-3; header-match-devel.lists.libvirt.org-0; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; suspicious-header X-Mailman-Version: 3.2.2 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Post: List-Subscribe: List-Unsubscribe: From: Peter Krempa via Devel Reply-To: Peter Krempa X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1750709281097116600 Content-Type: text/plain; charset="utf-8" From: Peter Krempa The helper sets the 'attached' property of the 'usb-bot' device to true, which will be used on the hotplug code path. Signed-off-by: Peter Krempa Reviewed-by: Jiri Denemark --- src/qemu/qemu_monitor.c | 12 ++++++++++++ src/qemu/qemu_monitor.h | 3 +++ src/qemu/qemu_monitor_json.c | 20 ++++++++++++++++++++ src/qemu/qemu_monitor_json.h | 5 +++++ 4 files changed, 40 insertions(+) diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c index d508f50ed6..95c88fd5e8 100644 --- a/src/qemu/qemu_monitor.c +++ b/src/qemu/qemu_monitor.c @@ -2164,6 +2164,18 @@ qemuMonitorSetDBusVMStateIdList(qemuMonitor *mon, } +int +qemuMonitorSetUSBDiskAttached(qemuMonitor *mon, + const char *alias) +{ + QEMU_CHECK_MONITOR(mon); + + VIR_DEBUG("alias=3D%s", alias); + + return qemuMonitorJSONSetUSBDiskAttached(mon, alias); +} + + /** * qemuMonitorGetMigrationParams: * @mon: Pointer to the monitor object. diff --git a/src/qemu/qemu_monitor.h b/src/qemu/qemu_monitor.h index 51b65b4019..6030c31598 100644 --- a/src/qemu/qemu_monitor.h +++ b/src/qemu/qemu_monitor.h @@ -768,6 +768,9 @@ int qemuMonitorSavePhysicalMemory(qemuMonitor *mon, int qemuMonitorSetDBusVMStateIdList(qemuMonitor *mon, GSList *list); +int qemuMonitorSetUSBDiskAttached(qemuMonitor *mon, + const char *alias); + int qemuMonitorGetMigrationParams(qemuMonitor *mon, virJSONValue **params); int qemuMonitorSetMigrationParams(qemuMonitor *mon, diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c index a6fb2a2013..5297ffb027 100644 --- a/src/qemu/qemu_monitor_json.c +++ b/src/qemu/qemu_monitor_json.c @@ -2086,6 +2086,26 @@ qemuMonitorJSONSetDBusVMStateIdList(qemuMonitor *mon, } +/** + * qemuMonitorJSONSetUSBDiskAttached: + * @mon: monitor object + * @alias: alias of usb disk to set + * + * Sets the 'attached' property of @alias to true. + */ +int +qemuMonitorJSONSetUSBDiskAttached(qemuMonitor *mon, + const char *alias) +{ + qemuMonitorJSONObjectProperty prop =3D { + .type =3D QEMU_MONITOR_OBJECT_PROPERTY_BOOLEAN, + .val.b =3D true, + }; + + return qemuMonitorJSONSetObjectProperty(mon, alias, "attached", &prop); +} + + /* qemuMonitorJSONQueryNamedBlockNodes: * @mon: Monitor pointer * diff --git a/src/qemu/qemu_monitor_json.h b/src/qemu/qemu_monitor_json.h index 7f07e55e06..bd437f7938 100644 --- a/src/qemu/qemu_monitor_json.h +++ b/src/qemu/qemu_monitor_json.h @@ -757,6 +757,11 @@ qemuMonitorJSONSetDBusVMStateIdList(qemuMonitor *mon, const char *idstr) ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3); +int +qemuMonitorJSONSetUSBDiskAttached(qemuMonitor *mon, + const char *alias) + ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2); + int qemuMonitorJSONGetCPUMigratable(qemuMonitor *mon, const char *cpuQOMPath, --=20 2.49.0