From nobody Mon Feb 9 04:07:37 2026 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=1627033470; cv=none; d=zohomail.com; s=zohoarc; b=Ec+bJtu2f5jo98jo6OEnTozdG322swNe2qNYwNH49lU0NUhbz4nS5L+604hniJztGb/m53syyo3gsOX1a3XQxgdgZngKrOo3cd4s1paIj+x4UJbrqYGvVWCjQ1orQJedKDbjH2frYvRPeTc/5JFeMMqKkJSknA85aqimFByde+8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1627033470; 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=XYWCKYZlpSJBqfzoAzhmvg7jhCHQKbCmQdwLSak3MCM=; b=AucCTFspZMSDbM4ZtbYMguSbzD9Ny0X7ybLJcS63Melpuzgw2S/f+lM+PWJ6H7T2iux1Q8u2RDZHF9fYDFhMQQpqj3Fr8OU45d/AkH0zTOfGD7huAq/WeszDNLOclZ8u3fbcm/k+8KZgP/Vt8/vJWsCa4677C7uStwdxm+l+Upc= 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 1627033470961102.67214718314347; Fri, 23 Jul 2021 02:44:30 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-86-ULdc_-n7NAyQc5EQq8fCyQ-1; Fri, 23 Jul 2021 05:44:27 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id A071A100CF6F; Fri, 23 Jul 2021 09:44:22 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 81EC55C1D5; Fri, 23 Jul 2021 09:44:22 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 49D04180BAB2; Fri, 23 Jul 2021 09:44:22 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 16N9i7th022903 for ; Fri, 23 Jul 2021 05:44:07 -0400 Received: by smtp.corp.redhat.com (Postfix) id E8F7B5C22A; Fri, 23 Jul 2021 09:44:07 +0000 (UTC) Received: from speedmetal.lan (unknown [10.40.208.38]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4F77C5C1D5 for ; Fri, 23 Jul 2021 09:44:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1627033470; 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=XYWCKYZlpSJBqfzoAzhmvg7jhCHQKbCmQdwLSak3MCM=; b=dII546rPOpM4KhhpbQMPcO+v1MDjsI+fYbi1QUWW9tRe0uRHB95WajcesD5+T3wRCOWvjD VWwyrK50YDT7uVd+U/HgPuxThXP1zVtQHc7TR0OBlvmEB3OXBhcjZcS0TP54EMLMLKkfgK yTI1xYVMWqXNUe3pxpip9yXYJUL1XXo= X-MC-Unique: ULdc_-n7NAyQc5EQq8fCyQ-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 4/6] qemumonitorjsontest: Add test case for 'blockdev-reopen' Date: Fri, 23 Jul 2021 11:43:56 +0200 Message-Id: <35453c9c93e310fc37c26d1298c7040df661731b.1627033243.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com 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: 1627033472245100003 Content-Type: text/plain; charset="utf-8" Export 'qemuBlockReopenFormatMon' and use it in a new test case wich will validate the arguments against the QMP schema. Signed-off-by: Peter Krempa --- src/qemu/qemu_block.c | 2 +- src/qemu/qemu_block.h | 5 +++++ tests/qemumonitorjsontest.c | 28 ++++++++++++++++++++++++++++ 3 files changed, 34 insertions(+), 1 deletion(-) diff --git a/src/qemu/qemu_block.c b/src/qemu/qemu_block.c index d9b876e5c1..eedcfd927f 100644 --- a/src/qemu/qemu_block.c +++ b/src/qemu/qemu_block.c @@ -3299,7 +3299,7 @@ qemuBlockBitmapsHandleCommitFinish(virStorageSource *= topsrc, } -static int +int qemuBlockReopenFormatMon(qemuMonitor *mon, virStorageSource *src) { diff --git a/src/qemu/qemu_block.h b/src/qemu/qemu_block.h index ff7048eb6c..54601a48a9 100644 --- a/src/qemu/qemu_block.h +++ b/src/qemu/qemu_block.h @@ -265,6 +265,11 @@ qemuBlockBitmapsHandleCommitFinish(virStorageSource *t= opsrc, GHashTable *blockNamedNodeData, virJSONValue **actions); +/* only for use in qemumonitorjsontest */ +int +qemuBlockReopenFormatMon(qemuMonitor *mon, + virStorageSource *src); + int qemuBlockReopenReadWrite(virDomainObj *vm, virStorageSource *src, diff --git a/tests/qemumonitorjsontest.c b/tests/qemumonitorjsontest.c index 0b321e8ed8..2122d9d999 100644 --- a/tests/qemumonitorjsontest.c +++ b/tests/qemumonitorjsontest.c @@ -2800,6 +2800,33 @@ testQemuMonitorJSONBlockExportAdd(const void *opaque) return 0; } + +static int +testQemuMonitorJSONBlockdevReopen(const void *opaque) +{ + const testGenericData *data =3D opaque; + g_autoptr(qemuMonitorTest) test =3D NULL; + g_autoptr(virStorageSource) src =3D virStorageSourceNew(); + + if (!(test =3D qemuMonitorTestNewSchema(data->xmlopt, data->schema))) + return -1; + + src->format =3D VIR_STORAGE_FILE_QCOW2; + src->readonly =3D true; + src->nodeformat =3D g_strdup("test node"); + src->nodestorage =3D g_strdup("backing nodename"); + src->backingStore =3D virStorageSourceNew(); + + if (qemuMonitorTestAddItem(test, "blockdev-reopen", "{\"return\":{}}")= < 0) + return -1; + + if (qemuBlockReopenFormatMon(qemuMonitorTestGetMonitor(test), src) < 0) + return -1; + + return 0; +} + + static int testQemuMonitorJSONqemuMonitorJSONGetCPUModelComparison(const void *opaque) { @@ -2997,6 +3024,7 @@ mymain(void) DO_TEST(GetIOThreads); DO_TEST(Transaction); DO_TEST(BlockExportAdd); + DO_TEST(BlockdevReopen); DO_TEST_SIMPLE("qmp_capabilities", qemuMonitorJSONSetCapabilities); DO_TEST_SIMPLE("system_powerdown", qemuMonitorJSONSystemPowerdown); DO_TEST_SIMPLE("system_reset", qemuMonitorJSONSystemReset); --=20 2.31.1