From nobody Fri Mar 29 13:25:02 2024 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=1685027657; cv=none; d=zohomail.com; s=zohoarc; b=MnE7+9V6XsT9CsA4ojJaeAZ536bO2HNyG2V+eVcrMUFMqMXTVzMTjaJvTfsAIoj88Z02TXIKP7Pvv2aHBNJFSWm2V/t+Mdr3yRQXe9Rks7TA69wPT48VdkV0zAWQNeA/ugwTUSo+fQ/QTgEBUe7dmyAqCfGbdPIYmEQmsP6/o3E= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1685027657; 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=ElvOKXB6pcQqDLcdDr/0AEXQ1OHV+7x6pAZU6NcODZc=; b=IZd0tvuMwoOsCPeu4WAd0md+4PEHdgvYhCo1naoES2j5J3bPSeCpruOgvarhwfkxoShpabmnhsfxM5C9aw5gPcZLCDIrwbr8uuL3SnWHQa0ErXWeb0R+5a3b4ck6J7NFEymEJjYFLSYBYSGM4MgdUjwG8jmi1XN9vgKFS5JqYxY= 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 1685027657914427.8009390825657; Thu, 25 May 2023 08:14:17 -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-75-3-xl_Qw3NP-juIyxTSAumA-1; Thu, 25 May 2023 11:14:13 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 85948803791; Thu, 25 May 2023 15:14:10 +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 B9EEC20296C6; Thu, 25 May 2023 15:14:09 +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 8ABAB19465A4; Thu, 25 May 2023 15:14:09 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id D2D8D19465B7 for ; Thu, 25 May 2023 15:13:48 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 3FDA840107B; Thu, 25 May 2023 15:13:48 +0000 (UTC) Received: from speedmetal.lan (unknown [10.45.242.14]) by smtp.corp.redhat.com (Postfix) with ESMTP id BCEAB492B00 for ; Thu, 25 May 2023 15:13:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1685027656; 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=ElvOKXB6pcQqDLcdDr/0AEXQ1OHV+7x6pAZU6NcODZc=; b=jPc0DIcGkxdgCldJl03/KGTlW2eLFRELkbNGFKDVTC+msk1C7gtW5ji60Fx/JFYfw68HTd mYuu2iXL//20R8vZGZ5j3XfJWE9vv545FvQL+kx+V3XdxjwUN9ezXhtOX5s3LWWuOSTnWl dwQPzhMJemGKUPOxCt4QdlwfYPtzzb8= X-MC-Unique: 3-xl_Qw3NP-juIyxTSAumA-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 01/18] qemuMonitorTestAddItemVerbatim: Simplify cleanup Date: Thu, 25 May 2023 17:13:28 +0200 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.9 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.4 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: 1685027658597100001 Content-Type: text/plain; charset="utf-8" Reformat the JSON string before allocating the test data structure so that we don't have to free it if the reformatting fails. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- tests/qemumonitortestutils.c | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/tests/qemumonitortestutils.c b/tests/qemumonitortestutils.c index 4e99c4b54e..cfe78b258a 100644 --- a/tests/qemumonitortestutils.c +++ b/tests/qemumonitortestutils.c @@ -673,24 +673,21 @@ qemuMonitorTestAddItemVerbatim(qemuMonitorTest *test, const char *response) { struct qemuMonitorTestHandlerData *data; + char *reformatted =3D NULL; + + if (!(reformatted =3D virJSONStringReformat(command, false))) + return -1; data =3D g_new0(struct qemuMonitorTestHandlerData, 1); data->response =3D g_strdup(response); data->cmderr =3D g_strdup(cmderr); - - data->command_name =3D virJSONStringReformat(command, false); - if (!data->command_name) - goto error; + data->command_name =3D g_steal_pointer(&reformatted); return qemuMonitorTestAddHandler(test, command, qemuMonitorTestProcessCommandVerbatim, data, qemuMonitorTestHandlerDataFree); - - error: - qemuMonitorTestHandlerDataFree(data); - return -1; } --=20 2.40.1 From nobody Fri Mar 29 13:25:02 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.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.133.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=1685027783; cv=none; d=zohomail.com; s=zohoarc; b=ErbBzav8rU0tg1P2UAv0eAaKUMqgxyH7yXkFumnY5Rjm+JFmVeHSrMS+oYI6jS6e3JaMqgR+6UcSj71amdbhnQ6qUNeljmZ0y+YWdRPKbqQQxHYE98BzjdNRERy4tbzla/VpQJS0th4aGELPuuUdolv8km/g5cd+SVNcara/ZRg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1685027783; 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=pzfYQCBM5UAhIzh6RETt/0UKqjs99PQ/9T7GC9TyRYg=; b=ZJ+wLtfwwb4QHPsSzQBmp8XR/YIUFsJnLqfiba0zTtg0G5SENIhXI0Leax7774fygkoOfO376fGQHlhOJmCfvRKUp07PSTDPoMlu1k+d7qc+3SZNQT3ase1pPqYskBUqQtYB0Fwggyr8ZpwyX8zOFk9ynFVT1XCk3shr/70cPto= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.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.133.124]) by mx.zohomail.com with SMTPS id 1685027783941785.3187321774469; Thu, 25 May 2023 08:16:23 -0700 (PDT) Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-494-UpFhUMX8PPyKVg5GybOubQ-1; Thu, 25 May 2023 11:16:19 -0400 Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 117B93C11C97; Thu, 25 May 2023 15:16:00 +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 F1EE3492B0C; Thu, 25 May 2023 15:15:59 +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 C9BF519465B2; Thu, 25 May 2023 15:15:59 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id D50C219465B9 for ; Thu, 25 May 2023 15:13:49 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 1426B492B00; Thu, 25 May 2023 15:13:49 +0000 (UTC) Received: from speedmetal.lan (unknown [10.45.242.14]) by smtp.corp.redhat.com (Postfix) with ESMTP id 91ECE48205E for ; Thu, 25 May 2023 15:13:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1685027783; 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=pzfYQCBM5UAhIzh6RETt/0UKqjs99PQ/9T7GC9TyRYg=; b=VTx8goA6PF7Askvnbe/1Nldtcu+zuhAHQhFuYEwkv6+zsJWsArYbs9+DKgTETGVc2m0ZAp oBb8bZZyzZH//jLmxfHRTiDTsob2ei4/7AOIBrYYTb3PiBxBke+kb9j0SAaTm6Q4Gcmjyy /0zjgVfWwh/rwWCPoSGqh7OdhUNVkFM= X-MC-Unique: UpFhUMX8PPyKVg5GybOubQ-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 02/18] qemuMonitorTestAddHandler: Remove return value Date: Thu, 25 May 2023 17:13:29 +0200 Message-Id: <74f3d6a9be3ac3337e7f802ba1fa8018400b966c.1685027511.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.9 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.10 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: 1685027785365100003 Content-Type: text/plain; charset="utf-8" The function always returns 0. Remove the return value and fix callers. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- tests/qemuagenttest.c | 39 ++++++++++++-------------- tests/qemumonitortestutils.c | 54 +++++++++++++++++++++--------------- tests/qemumonitortestutils.h | 2 +- 3 files changed, 49 insertions(+), 46 deletions(-) diff --git a/tests/qemuagenttest.c b/tests/qemuagenttest.c index 7724df2742..7d8c66707d 100644 --- a/tests/qemuagenttest.c +++ b/tests/qemuagenttest.c @@ -475,10 +475,9 @@ testQemuAgentShutdown(const void *data) priv.event =3D QEMU_AGENT_EVENT_SHUTDOWN; priv.mode =3D "halt"; - if (qemuMonitorTestAddHandler(test, "guest-shutdown", - qemuAgentShutdownTestMonitorHandler, - &priv, NULL) < 0) - return -1; + qemuMonitorTestAddHandler(test, "guest-shutdown", + qemuAgentShutdownTestMonitorHandler, + &priv, NULL); if (qemuAgentShutdown(qemuMonitorTestGetAgent(test), QEMU_AGENT_SHUTDOWN_HALT) < 0) @@ -487,10 +486,9 @@ testQemuAgentShutdown(const void *data) priv.event =3D QEMU_AGENT_EVENT_SHUTDOWN; priv.mode =3D "powerdown"; - if (qemuMonitorTestAddHandler(test, "guest-shutdown", - qemuAgentShutdownTestMonitorHandler, - &priv, NULL) < 0) - return -1; + qemuMonitorTestAddHandler(test, "guest-shutdown", + qemuAgentShutdownTestMonitorHandler, + &priv, NULL); if (qemuAgentShutdown(qemuMonitorTestGetAgent(test), QEMU_AGENT_SHUTDOWN_POWERDOWN) < 0) @@ -499,11 +497,10 @@ testQemuAgentShutdown(const void *data) priv.event =3D QEMU_AGENT_EVENT_RESET; priv.mode =3D "reboot"; - if (qemuMonitorTestAddHandler(test, - "guest-shutdown", - qemuAgentShutdownTestMonitorHandler, - &priv, NULL) < 0) - return -1; + qemuMonitorTestAddHandler(test, + "guest-shutdown", + qemuAgentShutdownTestMonitorHandler, + &priv, NULL); if (qemuAgentShutdown(qemuMonitorTestGetAgent(test), QEMU_AGENT_SHUTDOWN_REBOOT) < 0) @@ -691,10 +688,9 @@ testQemuAgentTimeout(const void *data) if (virTestGetExpensive() =3D=3D 0) return EXIT_AM_SKIP; - if (qemuMonitorTestAddHandler(test, NULL, - qemuAgentTimeoutTestMonitorHandler, - NULL, NULL) < 0) - return -1; + qemuMonitorTestAddHandler(test, NULL, + qemuAgentTimeoutTestMonitorHandler, + NULL, NULL); if (qemuAgentFSFreeze(qemuMonitorTestGetAgent(test), NULL, 0) !=3D -1)= { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", @@ -706,11 +702,10 @@ testQemuAgentTimeout(const void *data) if (qemuMonitorTestAddAgentSyncResponse(test) < 0) return -1; - if (qemuMonitorTestAddHandler(test, - NULL, - qemuAgentTimeoutTestMonitorHandler, - NULL, NULL) < 0) - return -1; + qemuMonitorTestAddHandler(test, + NULL, + qemuAgentTimeoutTestMonitorHandler, + NULL, NULL); if (qemuAgentArbitraryCommand(qemuMonitorTestGetAgent(test), "{\"execute\":\"ble\"}", diff --git a/tests/qemumonitortestutils.c b/tests/qemumonitortestutils.c index cfe78b258a..40ef057271 100644 --- a/tests/qemumonitortestutils.c +++ b/tests/qemumonitortestutils.c @@ -441,7 +441,7 @@ qemuMonitorTestFree(qemuMonitorTest *test) } -int +void qemuMonitorTestAddHandler(qemuMonitorTest *test, const char *identifier, qemuMonitorTestResponseCallback cb, @@ -460,8 +460,6 @@ qemuMonitorTestAddHandler(qemuMonitorTest *test, VIR_WITH_MUTEX_LOCK_GUARD(&test->lock) { VIR_APPEND_ELEMENT(test->items, test->nitems, item); } - - return 0; } void * @@ -604,10 +602,12 @@ qemuMonitorTestAddItem(qemuMonitorTest *test, data->command_name =3D g_strdup(command_name); data->response =3D g_strdup(response); - return qemuMonitorTestAddHandler(test, - command_name, - qemuMonitorTestProcessCommandDefault, - data, qemuMonitorTestHandlerDataFree); + qemuMonitorTestAddHandler(test, + command_name, + qemuMonitorTestProcessCommandDefault, + data, qemuMonitorTestHandlerDataFree); + + return 0; } @@ -684,10 +684,12 @@ qemuMonitorTestAddItemVerbatim(qemuMonitorTest *test, data->cmderr =3D g_strdup(cmderr); data->command_name =3D g_steal_pointer(&reformatted); - return qemuMonitorTestAddHandler(test, - command, - qemuMonitorTestProcessCommandVerbatim, - data, qemuMonitorTestHandlerDataFree); + qemuMonitorTestAddHandler(test, + command, + qemuMonitorTestProcessCommandVerbatim, + data, qemuMonitorTestHandlerDataFree); + + return 0; } @@ -732,10 +734,12 @@ qemuMonitorTestAddAgentSyncResponse(qemuMonitorTest *= test) return -1; } - return qemuMonitorTestAddHandler(test, - "agent-sync", - qemuMonitorTestProcessGuestAgentSync, - NULL, NULL); + qemuMonitorTestAddHandler(test, + "agent-sync", + qemuMonitorTestProcessGuestAgentSync, + NULL, NULL); + + return 0; } @@ -841,10 +845,12 @@ qemuMonitorTestAddItemParams(qemuMonitorTest *test, va_end(args); - return qemuMonitorTestAddHandler(test, - cmdname, - qemuMonitorTestProcessCommandWithArgs, - data, qemuMonitorTestHandlerDataFree); + qemuMonitorTestAddHandler(test, + cmdname, + qemuMonitorTestProcessCommandWithArgs, + data, qemuMonitorTestHandlerDataFree); + + return 0; error: va_end(args); @@ -939,10 +945,12 @@ qemuMonitorTestAddItemExpect(qemuMonitorTest *test, } } - return qemuMonitorTestAddHandler(test, - cmdname, - qemuMonitorTestProcessCommandWithArgS= tr, - data, qemuMonitorTestHandlerDataFree); + qemuMonitorTestAddHandler(test, + cmdname, + qemuMonitorTestProcessCommandWithArgStr, + data, qemuMonitorTestHandlerDataFree); + + return 0; } diff --git a/tests/qemumonitortestutils.h b/tests/qemumonitortestutils.h index ffcb32a5cc..df0d544720 100644 --- a/tests/qemumonitortestutils.h +++ b/tests/qemumonitortestutils.h @@ -30,7 +30,7 @@ typedef int (*qemuMonitorTestResponseCallback)(qemuMonito= rTest *test, qemuMonitorTestItem *item, const char *message); -int +void qemuMonitorTestAddHandler(qemuMonitorTest *test, const char *identifier, qemuMonitorTestResponseCallback cb, --=20 2.40.1 From nobody Fri Mar 29 13:25:02 2024 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=1685027894; cv=none; d=zohomail.com; s=zohoarc; b=a0rjth1UTkn6EBO01XvXMwQOwfenCDnIYZGOY3OOsNYo1YkUOiaR4q8PIi5Z5uyNLFIdx6GeuUlWDnnjuCfrlaTEF3TZYgZBW+0fXUvXVPvSRn7Od+ndK4Cp9tc8G2pySKBK1yP5psyt0c9gAldtyKSwWitVBSjWL4i94QEEN6c= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1685027894; 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=qZRAAdZ+LLpMa2EZVicg7FCW4nfIdMcm/lzrmpiTbMM=; b=eg77ON3aITMy0YEHiXKN3hse3gX3M8mHxfWJD5oyaRY9x/yV9TKGfq7X3rflQ4tUAB5akVYQjEYf7j7qqW4TMb0h5d//jUNAngpVFpZneNvgMdMhNr35i+gjmWkHAShPsyMye60zDergZVcJylG8qGMCXYuX/PM1ZMeg6C+OVRE= 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 1685027894273727.344245011683; Thu, 25 May 2023 08:18:14 -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-480-04CoILGLPKuyjtIeE1D_HQ-1; Thu, 25 May 2023 11:15:54 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id B6D2D1012BA3; Thu, 25 May 2023 15:15:30 +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 A125B2023452; Thu, 25 May 2023 15:15:30 +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 1876219465BA; Thu, 25 May 2023 15:15:30 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id CE50819465B3 for ; Thu, 25 May 2023 15:13:49 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id E485940140A; Thu, 25 May 2023 15:13:49 +0000 (UTC) Received: from speedmetal.lan (unknown [10.45.242.14]) by smtp.corp.redhat.com (Postfix) with ESMTP id 6AC7A401026 for ; Thu, 25 May 2023 15:13:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1685027893; 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=qZRAAdZ+LLpMa2EZVicg7FCW4nfIdMcm/lzrmpiTbMM=; b=Qc1fSzzmnOPK86zS9pD/+u+rvCjyrTiH1Y+iXzEt0ppoc2GZMikrrDI63YV7EtOViZ+csv LnP2f6CeUNbJHxTcI1PzG5VwBfw3hBN0LEv6GPfX8xn8ZWYZgeslvbXb8pbfsFqluH5IVD 3F1eeaxW0YtY3EnwY12opYyo6ttcCYw= X-MC-Unique: 04CoILGLPKuyjtIeE1D_HQ-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 03/18] virRaiseErrorLog: Don't skip error printing when enabling debug logging env variable Date: Thu, 25 May 2023 17:13:30 +0200 Message-Id: <717f7bd450f1dbe6f1284fc4afdd73de8638ce8e.1685027511.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.9 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.4 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: 1685027895046100001 Content-Type: text/plain; charset="utf-8" When a user requests debug logging by setting the environment variable: LIBVIRT_DEBUG=3D1 we should log any errors regardless of the setting of e.g. 'LIBVIRT_LOG_OUTPUTS' as the code will log every 'debug' and 'info' level message to stderr but will skip 'error' level messages. This obviously makes debugging things very complicated as you can get to a situation when the error itself is missing. This can happen e.g. in tests. Fix the issue by probing the default log level and calling the logger if it's set for VIR_LOG_DEBUG. Signed-off-by: Peter Krempa --- src/util/virerror.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/util/virerror.c b/src/util/virerror.c index 0bfa803b1f..453f19514e 100644 --- a/src/util/virerror.c +++ b/src/util/virerror.c @@ -775,9 +775,11 @@ void virRaiseErrorLog(const char *filename, * hate & thus disable that too. If the daemon has set * a priority filter though, we should always forward * all errors to the logging code. + * Similarly when debug priority is the default we want to log the err= or. */ if (virLogGetNbOutputs() > 0 || - virErrorLogPriorityFilter) + virErrorLogPriorityFilter || + virLogGetDefaultPriority() =3D=3D VIR_LOG_DEBUG) virLogMessage(&virLogSelf, priority, filename, linenr, funcname, --=20 2.40.1 From nobody Fri Mar 29 13:25:02 2024 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=1685027821; cv=none; d=zohomail.com; s=zohoarc; b=P+yGkl8W41LkePBGMhsUrQkY0xB2JuykXbip2Ifox/4s16gdpUcR7D3kwASrQ2tK+OSxTXWjmlj3ydMBdbMjZkBCUUphdpExijEIwbN2qUZVwWXZucynVZQkBa/TKQbY/xfyXXt3To3Ux3y+zvXPHI+1FYQAMnsmcvRALODtr9E= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1685027821; 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=K9DETZEAlSf6ChDSHRfpZAtLhGfTWsWFv49ZlmPatB8=; b=HooUC8WAsUkjUqXmyinmDMjxwhse8YMMHvDnm2XM0Dyu0+ae0oXheb1JzDlCzXzENar7gG/BoK+vwWjeddb/5LTZy1+0QTO/QoebjeT97JRxgVnsbVUE0t3SbRW3zfIvEZ2Kd6L5Pc0bJBot+CGzR0q16k3mQE9kuct3nE98xrw= 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 1685027821102353.3155745967765; Thu, 25 May 2023 08:17:01 -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-473-CITaJi3dPyy8R-iH1zzouw-1; Thu, 25 May 2023 11:16:56 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 59B99101B057; Thu, 25 May 2023 15:16:25 +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 46B0C40C6CCF; Thu, 25 May 2023 15:16:25 +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 14D5319465A4; Thu, 25 May 2023 15:16:25 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id D09D119465B6 for ; Thu, 25 May 2023 15:13:50 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id C2656401026; Thu, 25 May 2023 15:13:50 +0000 (UTC) Received: from speedmetal.lan (unknown [10.45.242.14]) by smtp.corp.redhat.com (Postfix) with ESMTP id 48D4741F2CC for ; Thu, 25 May 2023 15:13:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1685027820; 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=K9DETZEAlSf6ChDSHRfpZAtLhGfTWsWFv49ZlmPatB8=; b=TR3HaEZmyn0/hUOI/4pvmRVHgbh22DpRw8w44vRSZjavPnvHAmYpz8GIVce5GL3vULUfb9 H2S6TLTs7upK4DvffOGOnoDdhlOByc9supxVaF/q9RoD/v82bEFAcxEf2rkXvUXm0acCID RJ1cnV9/F7T6JBPf4hIvQ5npB6cxEbU= X-MC-Unique: CITaJi3dPyy8R-iH1zzouw-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 04/18] testQemuMonitorJSONAttachChardev: Move all setup code under virTestRun Date: Thu, 25 May 2023 17:13:31 +0200 Message-Id: <87b940f85ef50a7e3711efa536ae867cc72abed6.1685027511.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.9 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.2 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: 1685027822765100001 Content-Type: text/plain; charset="utf-8" Any failure which happens outside is hard to debug as errors will be reset and not raised. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- tests/qemumonitorjsontest.c | 60 ++++++++++++++++++------------------- 1 file changed, 29 insertions(+), 31 deletions(-) diff --git a/tests/qemumonitorjsontest.c b/tests/qemumonitorjsontest.c index 1db1f2b949..3dabd5c00d 100644 --- a/tests/qemumonitorjsontest.c +++ b/tests/qemumonitorjsontest.c @@ -596,19 +596,35 @@ testQemuMonitorJSONGetTPMModels(const void *opaque) struct qemuMonitorJSONTestAttachChardevData { - qemuMonitorTest *test; virDomainChrSourceDef *chr; const char *expectPty; bool fail; + + virDomainXMLOption *xmlopt; + GHashTable *schema; + const char *expectargs; + const char *reply; }; static int testQemuMonitorJSONAttachChardev(const void *opaque) { const struct qemuMonitorJSONTestAttachChardevData *data =3D opaque; + g_autoptr(qemuMonitorTest) test =3D qemuMonitorTestNewSchema(data->xml= opt, data->schema); int rc; - if ((rc =3D qemuMonitorAttachCharDev(qemuMonitorTestGetMonitor(data->t= est), + if (!test) + return -1; + + if (data->expectargs) { + g_autofree char *jsonreply =3D g_strdup_printf("{\"return\": {%s}}= ", NULLSTR_EMPTY(data->reply)); + + if (qemuMonitorTestAddItemExpect(test, "chardev-add", + data->expectargs, true, jsonreply= ) < 0) + return -1; + } + + if ((rc =3D qemuMonitorAttachCharDev(qemuMonitorTestGetMonitor(test), "alias", data->chr)) < 0) goto cleanup; @@ -643,37 +659,19 @@ qemuMonitorJSONTestAttachOneChardev(virDomainXMLOptio= n *xmlopt, bool fail) { - struct qemuMonitorJSONTestAttachChardevData data =3D {0}; - g_autoptr(qemuMonitorTest) test =3D qemuMonitorTestNewSchema(xmlopt, s= chema); - g_autofree char *jsonreply =3D NULL; - g_autofree char *fulllabel =3D NULL; - - if (!test) - return -1; - - if (!reply) - reply =3D ""; - - jsonreply =3D g_strdup_printf("{\"return\": {%s}}", reply); - - fulllabel =3D g_strdup_printf("qemuMonitorJSONTestAttachChardev(%s)", = label); - - if (expectargs && - qemuMonitorTestAddItemExpect(test, "chardev-add", - expectargs, true, jsonreply) < 0) - return -1; - - data.chr =3D chr; - data.fail =3D fail; - data.expectPty =3D expectPty; - data.test =3D test; - - if (virTestRun(fulllabel, &testQemuMonitorJSONAttachChardev, &data) < = 0) - return -1; - - return 0; + struct qemuMonitorJSONTestAttachChardevData data =3D { .chr =3D chr, + .fail =3D fail, + .expectPty =3D ex= pectPty, + .expectargs =3D e= xpectargs, + .reply =3D reply, + .xmlopt =3D xmlop= t, + .schema =3D schem= a }; + g_autofree char *fulllabel =3D g_strdup_printf("qemuMonitorJSONTestAtt= achChardev(%s)", label); + + return virTestRun(fulllabel, &testQemuMonitorJSONAttachChardev, &data); } + static int qemuMonitorJSONTestAttachChardev(virDomainXMLOption *xmlopt, GHashTable *schema) --=20 2.40.1 From nobody Fri Mar 29 13:25:02 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.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.133.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=1685027779; cv=none; d=zohomail.com; s=zohoarc; b=R8CLuCdG2logrNtr4EH6hNq6V/Rp4OsZ8r1IZVvkwM14ihzIei6QIQElfwr6v8sZ8B2rcvwDjR3IyzEVcsLwu5oWzkcjcxKj0SwAPNbn8TElzXz3sH3m3WU8iflxtscYlkWxgHWeFJ8Fz8lYjd+DVfYTnyMrom9tydBh/Y43BBA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1685027779; 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=kpR9tFWUp+s6BHy2BPSnmgaDSygDPHzWR4m7wGBKFa4=; b=niKIdlw6ZLyDxqDBF19jaVR8LCoF/z+upLRK4tuxwdRKRwBFFPHXENFn3smkXveNofL7cWNrGc0M2aQhQapAGwPN0G1Fvg71bz0VeEMdOLFKO2cJooeXvrnTUH2bAakWBECciLA9tihbO4fm2R8BIFxVUeBCk1sipon4lP2X30Y= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.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.133.124]) by mx.zohomail.com with SMTPS id 1685027779783162.4360648717062; Thu, 25 May 2023 08:16:19 -0700 (PDT) Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-436-DX3ajmR5NqayJeQJsxC2ZA-1; Thu, 25 May 2023 11:16:01 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id E6D4E38035AD; Thu, 25 May 2023 15:15:29 +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 D24631121314; Thu, 25 May 2023 15:15:29 +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 8FD9C19465A4; Thu, 25 May 2023 15:15:29 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 02FD119465B2 for ; Thu, 25 May 2023 15:14:02 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id A14A848205E; Thu, 25 May 2023 15:13:51 +0000 (UTC) Received: from speedmetal.lan (unknown [10.45.242.14]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2ADBF482060 for ; Thu, 25 May 2023 15:13:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1685027778; 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=kpR9tFWUp+s6BHy2BPSnmgaDSygDPHzWR4m7wGBKFa4=; b=irHcAKx71YjKYMdzNxjnO0DyTYsFFFUwE2T2gDfJEi+2go3feObCa+DS+74csXeb+utPIs v4mnBlrgSj6atoo2DPE/2m5EpE3FRo/82v6heWTz/+ATYHUIdbSLD3+IcGVpitfjkFFSOg xcUEnQZQFkBaSpo66lYtyA0bGxpj7D4= X-MC-Unique: DX3ajmR5NqayJeQJsxC2ZA-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 05/18] qemuMonitorJSONTestAttachOneChardev: Rewrite using qemuMonitorTestAddItemVerbatim Date: Thu, 25 May 2023 17:13:32 +0200 Message-Id: <6a4edbbdc08be8a62998213452d2a8f8027720bd.1685027511.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.9 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.3 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: 1685027780337100001 Content-Type: text/plain; charset="utf-8" 'qemuMonitorTestAddItemExpect' doesn't do QMP schema validation. Since it's the only use we can reimplement it using 'qemuMonitorTestAddItemVerbat= im' which does schema validation and remove the old code instead. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- tests/qemumonitorjsontest.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/tests/qemumonitorjsontest.c b/tests/qemumonitorjsontest.c index 3dabd5c00d..f6b6da372c 100644 --- a/tests/qemumonitorjsontest.c +++ b/tests/qemumonitorjsontest.c @@ -618,9 +618,18 @@ testQemuMonitorJSONAttachChardev(const void *opaque) if (data->expectargs) { g_autofree char *jsonreply =3D g_strdup_printf("{\"return\": {%s}}= ", NULLSTR_EMPTY(data->reply)); + g_autofree char *jsoncommand =3D NULL; + char *n; - if (qemuMonitorTestAddItemExpect(test, "chardev-add", - data->expectargs, true, jsonreply= ) < 0) + jsoncommand =3D g_strdup_printf("{\"execute\": \"chardev-add\", \"= arguments\": %s, \"id\" : \"libvirt-1\"}", data->expectargs); + + /* data->expectargs has ' instead of " */ + for (n =3D jsoncommand; *n; n++) { + if (*n =3D=3D '\'') + *n =3D '"'; + } + + if (qemuMonitorTestAddItemVerbatim(test, jsoncommand, NULL, jsonre= ply) < 0) return -1; } --=20 2.40.1 From nobody Fri Mar 29 13:25:02 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.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.133.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=1685027782; cv=none; d=zohomail.com; s=zohoarc; b=Y3BFlA8Yx4FXck3osG02PZ3YEhQQYQnZNZbE6CicImwEJDLz+mgsi2jEyyXm2c+fkCDuyyS1TekkvUygLBbiz+kwbB9fxKRzvZzTKWqn3Qe1FyIKehH8EFwiRTBIply1edglJQWh9O993sVfmqsUm9kOHlpAFVTHyf6ul4u3Yso= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1685027782; 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=81wRAq4nhZW7UtVRIQvDFvStxqsfACjc1EGkq38GCnI=; b=WgAlvEAhob/NjJ5jNZP0NWsCIEh/8bkHTe9bPToDI1KhzjItKCpRvPwIrwbyk89IN5yldf8xYldIZtBR/l4cfmnMFdpqbSpFTKCzGOlFSONhwHKcI2F0Dx+NJorwF9ZvTiHurpJnwvPEFaIi2X8gF7zqI3dPaKVTCSbAX0z9P0c= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.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.133.124]) by mx.zohomail.com with SMTPS id 1685027782876131.5504685903736; Thu, 25 May 2023 08:16:22 -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-318-mjimWsRiM3e4IdFnzGjSKA-1; Thu, 25 May 2023 11:16:07 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 52FC4100EE5C; Thu, 25 May 2023 15:15:36 +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 400901121314; Thu, 25 May 2023 15:15:36 +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 10D6919465B2; Thu, 25 May 2023 15:15:33 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 032AC19465B3 for ; Thu, 25 May 2023 15:14:02 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 78496482060; Thu, 25 May 2023 15:13:52 +0000 (UTC) Received: from speedmetal.lan (unknown [10.45.242.14]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0235F40D1C0 for ; Thu, 25 May 2023 15:13:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1685027781; 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=81wRAq4nhZW7UtVRIQvDFvStxqsfACjc1EGkq38GCnI=; b=S9UWfsIVo0h7rDE94cSNLVW8hgMnmYm0EuFWOlN1EhZodXk4cYkCcMRs8t4afehHhQels5 RvrgQMs89JW1ZJj+ef4kgCyM1/6WXTfIh8Qmv1sIl4JI1HG0cjgb9n2LHTF9K6B7OB74GH MHmq2M01540R23dJfq4YMRkTlTU/F7U= X-MC-Unique: mjimWsRiM3e4IdFnzGjSKA-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 06/18] qemuMonitorTestAddItemExpect: Remove unused helper Date: Thu, 25 May 2023 17:13:33 +0200 Message-Id: <76f5b1f09cdb863f9c3cd304a1b7398cede22746.1685027511.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.9 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.3 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: 1685027784332100001 Content-Type: text/plain; charset="utf-8" Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- tests/qemumonitortestutils.c | 95 ------------------------------------ tests/qemumonitortestutils.h | 7 --- 2 files changed, 102 deletions(-) diff --git a/tests/qemumonitortestutils.c b/tests/qemumonitortestutils.c index 40ef057271..9e6da78a8b 100644 --- a/tests/qemumonitortestutils.c +++ b/tests/qemumonitortestutils.c @@ -859,101 +859,6 @@ qemuMonitorTestAddItemParams(qemuMonitorTest *test, } -static int -qemuMonitorTestProcessCommandWithArgStr(qemuMonitorTest *test, - qemuMonitorTestItem *item, - const char *cmdstr) -{ - struct qemuMonitorTestHandlerData *data =3D item->opaque; - g_autoptr(virJSONValue) val =3D NULL; - virJSONValue *args; - g_autofree char *argstr =3D NULL; - const char *cmdname; - - if (!(val =3D virJSONValueFromString(cmdstr))) - return -1; - - if (!(cmdname =3D virJSONValueObjectGetString(val, "execute"))) { - qemuMonitorTestError("Missing command name in %s", cmdstr); - return -1; - } - - if (STRNEQ(data->command_name, cmdname)) { - qemuMonitorTestErrorInvalidCommand(data->command_name, cmdname); - return -1; - } - - if (!(args =3D virJSONValueObjectGet(val, "arguments"))) { - qemuMonitorTestError("Missing arguments section for command '%s'", - data->command_name); - return -1; - } - - /* convert the arguments to string */ - if (!(argstr =3D virJSONValueToString(args, false))) - return -1; - - /* verify that the argument value is expected */ - if (STRNEQ(argstr, data->expectArgs)) { - qemuMonitorTestError("%s: expected arguments: '%s', got: '%s'", - data->command_name, - data->expectArgs, argstr); - return -1; - } - - /* arguments checked out, return the response */ - return qemuMonitorTestAddResponse(test, data->response); -} - - -/** - * qemuMonitorTestAddItemExpect: - * - * @test: test monitor object - * @cmdname: command name - * @cmdargs: expected arguments of the command - * @apostrophe: convert apostrophes (') in @cmdargs to quotes (") - * @response: simulated response of the command - * - * Simulates a qemu monitor command. Checks that the 'arguments' of the qmp - * command are expected. If @apostrophe is true apostrophes are converted = to - * quotes for simplification of writing the strings into code. - */ -int -qemuMonitorTestAddItemExpect(qemuMonitorTest *test, - const char *cmdname, - const char *cmdargs, - bool apostrophe, - const char *response) -{ - struct qemuMonitorTestHandlerData *data; - - data =3D g_new0(struct qemuMonitorTestHandlerData, 1); - - data->command_name =3D g_strdup(cmdname); - data->response =3D g_strdup(response); - data->expectArgs =3D g_strdup(cmdargs); - - if (apostrophe) { - char *tmp =3D data->expectArgs; - - while (*tmp !=3D '\0') { - if (*tmp =3D=3D '\'') - *tmp =3D '"'; - - tmp++; - } - } - - qemuMonitorTestAddHandler(test, - cmdname, - qemuMonitorTestProcessCommandWithArgStr, - data, qemuMonitorTestHandlerDataFree); - - return 0; -} - - static void qemuMonitorTestEOFNotify(qemuMonitor *mon G_GNUC_UNUSED, virDomainObj *vm G_GNUC_UNUSED) diff --git a/tests/qemumonitortestutils.h b/tests/qemumonitortestutils.h index df0d544720..5de55172be 100644 --- a/tests/qemumonitortestutils.h +++ b/tests/qemumonitortestutils.h @@ -81,13 +81,6 @@ qemuMonitorTestAddItemParams(qemuMonitorTest *test, ...) G_GNUC_NULL_TERMINATED; -int -qemuMonitorTestAddItemExpect(qemuMonitorTest *test, - const char *cmdname, - const char *cmdargs, - bool apostrophe, - const char *response); - #define qemuMonitorTestNewSimple(xmlopt) \ qemuMonitorTestNew(xmlopt, NULL, NULL, NULL) #define qemuMonitorTestNewSchema(xmlopt, schema) \ --=20 2.40.1 From nobody Fri Mar 29 13:25:02 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.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.133.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=1685027762; cv=none; d=zohomail.com; s=zohoarc; b=ISR7G7vBGBkb1ImXcug/4B3qNYQrZHrVgBGJMdCeeaIOSie7Y1GyAQsCjnMMmevsW8MumlsNC+FcRyR/8KWOpK+Ut7iPS31cPjFSt/kHgPJwVWmBBJEOaTWG3DsnPYCSzaLXk8AGPvSkwnGI1ocoVaKGuFZOFFm5h9oPtIf14nI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1685027762; 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=lLpEP+omRREqak2PS/4g8bqHZLGH/R3Fpz5grLM/dn8=; b=mvPrAzz1A9c6wt0Ezdnm1CH9cK7i5CPYZC/zpyQb5UeAv7K+ki+SZWpXCflxF0gfkFoBE8ZQu1LggPWzL1yheVhoxh9HTRJDoxTTzplJKZNcFLrgrQv6CTt0VItHyagp5TVo0JdBdR9i1LhWPxv6LaNYu7f+Q3IXn9pI63xntuU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.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.133.124]) by mx.zohomail.com with SMTPS id 1685027762949349.16871938560575; Thu, 25 May 2023 08:16:02 -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-126-md7XI3S3OLyYn5xFMK9Olg-1; Thu, 25 May 2023 11:15:55 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id A741B811764; Thu, 25 May 2023 15:15:35 +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 9288420296C6; Thu, 25 May 2023 15:15:35 +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 8999B19452C1; Thu, 25 May 2023 15:15:30 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 0616B19465BA for ; Thu, 25 May 2023 15:14:02 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 50C46482064; Thu, 25 May 2023 15:13:53 +0000 (UTC) Received: from speedmetal.lan (unknown [10.45.242.14]) by smtp.corp.redhat.com (Postfix) with ESMTP id CFC9E40D1C0 for ; Thu, 25 May 2023 15:13:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1685027762; 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=lLpEP+omRREqak2PS/4g8bqHZLGH/R3Fpz5grLM/dn8=; b=TjkBTKqGlbqoQpT0mOmGM/rCo2MBZTY+khZ4ZRQR6YIi00UnQlA5qmuDL26BFeTabaD7+Z kPXJ+FiJgB8HEIS+pxibCR9+PB6sc9x5PbUQ7fHoQe/Q28YeKEsvNGMV3/D8tPzxojxGiH BgZr2yeY5odOazXMwqwxBWQ9Tgw0ruE= X-MC-Unique: md7XI3S3OLyYn5xFMK9Olg-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 07/18] testQemuAgentCPU: Rewrite using qemuMonitorTestAddItemVerbatim Date: Thu, 25 May 2023 17:13:34 +0200 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.9 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.4 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: 1685027763490100003 Content-Type: text/plain; charset="utf-8" Replace qemuMonitorTestAddItemParams by qemuMonitorTestAddItemVerbatim Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- tests/qemuagenttest.c | 48 +++++++++++++++++++++---------------------- 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/tests/qemuagenttest.c b/tests/qemuagenttest.c index 7d8c66707d..04faf7b83a 100644 --- a/tests/qemuagenttest.c +++ b/tests/qemuagenttest.c @@ -552,16 +552,6 @@ static const char testQemuAgentCPUResponse[] =3D " ]" "}"; -static const char testQemuAgentCPUArguments1[] =3D - "[{\"logical-id\":1,\"online\":false}]"; - -static const char testQemuAgentCPUArguments2[] =3D - "[{\"logical-id\":1,\"online\":true}," - "{\"logical-id\":3,\"online\":true}]"; - -static const char testQemuAgentCPUArguments3[] =3D - "[{\"logical-id\":3,\"online\":true}]"; - static int testQemuAgentCPU(const void *data) { @@ -595,26 +585,36 @@ testQemuAgentCPU(const void *data) if (qemuAgentUpdateCPUInfo(2, cpuinfo, nvcpus) < 0) return -1; - if (qemuMonitorTestAddItemParams(test, "guest-set-vcpus", - "{ \"return\" : 1 }", - "vcpus", testQemuAgentCPUArguments1, - NULL) < 0) + if (qemuMonitorTestAddItemVerbatim(test, + "{\"execute\":\"guest-set-vcpus\"," + " \"arguments\": {" + " \"vcpus\":[{\"logical-id\":1,= \"online\":false}]" + "}}", + NULL, + "{ \"return\" : 1 }") < 0) return -1; if (qemuAgentSetVCPUs(qemuMonitorTestGetAgent(test), cpuinfo, nvcpus) = < 0) return -1; /* try to hotplug two, second one will fail */ - if (qemuMonitorTestAddItemParams(test, "guest-set-vcpus", - "{ \"return\" : 1 }", - "vcpus", testQemuAgentCPUArguments2, - NULL) < 0) - return -1; - - if (qemuMonitorTestAddItemParams(test, "guest-set-vcpus", - "{ \"error\" : \"random error\" }", - "vcpus", testQemuAgentCPUArguments3, - NULL) < 0) + if (qemuMonitorTestAddItemVerbatim(test, + "{\"execute\":\"guest-set-vcpus\"," + " \"arguments\": {" + " \"vcpus\":[{\"logical-id\":1,= \"online\":true}," + " {\"logical-id\":3,= \"online\":true}]" + "}}", + NULL, + "{ \"return\" : 1 }") < 0) + return -1; + + if (qemuMonitorTestAddItemVerbatim(test, + "{\"execute\":\"guest-set-vcpus\"," + " \"arguments\": {" + " \"vcpus\":[{\"logical-id\":3,= \"online\":true}]" + "}}", + NULL, + "{ \"error\" : \"random error\" }")= < 0) return -1; if (qemuAgentUpdateCPUInfo(4, cpuinfo, nvcpus) < 0) --=20 2.40.1 From nobody Fri Mar 29 13:25:02 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.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.133.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=1685027802; cv=none; d=zohomail.com; s=zohoarc; b=gW1XXn6R/skDGi5zQg3GeOlT0+Z5IZzF7uwY0H2yE3FT9jRaINleRR8onpMl7gohPFjZmjvEzOCFOhZcsYQ/oDylS9/LF/a3CgHcWwc2OjYsTxGeE9jQnaXH31XpzBqKrQomPImZt94PNc6b77ZJhFq6eKQiGtMi5lptozKyJeo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1685027802; 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=22SjwrmW+vcYQ7bniMwLxtKmPVFfrrw5dzkSNhnvGOE=; b=R/EQKJBrW7BIY95Mut4sIvEVo+yhFdAR2kiHBgtlihorFCHI5kjHxCcD93ahtrRrDKXY7pKtDy4Kl7uPm1GyGrv1cnVtSp9vhsk+WQ8wUJOTKZkrALD8NJxHav2y85TccVIyTuDWVUnNUCjrwvwtqEX21j7N2eGlo0Uk3mtfPA8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.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.133.124]) by mx.zohomail.com with SMTPS id 1685027802793416.596239408167; Thu, 25 May 2023 08:16:42 -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-106-DnEX4lOUNWmKP-WnYtki2A-1; Thu, 25 May 2023 11:16:32 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 905E2857A8D; Thu, 25 May 2023 15:16: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 74A472023434; Thu, 25 May 2023 15:16: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 9526019452C4; Thu, 25 May 2023 15:16:25 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 0658A19465BB for ; Thu, 25 May 2023 15:14:02 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 2578A482063; Thu, 25 May 2023 15:13:54 +0000 (UTC) Received: from speedmetal.lan (unknown [10.45.242.14]) by smtp.corp.redhat.com (Postfix) with ESMTP id A23D540D1C0 for ; Thu, 25 May 2023 15:13:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1685027801; 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=22SjwrmW+vcYQ7bniMwLxtKmPVFfrrw5dzkSNhnvGOE=; b=bCr1sFf0pJoCRR57PbTebVX26y7RkAgu7PESdVc7C/62Vcmrk9nyplFLXk0kzQaHARTxch 5F05VoioBVy8ktsVn+16Ht65nB0uCTPdE1Ar0HZwB/vZINAg9/7tvDkWQpCX54WC6lTRgf eNsoPnPJuepD/hdPvw3qda2nxox4Fa8= X-MC-Unique: DnEX4lOUNWmKP-WnYtki2A-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 08/18] testQemuAgentFSTrim: Rewrite using qemuMonitorTestAddItemVerbatim Date: Thu, 25 May 2023 17:13:35 +0200 Message-Id: <1523a185fd2684a174f2a4789b4d63f109427e76.1685027511.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.9 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.4 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: 1685027803493100001 Content-Type: text/plain; charset="utf-8" Replace qemuMonitorTestAddItemParams by qemuMonitorTestAddItemVerbatim Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- tests/qemuagenttest.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/tests/qemuagenttest.c b/tests/qemuagenttest.c index 04faf7b83a..3c24a3139f 100644 --- a/tests/qemuagenttest.c +++ b/tests/qemuagenttest.c @@ -197,10 +197,11 @@ testQemuAgentFSTrim(const void *data) if (qemuMonitorTestAddAgentSyncResponse(test) < 0) return -1; - if (qemuMonitorTestAddItemParams(test, "guest-fstrim", - "{ \"return\" : {} }", - "minimum", "1337", - NULL) < 0) + if (qemuMonitorTestAddItemVerbatim(test, + "{\"execute\":\"guest-fstrim\"," + " \"arguments\": {\"minimum\":1337}= }", + NULL, + "{ \"return\" : {}}") < 0) return -1; if (qemuAgentFSTrim(qemuMonitorTestGetAgent(test), 1337) < 0) --=20 2.40.1 From nobody Fri Mar 29 13:25:02 2024 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=1685027831; cv=none; d=zohomail.com; s=zohoarc; b=BXBTm9x5aGFrIt+jei2BENTk2anIFQ9rSMQtw8BBDkGQTzSLhHJHpBppF6bCWGzT4/VwDOWDJDjjl25zo0gNsl9Rn/Su0B4PQpJCKLofuaSkn8q2uC0yVFwXvAIvPddn1EmaI05719vwXD7rJqki5DvRbH/vLkMWrXJYrglkVyo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1685027831; 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=El5zkaZaXH9Z5otzPtlFGy2P2AdzV7qLeno7WevaNqE=; b=Y/eewxJFXsQnxDpnCuGP+5lNBbRJr3jgUUOZDh6qfp1BMWVoZZw1OM7XMgbLfnwFd2iCzUl06kNjXIRrcKfG5s4J+jBqDD/RLVpJkSNniiN+uMqV5gRyv/LinUu+UBCVGjMl6wOLIPGynmKgck99/23Uso+BHVUWKwPQvPoFjHo= 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 1685027831862153.67406970089382; Thu, 25 May 2023 08:17:11 -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-62-4aA74r4CO76mKYFcj5CVtQ-1; Thu, 25 May 2023 11:15:55 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id B1EBC185A7AB; Thu, 25 May 2023 15:15:31 +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 9F0191121314; Thu, 25 May 2023 15:15:31 +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 4FF5019452CC; Thu, 25 May 2023 15:15:30 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 0686319465BC for ; Thu, 25 May 2023 15:14:02 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id F104C482068; Thu, 25 May 2023 15:13:54 +0000 (UTC) Received: from speedmetal.lan (unknown [10.45.242.14]) by smtp.corp.redhat.com (Postfix) with ESMTP id 75F65482065 for ; Thu, 25 May 2023 15:13:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1685027830; 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=El5zkaZaXH9Z5otzPtlFGy2P2AdzV7qLeno7WevaNqE=; b=H9R/Gkuqn5MNrW63cx1HLz6TlPf3AZS+iJXeZFD5g0faOk+L9UXhMs2iEuOaixWQF24aU6 c4MvRSsRX5ztMksiRpAKrYWwnQguSrqDxskNkM9dj8itTeGwb49CM7dE4oSzyPgzdKPO++ BK3C7rKRXFBUboTy//I2oQZnRzL/dfo= X-MC-Unique: 4aA74r4CO76mKYFcj5CVtQ-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 09/18] testQemuMonitorJSONqemuMonitorJSONSendKeyHoldtime: Rewrite using qemuMonitorTestAddItemVerbatim Date: Thu, 25 May 2023 17:13:36 +0200 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.9 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.3 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: 1685027832523100001 Content-Type: text/plain; charset="utf-8" Replace qemuMonitorTestAddItemParams by qemuMonitorTestAddItemVerbatim Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- tests/qemumonitorjsontest.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/tests/qemumonitorjsontest.c b/tests/qemumonitorjsontest.c index f6b6da372c..ceb7108ac0 100644 --- a/tests/qemumonitorjsontest.c +++ b/tests/qemumonitorjsontest.c @@ -2036,14 +2036,16 @@ testQemuMonitorJSONqemuMonitorJSONSendKeyHoldtime(c= onst void *opaque) if (!(test =3D qemuMonitorTestNewSchema(xmlopt, data->schema))) return -1; - if (qemuMonitorTestAddItemParams(test, "send-key", - "{\"return\":{}}", - "hold-time", "31337", - "keys", "[{\"type\":\"number\",\"data= \":43}," - "{\"type\":\"number\",\"data= \":26}," - "{\"type\":\"number\",\"data= \":46}," - "{\"type\":\"number\",\"data= \":32}]", - NULL, NULL) < 0) + if (qemuMonitorTestAddItemVerbatim(test, + "{\"execute\":\"send-key\"," + " \"arguments\":{\"keys\":[{\"type\= ":\"number\",\"data\":43}," + " {\"type\= ":\"number\",\"data\":26}," + " {\"type\= ":\"number\",\"data\":46}," + " {\"type\= ":\"number\",\"data\":32}]," + " \"hold-time\":3133= 7}," + " \"id\":\"libvirt-1\"}", + NULL, + "{ \"return\" : {}}") < 0) return -1; if (qemuMonitorJSONSendKey(qemuMonitorTestGetMonitor(test), --=20 2.40.1 From nobody Fri Mar 29 13:25:02 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.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.133.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=1685027799; cv=none; d=zohomail.com; s=zohoarc; b=XiT3krxdly2UAMTyC5y1ABW8AW0HHu2xBQpZgyKBytHruZwa48ejtLDIQeJKyn0tpocaQ1jx9jfI4kZhkH/kX3ujY6PwM5gqtk+g4cjHEbAKBBj5nHkKwl/QAGvEmb6ED/dmWocUCBJdduOvQcQR4xfvhdQsohSmETtq/+tI00s= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1685027799; 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=f2vYcBkKDJGkaoQ/+nSYgud9aoPMH8fYIodWgpmpVRg=; b=CKbmbFuwLMgyhioQiXfqRId6RW87f4vSP16/hvhlbEZAfyv7mfYoCkhKNnJ1LdvzetlyEv1cOrfBMiwFDvlkazHsBPkbTWNvovpzKxS5KjN38sklwbjR429qFC8ekTBcN7f2kENEvXDJN9E4xn/WmKYJ5Z3VChDPvhhXAUNPkJM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.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.133.124]) by mx.zohomail.com with SMTPS id 1685027799029311.2125047981134; Thu, 25 May 2023 08:16:39 -0700 (PDT) Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-638-XahQdwu2Mp6TnbdAyoEzhQ-1; Thu, 25 May 2023 11:16:32 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 139EF1C01729; Thu, 25 May 2023 15:16: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 F10E12023190; Thu, 25 May 2023 15:16:25 +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 5630A19465BA; Thu, 25 May 2023 15:16:25 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 0BC971946A44 for ; Thu, 25 May 2023 15:14:02 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id C23D840D1CF; Thu, 25 May 2023 15:13:55 +0000 (UTC) Received: from speedmetal.lan (unknown [10.45.242.14]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4C1F2482062 for ; Thu, 25 May 2023 15:13:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1685027798; 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=f2vYcBkKDJGkaoQ/+nSYgud9aoPMH8fYIodWgpmpVRg=; b=MndVm+JpAzKnJqzg3QNDUpbuMOl3LKC7vS3aUl4e6jIHw64nJO5LmvpYOCm0Npk2d21WL4 mSnBYHzKUbisAWNmlJKHbGM94vDhTAGKPy8hasYCULhGffPiCYsDg4VwdFwB2Caz+GlfTp QnuggnAgQzBK3HCF9vGYvmTp40xotc4= X-MC-Unique: XahQdwu2Mp6TnbdAyoEzhQ-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 10/18] testQemuMonitorJSONqemuMonitorJSONSetBlockIoThrottle: Rewrite using qemuMonitorTestAddItemVerbatim Date: Thu, 25 May 2023 17:13:37 +0200 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.9 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.4 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: 1685027800354100001 Content-Type: text/plain; charset="utf-8" Replace qemuMonitorTestAddItemParams by qemuMonitorTestAddItemVerbatim Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- tests/qemumonitorjsontest.c | 49 +++++++++++++++++++++++-------------- 1 file changed, 30 insertions(+), 19 deletions(-) diff --git a/tests/qemumonitorjsontest.c b/tests/qemumonitorjsontest.c index ceb7108ac0..d9323d94c3 100644 --- a/tests/qemumonitorjsontest.c +++ b/tests/qemumonitorjsontest.c @@ -1865,25 +1865,36 @@ testQemuMonitorJSONqemuMonitorJSONSetBlockIoThrottl= e(const void *opaque) expectedInfo =3D (virDomainBlockIoTuneInfo) {1, 2, 3, 4, 5, 6, 7, 8, 9= , 10, 11, 12, 13, NULL, 15, 16, 17, 18, 19, 20}; expectedInfo.group_name =3D g_strdup("group14"); - if (qemuMonitorTestAddItem(test, "query-block", queryBlockReply) < 0 || - qemuMonitorTestAddItemParams(test, "block_set_io_throttle", - "{\"return\":{}}", - "device", "\"drive-virtio-disk1\"", - "bps", "1", "bps_rd", "2", "bps_wr", = "3", - "iops", "4", "iops_rd", "5", "iops_wr= ", "6", - "bps_max", "7", "bps_rd_max", "8", - "bps_wr_max", "9", - "iops_max", "10", "iops_rd_max", "11", - "iops_wr_max", "12", "iops_size", "13= ", - "group", "\"group14\"", - "bps_max_length", "15", - "bps_rd_max_length", "16", - "bps_wr_max_length", "17", - "iops_max_length", "18", - "iops_rd_max_length", "19", - "iops_wr_max_length", "20", - NULL, NULL) < 0) - goto cleanup; + if (qemuMonitorTestAddItem(test, "query-block", queryBlockReply) < 0) + return -1; + + if (qemuMonitorTestAddItemVerbatim(test, + "{\"execute\":\"block_set_io_thrott= le\"," + " \"arguments\":{\"device\": \"driv= e-virtio-disk1\"," + " \"bps\": 1," + " \"bps_rd\": 2," + " \"bps_wr\": 3," + " \"iops\": 4," + " \"iops_rd\": 5," + " \"iops_wr\": 6," + " \"bps_max\": 7," + " \"bps_rd_max\": 8," + " \"bps_wr_max\": 9," + " \"iops_max\": 10," + " \"iops_rd_max\": 1= 1," + " \"iops_wr_max\": 1= 2," + " \"iops_size\": 13," + " \"group\": \"group= 14\"," + " \"bps_max_length\"= : 15," + " \"bps_rd_max_lengt= h\": 16," + " \"bps_wr_max_lengt= h\": 17," + " \"iops_max_length\= ": 18," + " \"iops_rd_max_leng= th\": 19," + " \"iops_wr_max_leng= th\": 20}," + " \"id\":\"libvirt-2\"}", + NULL, + "{ \"return\" : {}}") < 0) + return -1; if (qemuMonitorJSONGetBlockIoThrottle(qemuMonitorTestGetMonitor(test), "drive-virtio-disk0", NULL, &inf= o) < 0) --=20 2.40.1 From nobody Fri Mar 29 13:25:02 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.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.133.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=1685027808; cv=none; d=zohomail.com; s=zohoarc; b=QTWHhSeDvoLqQiZK6rSDFrvKrnRXJLgRpgG8NhdbSIWYvw23X422YPn+NaAuJrRQ3kx43xp2YO4Ohna+Y9zrYifdy+ib/sCW63QfJHzvAnPMdaPJ+VWwBPJQjZpaCf7bePUsW5L9shGwWNWLErMbLEq77ZTzYsY8+ihIcO+Afpw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1685027808; 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=1JunrW9ZUDrTXktiVo4hqN8qhElfPn8MqFs3Q1n4Y5s=; b=HUN4P1hOBP/ICVrSmDbVPBf6ohDbuGZlWRfXH0Ev1V0Q/7QJgR1rrea8wjxhYNJjSgyg+55yCtImyi79+l4izOA7Jk8BQ4C1IIMipzW2GLcLwh7HnUWqZ2gBFV15yuZb0dkf2lomMFTwCjU2o5fhVOe8Bb91FfVJ//5dKuCDGXA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.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.133.124]) by mx.zohomail.com with SMTPS id 1685027808119476.7324511381131; Thu, 25 May 2023 08:16:48 -0700 (PDT) Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-190-BdCHp4bKPYaZ97O6cs-BNw-1; Thu, 25 May 2023 11:16:43 -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 ED6B13C0D19F; Thu, 25 May 2023 15:16:31 +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 C96C5C0004B; Thu, 25 May 2023 15:16:31 +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 CDF0819451C2; Thu, 25 May 2023 15:16:25 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 06C4819465BD for ; Thu, 25 May 2023 15:14:02 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 9509340D1C0; Thu, 25 May 2023 15:13:56 +0000 (UTC) Received: from speedmetal.lan (unknown [10.45.242.14]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1DABB40F6A5 for ; Thu, 25 May 2023 15:13:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1685027805; 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=1JunrW9ZUDrTXktiVo4hqN8qhElfPn8MqFs3Q1n4Y5s=; b=XGO3sO89GEwlFKLwbg1p9BerkfKCwrnd376J8JnD0jasGAnl1TbPm5Lxzq1JNJw7m/uASc TK8lkyaW4FuMte0oA0efyOtvmid/xKTtXnj1q/VFzSZMG6FqgMlkDPLHdRIe/+i+A2TwJy vKla7nou+Co+LxP0FWkeusBfiWBhKBM= X-MC-Unique: BdCHp4bKPYaZ97O6cs-BNw-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 11/18] Drop unused qemuMonitorTestAddItemParams Date: Thu, 25 May 2023 17:13:38 +0200 Message-Id: <8a844bd526b0bf06dc308c1a56fdbe9c82215cf6.1685027511.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.9 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: 1685027808590100001 Content-Type: text/plain; charset="utf-8" Using qemuMonitorTestAddItemVerbatim is more universal and that helper also does QMP schema validation. Remove the now unused helper. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- tests/qemumonitortestutils.c | 132 ----------------------------------- tests/qemumonitortestutils.h | 7 -- 2 files changed, 139 deletions(-) diff --git a/tests/qemumonitortestutils.c b/tests/qemumonitortestutils.c index 9e6da78a8b..8b8b02a790 100644 --- a/tests/qemumonitortestutils.c +++ b/tests/qemumonitortestutils.c @@ -469,19 +469,10 @@ qemuMonitorTestItemGetPrivateData(qemuMonitorTestItem= *item) } -typedef struct _qemuMonitorTestCommandArgs qemuMonitorTestCommandArgs; -struct _qemuMonitorTestCommandArgs { - char *argname; - char *argval; -}; - - struct qemuMonitorTestHandlerData { char *command_name; char *cmderr; char *response; - size_t nargs; - qemuMonitorTestCommandArgs *args; char *expectArgs; }; @@ -489,20 +480,13 @@ static void qemuMonitorTestHandlerDataFree(void *opaque) { struct qemuMonitorTestHandlerData *data =3D opaque; - size_t i; if (!data) return; - for (i =3D 0; i < data->nargs; i++) { - g_free(data->args[i].argname); - g_free(data->args[i].argval); - } - g_free(data->command_name); g_free(data->cmderr); g_free(data->response); - g_free(data->args); g_free(data->expectArgs); g_free(data); } @@ -743,122 +727,6 @@ qemuMonitorTestAddAgentSyncResponse(qemuMonitorTest *= test) } -static int -qemuMonitorTestProcessCommandWithArgs(qemuMonitorTest *test, - qemuMonitorTestItem *item, - const char *cmdstr) -{ - struct qemuMonitorTestHandlerData *data =3D item->opaque; - g_autoptr(virJSONValue) val =3D NULL; - virJSONValue *args; - virJSONValue *argobj; - const char *cmdname; - size_t i; - - if (!(val =3D virJSONValueFromString(cmdstr))) - return -1; - - if (!(cmdname =3D virJSONValueObjectGetString(val, "execute"))) { - qemuMonitorTestError("Missing command name in %s", cmdstr); - return -1; - } - - if (data->command_name && - STRNEQ(data->command_name, cmdname)) { - qemuMonitorTestErrorInvalidCommand(data->command_name, cmdname); - return -1; - } - - if (!(args =3D virJSONValueObjectGet(val, "arguments"))) { - qemuMonitorTestError("Missing arguments section for command '%s'", - NULLSTR(data->command_name)); - return -1; - } - - /* validate the args */ - for (i =3D 0; i < data->nargs; i++) { - qemuMonitorTestCommandArgs *arg =3D &data->args[i]; - g_autofree char *argstr =3D NULL; - - if (!(argobj =3D virJSONValueObjectGet(args, arg->argname))) { - qemuMonitorTestError("Missing argument '%s' for command '%s'", - arg->argname, - NULLSTR(data->command_name)); - return -1; - } - - /* convert the argument to string */ - if (!(argstr =3D virJSONValueToString(argobj, false))) - return -1; - - /* verify that the argument value is expected */ - if (STRNEQ(argstr, arg->argval)) { - qemuMonitorTestError("Invalid value of argument '%s' of comman= d '%s': " - "expected '%s' got '%s'", - arg->argname, - NULLSTR(data->command_name), - arg->argval, argstr); - return -1; - } - } - - /* arguments checked out, return the response */ - return qemuMonitorTestAddResponse(test, data->response); -} - - - -/* this allows to add a responder that is able to check - * a (shallow) structure of arguments for a command */ -int -qemuMonitorTestAddItemParams(qemuMonitorTest *test, - const char *cmdname, - const char *response, - ...) -{ - struct qemuMonitorTestHandlerData *data; - const char *argname; - const char *argval; - va_list args; - - va_start(args, response); - - data =3D g_new0(struct qemuMonitorTestHandlerData, 1); - - data->command_name =3D g_strdup(cmdname); - data->response =3D g_strdup(response); - - while ((argname =3D va_arg(args, char *))) { - size_t i; - if (!(argval =3D va_arg(args, char *))) { - virReportError(VIR_ERR_INTERNAL_ERROR, - "Missing argument value for argument '%s'", - argname); - goto error; - } - - i =3D data->nargs; - VIR_EXPAND_N(data->args, data->nargs, 1); - data->args[i].argname =3D g_strdup(argname); - data->args[i].argval =3D g_strdup(argval); - } - - va_end(args); - - qemuMonitorTestAddHandler(test, - cmdname, - qemuMonitorTestProcessCommandWithArgs, - data, qemuMonitorTestHandlerDataFree); - - return 0; - - error: - va_end(args); - qemuMonitorTestHandlerDataFree(data); - return -1; -} - - static void qemuMonitorTestEOFNotify(qemuMonitor *mon G_GNUC_UNUSED, virDomainObj *vm G_GNUC_UNUSED) diff --git a/tests/qemumonitortestutils.h b/tests/qemumonitortestutils.h index 5de55172be..eddd8294bb 100644 --- a/tests/qemumonitortestutils.h +++ b/tests/qemumonitortestutils.h @@ -74,13 +74,6 @@ qemuMonitorTestAddItemVerbatim(qemuMonitorTest *test, int qemuMonitorTestAddAgentSyncResponse(qemuMonitorTest *test); -int -qemuMonitorTestAddItemParams(qemuMonitorTest *test, - const char *cmdname, - const char *response, - ...) - G_GNUC_NULL_TERMINATED; - #define qemuMonitorTestNewSimple(xmlopt) \ qemuMonitorTestNew(xmlopt, NULL, NULL, NULL) #define qemuMonitorTestNewSchema(xmlopt, schema) \ --=20 2.40.1 From nobody Fri Mar 29 13:25:02 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.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.133.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=1685027662; cv=none; d=zohomail.com; s=zohoarc; b=VQ3yzUFQjBCvbkjetd3whlQp6kNzpH3z058uGhrGpBfxndOtXDoq8YqK9ftITWQBkbt29JbBcNEmhMVaGJ1wpsMNFcNXkyem4AA3WA6stnR/AdfrsGMEhVzYVPuXEgJlaQveW2VrdqAa3WMBBl47EX7RkSvga0JchEfYke0droc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1685027662; 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=OzHTKh+GJ6ulZlDaCZPQF+amGML2saAmFKhhIKfjaws=; b=VpPzKvpG8Jb6JafXLZ/DSyZXcmTLjGmkx/YPrROfQOOwflrXzzkl7SzqU+BBq2SYBRJxObFIdctcd04YNwWhzaRNCesP+7aeDJx+/9yiRs8C++WCjnhj6SfTUh5ivEDbATFsi/nN4YPp6LK29x1ldvFq0euTOofPZ+5FLXnNHzA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.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.133.124]) by mx.zohomail.com with SMTPS id 168502766219546.521539549167755; Thu, 25 May 2023 08:14:22 -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-374-RnG0Nii1PSyUpxpURWBChQ-1; Thu, 25 May 2023 11:14:17 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 760961022F09; Thu, 25 May 2023 15:14:14 +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 607CA40C6CCF; Thu, 25 May 2023 15:14:14 +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 47C5719465A4; Thu, 25 May 2023 15:14:14 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 0959419466DF for ; Thu, 25 May 2023 15:14:02 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 6C4C4482065; Thu, 25 May 2023 15:13:57 +0000 (UTC) Received: from speedmetal.lan (unknown [10.45.242.14]) by smtp.corp.redhat.com (Postfix) with ESMTP id E8BF5482062 for ; Thu, 25 May 2023 15:13:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1685027661; 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=OzHTKh+GJ6ulZlDaCZPQF+amGML2saAmFKhhIKfjaws=; b=UumtmgH0MgSaEdavu5kagiACwxAxB/IJw24tWpIcBSKA2hTs1ziaILW6fT8S+I4QvZPHRY nL3Cjt2hoPMMe3DWjUR68c5UcIukZiCk4wO7AGXSFSJmCsIrN5rtj26X7yKWrxDTrsXYzF erCyfn6DL4MUJQ4m7jhwAsNHpCEdWwU= X-MC-Unique: RnG0Nii1PSyUpxpURWBChQ-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 12/18] qemumonitorjsontest: Drop 'schema-meta' case Date: Thu, 25 May 2023 17:13:39 +0200 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.9 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.2 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: 1685027662851100001 Content-Type: text/plain; charset="utf-8" The test case is validating the QMP schema against itself. This was useful when I was developing the validator but at this point it's no longer needed. Additionally the QMP schema has few deprecated members now, which our validator doesn't catch yet, so this test would start failing once I fix the validator. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- tests/qemumonitorjsontest.c | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/tests/qemumonitorjsontest.c b/tests/qemumonitorjsontest.c index d9323d94c3..c3963050de 100644 --- a/tests/qemumonitorjsontest.c +++ b/tests/qemumonitorjsontest.c @@ -2825,8 +2825,6 @@ mymain(void) g_autoptr(GHashTable) qapischema_x86_64 =3D NULL; g_autoptr(GHashTable) qapischema_s390x =3D NULL; struct testQAPISchemaData qapiData; - g_autoptr(virJSONValue) metaschema =3D NULL; - g_autofree char *metaschemastr =3D NULL; if (qemuTestDriverInit(&driver) < 0) return EXIT_FAILURE; @@ -3047,17 +3045,6 @@ mymain(void) DO_TEST_QAPI_VALIDATE("alternate 2", "blockdev-add/arg-type", false, "{\"driver\":\"qcow2\",\"file\": 1234}"); - if (!(metaschema =3D testQEMUSchemaGetLatest("x86_64")) || - !(metaschemastr =3D virJSONValueToString(metaschema, false))) { - VIR_TEST_VERBOSE("failed to load latest qapi schema"); - ret =3D -1; - goto cleanup; - } - - DO_TEST_QAPI_VALIDATE("schema-meta", "query-qmp-schema/ret-type", true, - metaschemastr); - - #undef DO_TEST_QAPI_VALIDATE if (virTestRun("validate that object-add and device_add don't have sch= ema", --=20 2.40.1 From nobody Fri Mar 29 13:25:02 2024 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=1685028853; cv=none; d=zohomail.com; s=zohoarc; b=JRZzdqLlcJHMlyTP7LYo75HKOqRkzKK9FKGfPwPHN5SoWuh212nXAlteRhSz9M7aRK7ufeQ5CM6koHQave9SV2gEH1rP3E9/J1TYibDioWDaGzaTMDXAurTnhJQbFOKh4P9bRJqiJCp9IKIFGLboUVRI/KOfQSxBjKlyEnfWQtg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1685028853; 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=mA8RkTeKV8OYsaCkUqqkit0tbbgdfvSQ7j0WMOAT9ZI=; b=LumDgo1O5rqlCTrWpgWtsf6/h9ISMlwhPCADio1a3KBGZ60f7LK1/AkXS9ehb/oE4XMp5z8wF+bwVyAqmkNqFbvgvlcYKanVyRASVGieQ9xcLdVtRUVbIfOJDX1P4HatHLYq+j6NaX0ca1rd4cTyj0NY+CgdvR2qQOVS0Kd+2Pg= 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 1685028853026679.8096138043836; Thu, 25 May 2023 08:34:13 -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-563-c1JE05gJP1GfC4sIsaZA9A-1; Thu, 25 May 2023 11:34:08 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 97225101AA6E; Thu, 25 May 2023 15:34:05 +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 40BDE2166B31; Thu, 25 May 2023 15:34:05 +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 73F3219465BC; Thu, 25 May 2023 15:33:49 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 09E491946A41 for ; Thu, 25 May 2023 15:14:02 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 43500417E4E; Thu, 25 May 2023 15:13:58 +0000 (UTC) Received: from speedmetal.lan (unknown [10.45.242.14]) by smtp.corp.redhat.com (Postfix) with ESMTP id C00EF43E903 for ; Thu, 25 May 2023 15:13:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1685028851; 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=mA8RkTeKV8OYsaCkUqqkit0tbbgdfvSQ7j0WMOAT9ZI=; b=V5C1aRWQPNlw2nyNXiJgJGeZ7zIehBpphrgLxJOonj5cfevAgDkObOaht15peouaTaqe9P qeC22lgPeJvCRjjV6TW6LoL0OBdWVJ8hOGB7tvQhuuWf6RmIAv6+7OcfqrqHiZ7wwXdpX7 bQrGB4Ksa+TRe6U2gfNrQ4yBY3eeB+Y= X-MC-Unique: c1JE05gJP1GfC4sIsaZA9A-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 13/18] qemuDiskConfigBlkdeviotuneEnabled: Make 'disk' argument const Date: Thu, 25 May 2023 17:13:40 +0200 Message-Id: <3df14f26a752d0af7f10fc5659c7d3f3b844ffdb.1685027511.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.9 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.6 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: 1685028854553100001 Content-Type: text/plain; charset="utf-8" The function doesn't modify it. Fix the argument declaration so that the function can be used in a context where we have a 'const' disk definition. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- src/qemu/qemu_command.c | 2 +- src/qemu/qemu_command.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 15383f646a..cdaa77dcbc 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -1550,7 +1550,7 @@ qemuBuildChardevCommand(virCommand *cmd, bool -qemuDiskConfigBlkdeviotuneEnabled(virDomainDiskDef *disk) +qemuDiskConfigBlkdeviotuneEnabled(const virDomainDiskDef *disk) { return !!disk->blkdeviotune.group_name || virDomainBlockIoTuneInfoHasAny(&disk->blkdeviotune); diff --git a/src/qemu/qemu_command.h b/src/qemu/qemu_command.h index 5fdb138030..55efa45601 100644 --- a/src/qemu/qemu_command.h +++ b/src/qemu/qemu_command.h @@ -208,7 +208,7 @@ qemuBuildZPCIDevProps(virDomainDeviceInfo *dev); int qemuNetworkPrepareDevices(virDomainDef *def); bool -qemuDiskConfigBlkdeviotuneEnabled(virDomainDiskDef *disk); +qemuDiskConfigBlkdeviotuneEnabled(const virDomainDiskDef *disk); virJSONValue *qemuBuildHotpluggableCPUProps(const virDomainVcpuDef *vcpu) ATTRIBUTE_NONNULL(1); --=20 2.40.1 From nobody Fri Mar 29 13:25:02 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.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.133.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=1685027939; cv=none; d=zohomail.com; s=zohoarc; b=WzVnS4QYCecrFnhA0s1/FcmCy270Bf3TRyQqn7nDFSmOmMxPlGe6U4cYhllI76HCFl8/1Slk/vSLdYWpLojS4LIq8u/BmMZo5kLZpQiJzRvUhg+vfYa3PHZyQZ2lOn38FqUdoeTOGfRlxqDkMYhG23Z94f8H0vVAusTpEq0p02I= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1685027939; 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=wrwSlGeXuLYe7CNgUuz1z3IqwhjIBMelnMglniBSIWg=; b=M25OWAAnPEvctRXehnjYCaFYFCO6I7+6F2UlwepiLzzmdQUj+FFBwmt0Erc20FjhKS3I0jbfzu5dqM/Zw+UMtLXA2Aqxj7gOfT8Xh3zLxiVFvphx+p7lK+leqKdtw0m9ww67jGhh6I7ItHxzcXPSfxT5zxdp4nio1VsNrw9seo8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.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.133.124]) by mx.zohomail.com with SMTPS id 1685027939243298.60256750295787; Thu, 25 May 2023 08:18:59 -0700 (PDT) Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-44-v3kFKRhTNs-wOpJJVwkHfg-1; Thu, 25 May 2023 11:18:54 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id AB34F29DD99C; Thu, 25 May 2023 15:18:48 +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 905FA2166B2B; Thu, 25 May 2023 15:18:48 +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 4754019465A4; Thu, 25 May 2023 15:18:48 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 0A3A21946A42 for ; Thu, 25 May 2023 15:14:02 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 191BB40F6A5; Thu, 25 May 2023 15:13:59 +0000 (UTC) Received: from speedmetal.lan (unknown [10.45.242.14]) by smtp.corp.redhat.com (Postfix) with ESMTP id 968FA482062 for ; Thu, 25 May 2023 15:13:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1685027938; 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=wrwSlGeXuLYe7CNgUuz1z3IqwhjIBMelnMglniBSIWg=; b=XUaeO0uiZFe/8ZsKsDjvsIS6liBAfMvITkmRW/C5cI09IFRcudGVqboOEOO+1728mOUhz5 /6GAynkHq5cDxqQqbb394UbLMLuRVFYTQhBg+SE7X0InhIARZV8dZV5yyXtVrN36zg70ul NbTniDs53Z42Ch3ZpNsG9nQ8PaAOgzw= X-MC-Unique: v3kFKRhTNs-wOpJJVwkHfg-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 14/18] qemu: Refuse setting for 'SD' disks Date: Thu, 25 May 2023 17:13:41 +0200 Message-Id: <96e3a93612c7c7ffcd83c58b5be3585a5c57dbcd.1685027511.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.9 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.6 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: 1685027940567100001 Content-Type: text/plain; charset="utf-8" Historically this didn't work with any supported qemu version as we don't set the alias of the device, and thus qemu uses a different alias resulting in a failure to startup the VM: internal error: unable to execute QEMU command 'block_set_io_throttle': D= evice 'drive-sd-disk0' not found Refuse setting throttling as this is unlikely to be needed and proper fix requires using -device instead of -drive if=3Dsd. Note that this was broken when I moved the setup of throttling as a command at startup for blockdev integration quite a while ago. Until then throttling was passed as arguments for -drive. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- src/qemu/qemu_driver.c | 17 +++++++++-------- src/qemu/qemu_validate.c | 8 ++++++++ 2 files changed, 17 insertions(+), 8 deletions(-) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 00b58e0424..d3b37486c3 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -14764,11 +14764,12 @@ typedef enum { static bool -qemuDomainDiskBlockIoTuneIsSupported(virStorageSource *src) +qemuDomainDiskBlockIoTuneIsSupported(virDomainDiskDef *disk) { - if (virStorageSourceGetActualType(src) =3D=3D VIR_STORAGE_TYPE_VHOST_U= SER) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("a block I/O throttling is not supported for vhos= tuser disk")); + if (virStorageSourceGetActualType(disk->src) =3D=3D VIR_STORAGE_TYPE_V= HOST_USER || + disk->bus =3D=3D VIR_DOMAIN_DISK_BUS_SD) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("block I/O throttling is not supported for disk '= %1$s'"), disk->dst); return false; } @@ -15107,7 +15108,7 @@ qemuDomainSetBlockIoTune(virDomainPtr dom, if (!(disk =3D qemuDomainDiskByName(def, path))) goto endjob; - if (!qemuDomainDiskBlockIoTuneIsSupported(disk->src)) + if (!qemuDomainDiskBlockIoTuneIsSupported(disk)) goto endjob; if (QEMU_DOMAIN_DISK_PRIVATE(disk)->qomName) { @@ -15193,7 +15194,7 @@ qemuDomainSetBlockIoTune(virDomainPtr dom, goto endjob; } - if (!qemuDomainDiskBlockIoTuneIsSupported(conf_disk->src)) + if (!qemuDomainDiskBlockIoTuneIsSupported(conf_disk)) goto endjob; conf_cur_info =3D qemuDomainFindGroupBlockIoTune(persistentDef, co= nf_disk, &info); @@ -15284,7 +15285,7 @@ qemuDomainGetBlockIoTune(virDomainPtr dom, if (!(disk =3D qemuDomainDiskByName(def, path))) goto endjob; - if (!qemuDomainDiskBlockIoTuneIsSupported(disk->src)) + if (!qemuDomainDiskBlockIoTuneIsSupported(disk)) goto endjob; if (QEMU_DOMAIN_DISK_PRIVATE(disk)->qomName) { @@ -15309,7 +15310,7 @@ qemuDomainGetBlockIoTune(virDomainPtr dom, goto endjob; } - if (!qemuDomainDiskBlockIoTuneIsSupported(disk->src)) + if (!qemuDomainDiskBlockIoTuneIsSupported(disk)) goto endjob; reply =3D disk->blkdeviotune; diff --git a/src/qemu/qemu_validate.c b/src/qemu/qemu_validate.c index da4b9a3b35..04d0c9df73 100644 --- a/src/qemu/qemu_validate.c +++ b/src/qemu/qemu_validate.c @@ -3094,6 +3094,14 @@ qemuValidateDomainDeviceDefDiskBlkdeviotune(const vi= rDomainDiskDef *disk, return -1; } + /* setting throttling for the SD card didn't work, refuse it explicitl= y */ + if (disk->bus =3D=3D VIR_DOMAIN_DISK_BUS_SD && + qemuDiskConfigBlkdeviotuneEnabled(disk)) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _(" is not supported with bus=3D'sd'")); + return -1; + } + /* checking def here is only for calling from tests */ if (disk->blkdeviotune.group_name) { size_t i; --=20 2.40.1 From nobody Fri Mar 29 13:25:02 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.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.133.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=1685027762; cv=none; d=zohomail.com; s=zohoarc; b=Zj/bFEWuc7hyVuFL9qCQqNhH4Lw9K8eX3Iuaca1KhMM/kg5B88627pVPp5KukXfUFoYeC4aiPEJ4pPEl6IPTEu1alBAIKTpIpOH+SvfvALPymyNxyjcRtksXWs1GVgBwmxvIjsFeFU6sTwgsfOubmKvx1zGHuow6p1RWkPA5QHY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1685027762; 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=ny6AncDTKbDeRi/qksX7XuGpy2d2s/UKAPEqE+Uq0ac=; b=WxikOek2fto6iobrdo3qjIvlMAKTY5CCCYULgagUch3Fu2fuJhuG08LYUBgLUD61Api+PXU5REUmpCS15QvRCnqlbZF29QPYLgoGRaBrngqymgaEtgNzHFsoLK+h8WiFCKD8kXtR1eKpZo4meihF8xJHK7DCE90v7Ktlw8DSGc8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.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.133.124]) by mx.zohomail.com with SMTPS id 1685027762229899.2066209600259; Thu, 25 May 2023 08:16:02 -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-122-fwqxw_qlPjqvwMzyLU-P0Q-1; Thu, 25 May 2023 11:15:54 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 312BA805F30; Thu, 25 May 2023 15:15:30 +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 1AAFD2029F6D; Thu, 25 May 2023 15:15:30 +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 C84031946A46; Thu, 25 May 2023 15:15:29 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 0C60C1946A45 for ; Thu, 25 May 2023 15:14:02 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id E0C1C43E902; Thu, 25 May 2023 15:13:59 +0000 (UTC) Received: from speedmetal.lan (unknown [10.45.242.14]) by smtp.corp.redhat.com (Postfix) with ESMTP id 6BDF2482062 for ; Thu, 25 May 2023 15:13:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1685027761; 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=ny6AncDTKbDeRi/qksX7XuGpy2d2s/UKAPEqE+Uq0ac=; b=Znnkz+TgLxJtVXmOjWE2Pv+qSTLlcQG/Wbfgl0zxjx88wCgApT0+T4sbQ3OR+vu3uodQY0 Wg2iQN/lVm5NQaLjFdJ/1tJYdxtjo0yZNqJCF2EyJTCIwt+F/nZ99eXf1uTFwF50d6Wh5d ggxCTP/aNfOBYy48uqevc4MHgjB9Yhc= X-MC-Unique: fwqxw_qlPjqvwMzyLU-P0Q-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 15/18] qemumonitorjsontest: Use 'id' instead of deprecated 'device' argument of 'block_set_io_throttle' Date: Thu, 25 May 2023 17:13:42 +0200 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.9 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.4 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: 1685027763326100001 Content-Type: text/plain; charset="utf-8" The 'device' argument is deprecated. All real usage in the qemu driver already uses 'id' as we populate the 'qomName' for everything except for SD cards where throttling didn't work with libvirt for a very long time. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- tests/qemumonitorjsontest.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/qemumonitorjsontest.c b/tests/qemumonitorjsontest.c index c3963050de..5c05669280 100644 --- a/tests/qemumonitorjsontest.c +++ b/tests/qemumonitorjsontest.c @@ -1870,7 +1870,7 @@ testQemuMonitorJSONqemuMonitorJSONSetBlockIoThrottle(= const void *opaque) if (qemuMonitorTestAddItemVerbatim(test, "{\"execute\":\"block_set_io_thrott= le\"," - " \"arguments\":{\"device\": \"driv= e-virtio-disk1\"," + " \"arguments\":{\"id\": \"drive-vi= rtio-disk1\"," " \"bps\": 1," " \"bps_rd\": 2," " \"bps_wr\": 3," @@ -1904,7 +1904,7 @@ testQemuMonitorJSONqemuMonitorJSONSetBlockIoThrottle(= const void *opaque) goto cleanup; if (qemuMonitorJSONSetBlockIoThrottle(qemuMonitorTestGetMonitor(test), - "drive-virtio-disk1", NULL, &inf= o) < 0) + NULL, "drive-virtio-disk1", &inf= o) < 0) goto cleanup; ret =3D 0; --=20 2.40.1 From nobody Fri Mar 29 13:25:02 2024 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=1685027739; cv=none; d=zohomail.com; s=zohoarc; b=HjeriHWUqKXWUe8AZA60ai/+XwEzX/lZ0e3JtPDQN1/LKudMjPq8svnKzxSJRkxc+8GWz8n3bRXhLs1Sn2d46uFN8segtsKBzEe6hG1n0w38juXBpMSIk+gq8OevwviaSUO0+JA5lcZEbkvPkjdjFd1ERP/xolmjVh0FknFSi5M= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1685027739; 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=BcpfNVmEuInAafOWct/AnFd9UDVATJaoisEG3aKJ0+M=; b=CriGOPtCJqz1NfWNiugL/WKgQgGBbIivZSFzqqXsUmFTQTnO6azifL5fezgMz/BCb4v+Vs28lzla6qKgDsE73Fi8kNq2RPf/gZHtt5daz7+bfdpWb0okZz2hnxA4pXyj16zpELzulbV1z88wdy/Hn3jtHZFgkW62lNsbxlZ6k6k= 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 1685027739601493.1015399776817; Thu, 25 May 2023 08:15:39 -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-583-ocJe32KhOHKH7ysPL_znxw-1; Thu, 25 May 2023 11:15:32 -0400 Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 217E2802A55; Thu, 25 May 2023 15:15:27 +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 0E331401024; Thu, 25 May 2023 15:15:27 +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 D3D3919465A4; Thu, 25 May 2023 15:15:26 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 18F1319465B1 for ; Thu, 25 May 2023 15:14:02 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id B3519482062; Thu, 25 May 2023 15:14:00 +0000 (UTC) Received: from speedmetal.lan (unknown [10.45.242.14]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3D684482066 for ; Thu, 25 May 2023 15:14:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1685027738; 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=BcpfNVmEuInAafOWct/AnFd9UDVATJaoisEG3aKJ0+M=; b=BkaT4bGoieBQOt+18Sn3B87OzuhujXoRUrg/fIxA4pyX7gl0khb3LbYDt2AuibqYqpPPWz o8+wlwNCQFOE9axqhs9apV8pA+CqWyIQHKtmwcgO1QZyy18fQVOdEhQB0AJOQb+YcxG9R7 58vLbCxPx+gH8b9w0fK4uE9VKgo8+Ss= X-MC-Unique: ocJe32KhOHKH7ysPL_znxw-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 16/18] qemuMonitorGetBlockIoThrottle: Drop 'diskalias' argument Date: Thu, 25 May 2023 17:13:43 +0200 Message-Id: <7f274dfde41ef7e825d4651b7dfda40726454afb.1685027511.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.9 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.9 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: 1685027741792100005 Content-Type: text/plain; charset="utf-8" Every caller will pass 'qdevid' as it's populated in the data madatorily with qemu-4.2 and onwards due to mandatory -blockdev use. Thus we can drop compatibility with the old way of matching the disk via alias. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- src/qemu/qemu_driver.c | 10 +--------- src/qemu/qemu_monitor.c | 6 ++---- src/qemu/qemu_monitor.h | 1 - src/qemu/qemu_monitor_json.c | 10 ++++------ src/qemu/qemu_monitor_json.h | 1 - tests/qemumonitorjsontest.c | 2 +- 6 files changed, 8 insertions(+), 22 deletions(-) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index d3b37486c3..430b75880b 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -15240,8 +15240,6 @@ qemuDomainGetBlockIoTune(virDomainPtr dom, virDomainDef *def =3D NULL; virDomainDef *persistentDef =3D NULL; virDomainBlockIoTuneInfo reply =3D {0}; - g_autofree char *drivealias =3D NULL; - const char *qdevid =3D NULL; int ret =3D -1; int maxparams; @@ -15288,14 +15286,8 @@ qemuDomainGetBlockIoTune(virDomainPtr dom, if (!qemuDomainDiskBlockIoTuneIsSupported(disk)) goto endjob; - if (QEMU_DOMAIN_DISK_PRIVATE(disk)->qomName) { - qdevid =3D QEMU_DOMAIN_DISK_PRIVATE(disk)->qomName; - } else { - if (!(drivealias =3D qemuAliasDiskDriveFromDisk(disk))) - goto endjob; - } qemuDomainObjEnterMonitor(vm); - rc =3D qemuMonitorGetBlockIoThrottle(priv->mon, drivealias, qdevid= , &reply); + rc =3D qemuMonitorGetBlockIoThrottle(priv->mon, QEMU_DOMAIN_DISK_P= RIVATE(disk)->qomName, &reply); qemuDomainObjExitMonitor(vm); if (rc < 0) diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c index dacf161971..5faf64a4ec 100644 --- a/src/qemu/qemu_monitor.c +++ b/src/qemu/qemu_monitor.c @@ -2988,16 +2988,14 @@ qemuMonitorSetBlockIoThrottle(qemuMonitor *mon, int qemuMonitorGetBlockIoThrottle(qemuMonitor *mon, - const char *drivealias, const char *qdevid, virDomainBlockIoTuneInfo *reply) { - VIR_DEBUG("drivealias=3D%s, qdevid=3D%s, reply=3D%p", - NULLSTR(drivealias), NULLSTR(qdevid), reply); + VIR_DEBUG("qdevid=3D%s, reply=3D%p", NULLSTR(qdevid), reply); QEMU_CHECK_MONITOR(mon); - return qemuMonitorJSONGetBlockIoThrottle(mon, drivealias, qdevid, repl= y); + return qemuMonitorJSONGetBlockIoThrottle(mon, qdevid, reply); } diff --git a/src/qemu/qemu_monitor.h b/src/qemu/qemu_monitor.h index 09f22f2328..6006a451a3 100644 --- a/src/qemu/qemu_monitor.h +++ b/src/qemu/qemu_monitor.h @@ -1057,7 +1057,6 @@ int qemuMonitorSetBlockIoThrottle(qemuMonitor *mon, virDomainBlockIoTuneInfo *info); int qemuMonitorGetBlockIoThrottle(qemuMonitor *mon, - const char *drivealias, const char *qdevid, virDomainBlockIoTuneInfo *reply); diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c index 745d83e2b6..af7649f8b0 100644 --- a/src/qemu/qemu_monitor_json.c +++ b/src/qemu/qemu_monitor_json.c @@ -4517,7 +4517,6 @@ int qemuMonitorJSONOpenGraphics(qemuMonitor *mon, } static int qemuMonitorJSONBlockIoThrottleInfo(virJSONValue *io_throttle, - const char *drivealias, const char *qdevid, virDomainBlockIoTuneInfo *reply) { @@ -4547,8 +4546,8 @@ qemuMonitorJSONBlockIoThrottleInfo(virJSONValue *io_t= hrottle, return -1; } - if ((drivealias && current_drive && STRNEQ(current_drive, driveali= as)) || - (qdevid && current_qdev && STRNEQ(current_qdev, qdevid))) + if (STRNEQ_NULLABLE(current_qdev, qdevid) && + STRNEQ_NULLABLE(current_drive, qdevid)) continue; found =3D true; @@ -4587,7 +4586,7 @@ qemuMonitorJSONBlockIoThrottleInfo(virJSONValue *io_t= hrottle, if (!found) { virReportError(VIR_ERR_INTERNAL_ERROR, _("cannot find throttling info for device '%1$s'"), - drivealias ? drivealias : qdevid); + qdevid); return -1; } @@ -4640,7 +4639,6 @@ int qemuMonitorJSONSetBlockIoThrottle(qemuMonitor *mo= n, } int qemuMonitorJSONGetBlockIoThrottle(qemuMonitor *mon, - const char *drivealias, const char *qdevid, virDomainBlockIoTuneInfo *reply) { @@ -4649,7 +4647,7 @@ int qemuMonitorJSONGetBlockIoThrottle(qemuMonitor *mo= n, if (!(devices =3D qemuMonitorJSONQueryBlock(mon))) return -1; - return qemuMonitorJSONBlockIoThrottleInfo(devices, drivealias, qdevid,= reply); + return qemuMonitorJSONBlockIoThrottleInfo(devices, qdevid, reply); } int qemuMonitorJSONSystemWakeup(qemuMonitor *mon) diff --git a/src/qemu/qemu_monitor_json.h b/src/qemu/qemu_monitor_json.h index 6f376cf9b7..3f77ab0ab3 100644 --- a/src/qemu/qemu_monitor_json.h +++ b/src/qemu/qemu_monitor_json.h @@ -407,7 +407,6 @@ qemuMonitorJSONSetBlockIoThrottle(qemuMonitor *mon, int qemuMonitorJSONGetBlockIoThrottle(qemuMonitor *mon, - const char *drivealias, const char *qdevid, virDomainBlockIoTuneInfo *reply); diff --git a/tests/qemumonitorjsontest.c b/tests/qemumonitorjsontest.c index 5c05669280..ba12aae5b7 100644 --- a/tests/qemumonitorjsontest.c +++ b/tests/qemumonitorjsontest.c @@ -1897,7 +1897,7 @@ testQemuMonitorJSONqemuMonitorJSONSetBlockIoThrottle(= const void *opaque) return -1; if (qemuMonitorJSONGetBlockIoThrottle(qemuMonitorTestGetMonitor(test), - "drive-virtio-disk0", NULL, &inf= o) < 0) + "drive-virtio-disk0", &info) < 0) goto cleanup; if (testValidateGetBlockIoThrottle(&info, &expectedInfo) < 0) --=20 2.40.1 From nobody Fri Mar 29 13:25:02 2024 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=1685028109; cv=none; d=zohomail.com; s=zohoarc; b=ez+htjSdhQpK+46F6dzLq0wp5m4UwDfvWmxA/xyTDgiAvDfsZ4O5/l6+TXDGDR6HyqZ/DL60ooNIfbYrVur2y5Nkr+gVvGZ+ZCbfwLf+FXS8ZS/wJA7WhIyJbl9qM10bbqUEStwrI3oRe6mlv9dn4X0WQcTrvoBxgtzOEbjVgJ8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1685028109; 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=23D+SOgXNr892CYsHEkat//uE1zdmQQ2UWtMYZiZCYE=; b=mcjMaqh1xFJZrlZ1ODknAAPv6YUKCH3eHHLv1PG/g27e42u648giuHZbeKmCD5aPwvzpDMtQQhkmc47el6JWjRVxlBnw1hcbfyP9J9DwXJrRqYTzh3nbqfsCYshvfMm6cxFlhF1O9I2X4bxnu5BwTInOo4uxa7S40yzEIHdzyrM= 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 1685028109292785.7458784856475; Thu, 25 May 2023 08:21:49 -0700 (PDT) Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-511-jqRc5z-CNzOMnG-BbzgViw-1; Thu, 25 May 2023 11:21:02 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 6F03E3C0F195; Thu, 25 May 2023 15:20:54 +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 16A6B140E95D; Thu, 25 May 2023 15:20:54 +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 DBA6919465A4; Thu, 25 May 2023 15:20:52 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 0E9E619465B6 for ; Thu, 25 May 2023 15:14:02 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 88A2D43E904; Thu, 25 May 2023 15:14:01 +0000 (UTC) Received: from speedmetal.lan (unknown [10.45.242.14]) by smtp.corp.redhat.com (Postfix) with ESMTP id 10FB443E903 for ; Thu, 25 May 2023 15:14:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1685028107; 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=23D+SOgXNr892CYsHEkat//uE1zdmQQ2UWtMYZiZCYE=; b=RjXk76e38LyQfD6zKdVYdCBfZYk2B5lBI0c/GVHiZO2e4qEMnsCr2L8Z+O8TTtFnQv5iXe +qwWqCnPbjj35zzXZKlzyMcgQ+CtsGbd2xQ+QjtyAg3KY4/TXyRu0EMxObA8CqfI9D6cQP mNS2WH92FLqMXTemqWHjQnVqLfywiWE= X-MC-Unique: jqRc5z-CNzOMnG-BbzgViw-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 17/18] qemuMonitorSetBlockIoThrottle: Drop 'diskalias' argument Date: Thu, 25 May 2023 17:13:44 +0200 Message-Id: <0d4f8537de4cc812f09920ac4427849dbedcfd13.1685027511.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.9 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.7 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: 1685028110258100001 Content-Type: text/plain; charset="utf-8" Every caller will pass 'qdevid' as it's populated in the data madatorily with qemu-4.2 and onwards due to mandatory -blockdev use. Thus we can drop compatibility with the old way of matching the disk via alias. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- src/qemu/qemu_driver.c | 13 +++---------- src/qemu/qemu_hotplug.c | 4 ++-- src/qemu/qemu_monitor.c | 6 ++---- src/qemu/qemu_monitor.h | 1 - src/qemu/qemu_monitor_json.c | 4 +--- src/qemu/qemu_monitor_json.h | 1 - src/qemu/qemu_process.c | 12 +++--------- tests/qemumonitorjsontest.c | 2 +- 8 files changed, 12 insertions(+), 31 deletions(-) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 430b75880b..56f4cd6197 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -14914,8 +14914,6 @@ qemuDomainSetBlockIoTune(virDomainPtr dom, virDomainDef *persistentDef =3D NULL; virDomainBlockIoTuneInfo info; virDomainBlockIoTuneInfo conf_info; - g_autofree char *drivealias =3D NULL; - const char *qdevid =3D NULL; int ret =3D -1; size_t i; virDomainDiskDef *conf_disk =3D NULL; @@ -15111,13 +15109,6 @@ qemuDomainSetBlockIoTune(virDomainPtr dom, if (!qemuDomainDiskBlockIoTuneIsSupported(disk)) goto endjob; - if (QEMU_DOMAIN_DISK_PRIVATE(disk)->qomName) { - qdevid =3D QEMU_DOMAIN_DISK_PRIVATE(disk)->qomName; - } else { - if (!(drivealias =3D qemuAliasDiskDriveFromDisk(disk))) - goto endjob; - } - cur_info =3D qemuDomainFindGroupBlockIoTune(def, disk, &info); if (qemuDomainSetBlockIoTuneDefaults(&info, cur_info, @@ -15167,7 +15158,9 @@ qemuDomainSetBlockIoTune(virDomainPtr dom, int rc =3D 0; qemuDomainObjEnterMonitor(vm); - rc =3D qemuMonitorSetBlockIoThrottle(priv->mon, drivealias, qd= evid, &info); + rc =3D qemuMonitorSetBlockIoThrottle(priv->mon, + QEMU_DOMAIN_DISK_PRIVATE(di= sk)->qomName, + &info); qemuDomainObjExitMonitor(vm); if (rc < 0) diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c index 972df572a7..806aecb29d 100644 --- a/src/qemu/qemu_hotplug.c +++ b/src/qemu/qemu_hotplug.c @@ -517,7 +517,7 @@ qemuDomainChangeMediaBlockdev(virDomainObj *vm, if (rc =3D=3D 0 && !virStorageSourceIsEmpty(newsrc) && qemuDiskConfigBlkdeviotuneEnabled(disk)) { - rc =3D qemuMonitorSetBlockIoThrottle(priv->mon, NULL, + rc =3D qemuMonitorSetBlockIoThrottle(priv->mon, diskPriv->qomName, &disk->blkdeviotune); } @@ -734,7 +734,7 @@ qemuDomainAttachDiskGeneric(virDomainObj *vm, g_autoptr(GHashTable) blockinfo =3D NULL; if (qemuDiskConfigBlkdeviotuneEnabled(disk)) { - if (qemuMonitorSetBlockIoThrottle(priv->mon, NULL, diskPriv->q= omName, + if (qemuMonitorSetBlockIoThrottle(priv->mon, diskPriv->qomName, &disk->blkdeviotune) < 0) VIR_WARN("failed to set blkdeviotune for '%s' of '%s'", di= sk->dst, vm->def->name); } diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c index 5faf64a4ec..73a019e732 100644 --- a/src/qemu/qemu_monitor.c +++ b/src/qemu/qemu_monitor.c @@ -2973,16 +2973,14 @@ qemuMonitorJobComplete(qemuMonitor *mon, int qemuMonitorSetBlockIoThrottle(qemuMonitor *mon, - const char *drivealias, const char *qomid, virDomainBlockIoTuneInfo *info) { - VIR_DEBUG("drivealias=3D%s, qomid=3D%s, info=3D%p", - NULLSTR(drivealias), NULLSTR(qomid), info); + VIR_DEBUG("qomid=3D%s, info=3D%p", NULLSTR(qomid), info); QEMU_CHECK_MONITOR(mon); - return qemuMonitorJSONSetBlockIoThrottle(mon, drivealias, qomid, info); + return qemuMonitorJSONSetBlockIoThrottle(mon, qomid, info); } diff --git a/src/qemu/qemu_monitor.h b/src/qemu/qemu_monitor.h index 6006a451a3..8f1bfc702a 100644 --- a/src/qemu/qemu_monitor.h +++ b/src/qemu/qemu_monitor.h @@ -1052,7 +1052,6 @@ int qemuMonitorOpenGraphics(qemuMonitor *mon, bool skipauth); int qemuMonitorSetBlockIoThrottle(qemuMonitor *mon, - const char *drivealias, const char *qomid, virDomainBlockIoTuneInfo *info); diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c index af7649f8b0..360b6423cf 100644 --- a/src/qemu/qemu_monitor_json.c +++ b/src/qemu/qemu_monitor_json.c @@ -4596,7 +4596,6 @@ qemuMonitorJSONBlockIoThrottleInfo(virJSONValue *io_t= hrottle, #undef GET_THROTTLE_STATS_OPTIONAL int qemuMonitorJSONSetBlockIoThrottle(qemuMonitor *mon, - const char *drivealias, const char *qomid, virDomainBlockIoTuneInfo *info) { @@ -4604,8 +4603,7 @@ int qemuMonitorJSONSetBlockIoThrottle(qemuMonitor *mo= n, g_autoptr(virJSONValue) result =3D NULL; if (!(cmd =3D qemuMonitorJSONMakeCommand("block_set_io_throttle", - "S:device", drivealias, - "S:id", qomid, + "s:id", qomid, "U:bps", info->total_bytes_sec, "U:bps_rd", info->read_bytes_se= c, "U:bps_wr", info->write_bytes_s= ec, diff --git a/src/qemu/qemu_monitor_json.h b/src/qemu/qemu_monitor_json.h index 3f77ab0ab3..802f6e7b44 100644 --- a/src/qemu/qemu_monitor_json.h +++ b/src/qemu/qemu_monitor_json.h @@ -401,7 +401,6 @@ qemuMonitorJSONOpenGraphics(qemuMonitor *mon, int qemuMonitorJSONSetBlockIoThrottle(qemuMonitor *mon, - const char *drivealias, const char *qomid, virDomainBlockIoTuneInfo *info); diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index 730e59eb7e..73cecde1f5 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -7300,13 +7300,6 @@ qemuProcessSetupDiskThrottling(virDomainObj *vm, for (i =3D 0; i < vm->def->ndisks; i++) { virDomainDiskDef *disk =3D vm->def->disks[i]; - qemuDomainDiskPrivate *diskPriv =3D QEMU_DOMAIN_DISK_PRIVATE(disk); - g_autofree char *drivealias =3D NULL; - - if (!QEMU_DOMAIN_DISK_PRIVATE(disk)->qomName) { - if (!(drivealias =3D qemuAliasDiskDriveFromDisk(disk))) - goto cleanup; - } /* Setting throttling for empty drives fails */ if (virStorageSourceIsEmpty(disk->src)) @@ -7315,8 +7308,9 @@ qemuProcessSetupDiskThrottling(virDomainObj *vm, if (!qemuDiskConfigBlkdeviotuneEnabled(disk)) continue; - if (qemuMonitorSetBlockIoThrottle(qemuDomainGetMonitor(vm), drivea= lias, - diskPriv->qomName, &disk->blkdev= iotune) < 0) + if (qemuMonitorSetBlockIoThrottle(qemuDomainGetMonitor(vm), + QEMU_DOMAIN_DISK_PRIVATE(disk)->= qomName, + &disk->blkdeviotune) < 0) goto cleanup; } diff --git a/tests/qemumonitorjsontest.c b/tests/qemumonitorjsontest.c index ba12aae5b7..7e79b2e757 100644 --- a/tests/qemumonitorjsontest.c +++ b/tests/qemumonitorjsontest.c @@ -1904,7 +1904,7 @@ testQemuMonitorJSONqemuMonitorJSONSetBlockIoThrottle(= const void *opaque) goto cleanup; if (qemuMonitorJSONSetBlockIoThrottle(qemuMonitorTestGetMonitor(test), - NULL, "drive-virtio-disk1", &inf= o) < 0) + "drive-virtio-disk1", &info) < 0) goto cleanup; ret =3D 0; --=20 2.40.1 From nobody Fri Mar 29 13:25:02 2024 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=1685028891; cv=none; d=zohomail.com; s=zohoarc; b=iVZEX8fKOTTWFYNzLV+bJh//X0TowFEGEatBUpnJDiT8IFxO/X342KaLIo2bnu/eJEWJ1q2bvf7KnNBJWkMoCzyKGrZYlF09ENbp6gqCP74XZBkcXJEBsN8yh5sLhuTojExvvNrcDpa/9biicUFJvFrwwuB2dHKPxSMRTVlKADE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1685028891; 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=qt7aF0rQJuSr9iE/B76ikL1d5B+5Xm8pZBWCiPbhuCk=; b=kYpCvMD6FIgx/KRYFPAn2WT7HxQV5ygcFeNNbMF91evIDIVKwe/qGK9fkdCSgbkrDqAW5vkwFN1YEQhyKIP912I4JJsAGYd8T2HYHhdsly1lJuVd/6o+gn+9aFUK6H7i42tHsI34ttWP7P1B3guWHT7uiCezEeIGgPJGZVNqB48= 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 1685028891297268.6350282549257; Thu, 25 May 2023 08:34:51 -0700 (PDT) Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-519-cuL4RB8lOD6nMx64rcRuAg-1; Thu, 25 May 2023 11:34:42 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id AD199381D1FF; Thu, 25 May 2023 15:33:59 +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 98AA1407DEC3; Thu, 25 May 2023 15:33:59 +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 501E519465A4; Thu, 25 May 2023 15:33:49 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 90CED19465A0 for ; Thu, 25 May 2023 15:14:02 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 63093401026; Thu, 25 May 2023 15:14:02 +0000 (UTC) Received: from speedmetal.lan (unknown [10.45.242.14]) by smtp.corp.redhat.com (Postfix) with ESMTP id DB4FC41F2CC for ; Thu, 25 May 2023 15:14:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1685028890; 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=qt7aF0rQJuSr9iE/B76ikL1d5B+5Xm8pZBWCiPbhuCk=; b=bCpMuFiNuAg0ztTrXy2ziy/IIGPRWJLKyywxlRru7aTtxirD+TQeAPwnfACagb4JwApBJD RwF1hSLtQBg7f5dHIlSubUMi53hdKd0Ox7IqZRiA0SGVWhLk/kWSIlIRN9CyCEEWq1m6CG 0vThHk/5V/AosCiZP5vMVn2BD6Eg2P8= X-MC-Unique: cuL4RB8lOD6nMx64rcRuAg-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 18/18] testQEMUSchemaValidateObjectMember: validate QMP object member deprecation Date: Thu, 25 May 2023 17:13:45 +0200 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.9 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.1 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: 1685028893723100001 Content-Type: text/plain; charset="utf-8" The QMP schema validator wasn't adapted to consider features of 'object' members and thus we didn't catch the deprecation of 'device' in 'block_set_io_throttle'. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- tests/testutilsqemuschema.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tests/testutilsqemuschema.c b/tests/testutilsqemuschema.c index d431e7b3fc..f7b2e122bd 100644 --- a/tests/testutilsqemuschema.c +++ b/tests/testutilsqemuschema.c @@ -187,6 +187,10 @@ testQEMUSchemaValidateObjectMember(const char *key, return -1; } + /* validate that the member is not deprecated */ + if ((rc =3D testQEMUSchemaValidateDeprecated(keymember, key, data->ctx= t)) < 0) + return rc; + /* lookup schema entry for keytype */ if (!(keytype =3D virJSONValueObjectGetString(keymember, "type")) || !(keyschema =3D virHashLookup(data->ctxt->schema, keytype))) { --=20 2.40.1