From nobody Sun Feb 8 20:17:32 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 205.139.110.61 as permitted sender) client-ip=205.139.110.61; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.61 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=1596736294; cv=none; d=zohomail.com; s=zohoarc; b=dh/e1mNn5CvwpsszROTEshDExkA3Vi+bd0t2tEpiY1ECHw6KNxFviQPsAIqK/hKg4PApCuEjGjiOJkUDIysnbDn2mZbcaI5qSZcnipaR1DN9cOVAUw9AECS5qz5OPEKWf9dnCzkiQ1NyiORvyuQRbVFmyaI2RMjLYI+S1sCJYUs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1596736294; 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=X7Wo/y0d8e8cM6gl12hDc6N27CipK2oKo2uLC3NecQg=; b=UQ/wKzk+2N/+7lqWd8XRB6XfJuiiNLFEwVIyRS1Qy/OhReye3zbb8FGOSPqe/7xl/HFqUi7PJATbAtp/E+hEAsStwdNxpft3P3WLbfr9sGBJtGPGptI+edafMPwlRxrGL6G86hnPFSyHaEQ2pgUTc+0+t0a5FiI+aqb7LN//STM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.61 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-1.mimecast.com (us-smtp-2.mimecast.com [205.139.110.61]) by mx.zohomail.com with SMTPS id 1596736294689441.5884787344921; Thu, 6 Aug 2020 10:51:34 -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-130-lrP2SD3XNyaSfnXdYuoICg-1; Thu, 06 Aug 2020 13:51:30 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 0F72791272; Thu, 6 Aug 2020 17:51:25 +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 B3E9F1002393; Thu, 6 Aug 2020 17:51:24 +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 4F5BA1809561; Thu, 6 Aug 2020 17:51:24 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 076Hoxvr000937 for ; Thu, 6 Aug 2020 13:50:59 -0400 Received: by smtp.corp.redhat.com (Postfix) id 09C3F1002397; Thu, 6 Aug 2020 17:50:59 +0000 (UTC) Received: from speedmetal.redhat.com (unknown [10.40.208.38]) by smtp.corp.redhat.com (Postfix) with ESMTP id 412151002393 for ; Thu, 6 Aug 2020 17:50:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1596736293; 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=X7Wo/y0d8e8cM6gl12hDc6N27CipK2oKo2uLC3NecQg=; b=EDJPsEfQmyF2QMSAbaPXMkdaL8xPixxMskDXdLwO8ZSkFxufNVJY1AQtGi7BOqmTF9ziYd n/z90JI8ASO4KlYjr6mugU2bItMtUMNJ7PdYmxamv97HSrlao1mTyoQHDv6ymK4/+5meFy SaMzCU3gYUGbKTkGdb+hT/El33jgwUI= X-MC-Unique: lrP2SD3XNyaSfnXdYuoICg-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 2/2] qemumonitorjsontest: Add a last-resort warning if object-add/device_add are QAPIfied Date: Thu, 6 Aug 2020 19:50:51 +0200 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 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.84 on 10.5.11.22 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) Content-Type: text/plain; charset="utf-8" When netdev-add was qapified it took us by surprise and we had to scramble to fix the internals to format conformant monitor arguments. Add a last-resort early warning system if this happens to object-add or device_add. Hopefully qemu developers notify us sooner than this. Signed-off-by: Peter Krempa --- tests/qemumonitorjsontest.c | 53 +++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) diff --git a/tests/qemumonitorjsontest.c b/tests/qemumonitorjsontest.c index 77e70c1dc4..bc25958e70 100644 --- a/tests/qemumonitorjsontest.c +++ b/tests/qemumonitorjsontest.c @@ -2888,6 +2888,55 @@ testQAPISchemaValidate(const void *opaque) } +/** + * testQAPISchemaObjectDeviceAdd: + * + * Purpose of this test is to add a last-resort notification that 'object-= add' + * and 'device_add' are not covered by the QMP schema by surprise. Ideally= QEMU + * developers will notify us before they switch so we have time to adapt o= ur + * generators first. This didn't work out when netdev-add was converted. + * + * We validate that the QMP schema describes only the expected types and n= othing + * else assuming that no new field will be added until final conversion. + */ +static int +testQAPISchemaObjectDeviceAdd(const void *opaque) +{ + virHashTablePtr schema =3D (virHashTablePtr) opaque; + virJSONValuePtr entry; + + if (virQEMUQAPISchemaPathGet("device_add/arg-type", schema, &entry) < = 0) { + fprintf(stderr, "schema for 'device_add' not found\n"); + return -1; + } + + if (testQEMUSchemaEntryMatchTemplate(entry, + "str:driver", + "str:bus", + "str:id", + NULL) < 0) { + VIR_TEST_VERBOSE("device_add has unexpected members in schema"); + return -1; + } + + if (virQEMUQAPISchemaPathGet("object-add/arg-type", schema, &entry) < = 0) { + fprintf(stderr, "schema for 'objectadd' not found\n"); + return -1; + } + + if (testQEMUSchemaEntryMatchTemplate(entry, + "str:qom-type", + "str:id", + "any:props", + NULL) < 0) { + VIR_TEST_VERBOSE("object-add has unexpected members in schema"); + return -1; + } + + return 0; +} + + static void testQueryJobsPrintJob(virBufferPtr buf, qemuMonitorJobInfoPtr job) @@ -3380,6 +3429,10 @@ mymain(void) #undef DO_TEST_QAPI_VALIDATE + if (virTestRun("validate that object-add and device_add don't have sch= ema", + testQAPISchemaObjectDeviceAdd, qapiData.schema) < 0) + ret =3D -1; + #define DO_TEST_QUERY_JOBS(name) \ do { \ struct testQueryJobsData data =3D { name, driver.xmlopt}; \ --=20 2.26.2