From nobody Thu Apr 25 16:08:15 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.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 216.205.24.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=1609941845; cv=none; d=zohomail.com; s=zohoarc; b=kibyEH0na6rTMLqZh7Kyg7KjhO+Hj8xT1HXueX4tTNvlQzGKTVYF5S67CPJrKxNDkZA/TrWOPZXda/NadgtHtSfw1ESUEPOahT0rT5CLA6mH+QhgM2WM9onTEDlM0b6Vq9kRhcY9pPEZmUQ+mQUAK7pfpPI0nKAVJbIT1j+WrI8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1609941845; 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=ccc3JgcU7wVcpHzCoBiW3eDRgajYCSRdtIWzjX8GQEQ=; b=OXSwD6mCtke2OGJB5C8oJkox0DuHhczD/XxsqAr+ZmtXzVqtnosfeHrwVSvKRR3TaLwZpt6Nrt4gSdhyG5D9QZylIjFk/UKGgH+fCOpT/Qg82Yc3VuTxEIsIoI662YhIDjffrgPqf88BE2kPbG4A9rhw1Nlmf0/lJdttXTibQMk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 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-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mx.zohomail.com with SMTPS id 1609941845185647.2574168266434; Wed, 6 Jan 2021 06:04:05 -0800 (PST) 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-393-ZPGwAjwXPLGJmVt6ciQOGQ-1; Wed, 06 Jan 2021 09:04:00 -0500 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 94E6084A5E4; Wed, 6 Jan 2021 14:03:53 +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 4B4EA5C22A; Wed, 6 Jan 2021 14:03:53 +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 718FD180954D; Wed, 6 Jan 2021 14:03:52 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 106E3nPb031319 for ; Wed, 6 Jan 2021 09:03:49 -0500 Received: by smtp.corp.redhat.com (Postfix) id C295237A0; Wed, 6 Jan 2021 14:03:49 +0000 (UTC) Received: from speedmetal.lan (unknown [10.40.208.30]) by smtp.corp.redhat.com (Postfix) with ESMTP id 22A9162467 for ; Wed, 6 Jan 2021 14:03:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1609941844; 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=ccc3JgcU7wVcpHzCoBiW3eDRgajYCSRdtIWzjX8GQEQ=; b=RqhGUqxMyHNuQp1Ls0bju9oYDFcn1HGkGpAo8qs2T32WwPbL7Un6FSJW/Ic1ENvwT9v6pZ lLujCNZLgvX7EPxLE+Ab6DWSxg3lHeAoCHGnZUUp5xE4DshYx/t8wRMqD2BJJQaIXpIczc ZrWHfYrZsDTquI2/GUs1uAfwsyNCg0g= X-MC-Unique: ZPGwAjwXPLGJmVt6ciQOGQ-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 01/12] qemuMonitorJSONSetMigrationParams: Take double pointer for @params Date: Wed, 6 Jan 2021 15:03:32 +0100 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 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) Content-Type: text/plain; charset="utf-8" This allows simplification of the caller as well as will enable a later refactor of qemuMonitorJSONMakeCommandInternal. Signed-off-by: Peter Krempa Reviewed-by: Michal Privoznik --- src/qemu/qemu_migration_params.c | 9 +++------ src/qemu/qemu_monitor.c | 11 +++-------- src/qemu/qemu_monitor.h | 2 +- src/qemu/qemu_monitor_json.c | 5 +++-- src/qemu/qemu_monitor_json.h | 2 +- 5 files changed, 11 insertions(+), 18 deletions(-) diff --git a/src/qemu/qemu_migration_params.c b/src/qemu/qemu_migration_par= ams.c index df5560d39f..d1d59aeb01 100644 --- a/src/qemu/qemu_migration_params.c +++ b/src/qemu/qemu_migration_params.c @@ -843,12 +843,9 @@ qemuMigrationParamsApply(virQEMUDriverPtr driver, if (!(params =3D qemuMigrationParamsToJSON(migParams))) goto cleanup; - if (virJSONValueObjectKeysNumber(params) > 0) { - rc =3D qemuMonitorSetMigrationParams(priv->mon, params); - params =3D NULL; - if (rc < 0) - goto cleanup; - } + if (virJSONValueObjectKeysNumber(params) > 0 && + qemuMonitorSetMigrationParams(priv->mon, ¶ms) < 0) + goto cleanup; ret =3D 0; diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c index 40f2997cb6..a81cd5fff5 100644 --- a/src/qemu/qemu_monitor.c +++ b/src/qemu/qemu_monitor.c @@ -2464,22 +2464,17 @@ qemuMonitorGetMigrationParams(qemuMonitorPtr mon, * @mon: Pointer to the monitor object. * @params: Migration parameters. * - * The @params object is consumed and should not be referenced by the call= er - * after this function returns. + * The @params object is consumed and cleared. * * Returns 0 on success, -1 on error. */ int qemuMonitorSetMigrationParams(qemuMonitorPtr mon, - virJSONValuePtr params) + virJSONValuePtr *params) { - QEMU_CHECK_MONITOR_GOTO(mon, error); + QEMU_CHECK_MONITOR(mon); return qemuMonitorJSONSetMigrationParams(mon, params); - - error: - virJSONValueFree(params); - return -1; } diff --git a/src/qemu/qemu_monitor.h b/src/qemu/qemu_monitor.h index 3a09b995ce..c543515cdc 100644 --- a/src/qemu/qemu_monitor.h +++ b/src/qemu/qemu_monitor.h @@ -793,7 +793,7 @@ int qemuMonitorSetMigrationCacheSize(qemuMonitorPtr mon, int qemuMonitorGetMigrationParams(qemuMonitorPtr mon, virJSONValuePtr *params); int qemuMonitorSetMigrationParams(qemuMonitorPtr mon, - virJSONValuePtr params); + virJSONValuePtr *params); typedef enum { QEMU_MONITOR_MIGRATION_STATUS_INACTIVE, diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c index 936254f0ec..ad517a99b8 100644 --- a/src/qemu/qemu_monitor_json.c +++ b/src/qemu/qemu_monitor_json.c @@ -3461,12 +3461,13 @@ qemuMonitorJSONGetMigrationParams(qemuMonitorPtr mo= n, int qemuMonitorJSONSetMigrationParams(qemuMonitorPtr mon, - virJSONValuePtr params) + virJSONValuePtr *params) { g_autoptr(virJSONValue) cmd =3D NULL; g_autoptr(virJSONValue) reply =3D NULL; + virJSONValuePtr par =3D g_steal_pointer(params); - if (!(cmd =3D qemuMonitorJSONMakeCommandInternal("migrate-set-paramete= rs", params))) + if (!(cmd =3D qemuMonitorJSONMakeCommandInternal("migrate-set-paramete= rs", par))) return -1; if (qemuMonitorJSONCommand(mon, cmd, &reply) < 0) diff --git a/src/qemu/qemu_monitor_json.h b/src/qemu/qemu_monitor_json.h index 4eb0f667a2..f3d7d204d6 100644 --- a/src/qemu/qemu_monitor_json.h +++ b/src/qemu/qemu_monitor_json.h @@ -140,7 +140,7 @@ int qemuMonitorJSONSetMigrationCacheSize(qemuMonitorPtr= mon, int qemuMonitorJSONGetMigrationParams(qemuMonitorPtr mon, virJSONValuePtr *params); int qemuMonitorJSONSetMigrationParams(qemuMonitorPtr mon, - virJSONValuePtr params); + virJSONValuePtr *params); int qemuMonitorJSONGetMigrationStats(qemuMonitorPtr mon, qemuMonitorMigrationStatsPtr stats, --=20 2.29.2 From nobody Thu Apr 25 16:08:15 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) client-ip=63.128.21.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 63.128.21.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=1609941859; cv=none; d=zohomail.com; s=zohoarc; b=BwkF56Ue7VcCZf6L8b2VRG6PpLCuDtU+YNJ7Hqt3I6oODimHW65fiHtacB/ZmatNZV55GgORwgBDsFL3J5n/1eGAe9n+DeCMq0IPaMt+iadoTJt3dHdQZTG7pU8QY4qqDFNU6GyTYQMFPmQ62tAFaA9MejY4toF3FaGd2+XO7eQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1609941859; 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=ApMD8LAG3yg/texCVQZ7Duwkhr4tG1Xa6icayiV+UAI=; b=bDWg8ZdtGfdGeA4wEGL4SMLYANvo0cS1VSbDEjpgMRt0ASK8UNRMiyxspJ2qnlmVU4E6B4ypFh1uLrAhTmlTXwSRZywTNhKjfPj/ZSC+XhhLV5lT13jcbOzGDFiNhx0qXFRN9cnBYwtCeE2Eufp7YOH54tf56AMeyKnpAXUfpEM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.124 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-124.mimecast.com (us-smtp-delivery-124.mimecast.com [63.128.21.124]) by mx.zohomail.com with SMTPS id 1609941859470572.2705962375278; Wed, 6 Jan 2021 06:04:19 -0800 (PST) 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-294-trP7UeWbNamlEz29xXSj2Q-1; Wed, 06 Jan 2021 09:04:14 -0500 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 520E4DF8A5; Wed, 6 Jan 2021 14:04:08 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 3149F5D9D2; Wed, 6 Jan 2021 14:04:08 +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 F14A15002F; Wed, 6 Jan 2021 14:04:07 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 106E3oOZ031332 for ; Wed, 6 Jan 2021 09:03:50 -0500 Received: by smtp.corp.redhat.com (Postfix) id E8EA71840B; Wed, 6 Jan 2021 14:03:50 +0000 (UTC) Received: from speedmetal.lan (unknown [10.40.208.30]) by smtp.corp.redhat.com (Postfix) with ESMTP id 39D2A37A0 for ; Wed, 6 Jan 2021 14:03:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1609941857; 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=ApMD8LAG3yg/texCVQZ7Duwkhr4tG1Xa6icayiV+UAI=; b=b5ylU9GBOfOTIaELtdmmOashKeaavPRgMlbT2K1QroHNWmcZQdm62cVoHIUmItvRO/4aoD ZKqg56o0UcLPjOuZk5/b3L18KchpvrozjnZ7WoQuGphoORDB76AIgDm/Oo2WIqZJKsE68H VS4enykHSyAD+l4jOHS+gWC2fh/mxZw= X-MC-Unique: trP7UeWbNamlEz29xXSj2Q-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 02/12] qemuMonitorSetMigrationCapabilities: Take double pointer for @caps Date: Wed, 6 Jan 2021 15:03:33 +0100 Message-Id: <183f278bc49ca0bcde00f294d52006efd7ef2c93.1609941694.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 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.14 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" This allows simplification of the callers. Signed-off-by: Peter Krempa Reviewed-by: Michal Privoznik --- src/qemu/qemu_migration_params.c | 13 ++++--------- src/qemu/qemu_monitor.c | 11 +++-------- src/qemu/qemu_monitor.h | 2 +- src/qemu/qemu_monitor_json.c | 5 ++--- src/qemu/qemu_monitor_json.h | 2 +- tests/qemumonitorjsontest.c | 3 +-- 6 files changed, 12 insertions(+), 24 deletions(-) diff --git a/src/qemu/qemu_migration_params.c b/src/qemu/qemu_migration_par= ams.c index d1d59aeb01..8c019bf2ce 100644 --- a/src/qemu/qemu_migration_params.c +++ b/src/qemu/qemu_migration_params.c @@ -803,7 +803,6 @@ qemuMigrationParamsApply(virQEMUDriverPtr driver, g_autoptr(virJSONValue) caps =3D NULL; qemuMigrationParam xbzrle =3D QEMU_MIGRATION_PARAM_XBZRLE_CACHE_SIZE; int ret =3D -1; - int rc; if (qemuDomainObjEnterMonitorAsync(driver, vm, asyncJob) < 0) return -1; @@ -819,12 +818,9 @@ qemuMigrationParamsApply(virQEMUDriverPtr driver, if (!(caps =3D qemuMigrationCapsToJSON(priv->migrationCaps, migPar= ams->caps))) goto cleanup; - if (virJSONValueArraySize(caps) > 0) { - rc =3D qemuMonitorSetMigrationCapabilities(priv->mon, caps); - caps =3D NULL; - if (rc < 0) - goto cleanup; - } + if (virJSONValueArraySize(caps) > 0 && + qemuMonitorSetMigrationCapabilities(priv->mon, &caps) < 0) + goto cleanup; } /* If QEMU is too old to support xbzrle-cache-size migration parameter, @@ -1389,8 +1385,7 @@ qemuMigrationCapsCheck(virQEMUDriverPtr driver, if (qemuDomainObjEnterMonitorAsync(driver, vm, asyncJob) < 0) return -1; - rc =3D qemuMonitorSetMigrationCapabilities(priv->mon, json); - json =3D NULL; + rc =3D qemuMonitorSetMigrationCapabilities(priv->mon, &json); if (qemuDomainObjExitMonitor(driver, vm) < 0) return -1; diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c index a81cd5fff5..8b1f90b363 100644 --- a/src/qemu/qemu_monitor.c +++ b/src/qemu/qemu_monitor.c @@ -3877,22 +3877,17 @@ qemuMonitorGetMigrationCapabilities(qemuMonitorPtr = mon, * @mon: Pointer to the monitor object. * @caps: Migration capabilities. * - * The @caps object is consumed and should not be referenced by the caller - * after this function returns. + * The @caps object is consumed cleared. * * Returns 0 on success, -1 on error. */ int qemuMonitorSetMigrationCapabilities(qemuMonitorPtr mon, - virJSONValuePtr caps) + virJSONValuePtr *caps) { - QEMU_CHECK_MONITOR_GOTO(mon, error); + QEMU_CHECK_MONITOR(mon); return qemuMonitorJSONSetMigrationCapabilities(mon, caps); - - error: - virJSONValueFree(caps); - return -1; } diff --git a/src/qemu/qemu_monitor.h b/src/qemu/qemu_monitor.h index c543515cdc..a07617ec28 100644 --- a/src/qemu/qemu_monitor.h +++ b/src/qemu/qemu_monitor.h @@ -864,7 +864,7 @@ int qemuMonitorGetMigrationStats(qemuMonitorPtr mon, int qemuMonitorGetMigrationCapabilities(qemuMonitorPtr mon, char ***capabilities); int qemuMonitorSetMigrationCapabilities(qemuMonitorPtr mon, - virJSONValuePtr caps); + virJSONValuePtr *caps); int qemuMonitorGetGICCapabilities(qemuMonitorPtr mon, virGICCapability **capabilities); diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c index ad517a99b8..0660c37e1e 100644 --- a/src/qemu/qemu_monitor_json.c +++ b/src/qemu/qemu_monitor_json.c @@ -6972,14 +6972,14 @@ qemuMonitorJSONGetMigrationCapabilities(qemuMonitor= Ptr mon, int qemuMonitorJSONSetMigrationCapabilities(qemuMonitorPtr mon, - virJSONValuePtr caps) + virJSONValuePtr *caps) { int ret =3D -1; virJSONValuePtr cmd =3D NULL; virJSONValuePtr reply =3D NULL; cmd =3D qemuMonitorJSONMakeCommand("migrate-set-capabilities", - "a:capabilities", &caps, + "a:capabilities", caps, NULL); if (!cmd) goto cleanup; @@ -6992,7 +6992,6 @@ qemuMonitorJSONSetMigrationCapabilities(qemuMonitorPt= r mon, ret =3D 0; cleanup: - virJSONValueFree(caps); virJSONValueFree(cmd); virJSONValueFree(reply); return ret; diff --git a/src/qemu/qemu_monitor_json.h b/src/qemu/qemu_monitor_json.h index f3d7d204d6..4a5292a69c 100644 --- a/src/qemu/qemu_monitor_json.h +++ b/src/qemu/qemu_monitor_json.h @@ -149,7 +149,7 @@ int qemuMonitorJSONGetMigrationStats(qemuMonitorPtr mon, int qemuMonitorJSONGetMigrationCapabilities(qemuMonitorPtr mon, char ***capabilities); int qemuMonitorJSONSetMigrationCapabilities(qemuMonitorPtr mon, - virJSONValuePtr caps); + virJSONValuePtr *caps); int qemuMonitorJSONGetGICCapabilities(qemuMonitorPtr mon, virGICCapability **capabilities); diff --git a/tests/qemumonitorjsontest.c b/tests/qemumonitorjsontest.c index d0c37967d5..13794c2886 100644 --- a/tests/qemumonitorjsontest.c +++ b/tests/qemumonitorjsontest.c @@ -2092,8 +2092,7 @@ testQemuMonitorJSONqemuMonitorJSONGetMigrationCapabil= ities(const void *opaque) goto cleanup; ret =3D qemuMonitorJSONSetMigrationCapabilities(qemuMonitorTestGetMoni= tor(test), - json); - json =3D NULL; + &json); cleanup: virJSONValueFree(json); --=20 2.29.2 From nobody Thu Apr 25 16:08:15 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.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 216.205.24.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=1609941845; cv=none; d=zohomail.com; s=zohoarc; b=aCj7OADlwSf/HLwoFceac8Y5DdGb3vzBb31HO9R3DM3tKg9l+DlJtXu7x8b3bLDg0U+u//IvgVJ/c7Ew3C+op7v4Col620OuM3MUK3NRopWTA58ODVdkRnpvYNYcTRrzMMFEwr5ojGaO44LKlJdaF1dBqUxbBB8V+ehl5OlU2Fc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1609941845; 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=7RnHtSU36jqCqTDyQQEZOYPKePtl1L9LYdxXVb7rEJo=; b=C1zgzP8zN0LDtBeXwA95HWGYZ9JQZgsQ/n977257WzcTq+w5jhW/XvRX+yYiW9T1VQqYSsaLlS4tDo2jeUCru+cjufbNt+Wqo8ednZmnb7mlyCu9YeK8nMeczFKxVmUv6PwXsPTXWeMzx/2Hxi3LLc9nC8OBs3c6OczYE9KQ8sY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 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-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mx.zohomail.com with SMTPS id 1609941845712812.0030464467538; Wed, 6 Jan 2021 06:04:05 -0800 (PST) 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-47-K741d3p1OM-rTvpogchUJQ-1; Wed, 06 Jan 2021 09:04:01 -0500 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id CB9DC1014E77; Wed, 6 Jan 2021 14:03:54 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 7A43B5D9CD; Wed, 6 Jan 2021 14:03:54 +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 048274E58E; Wed, 6 Jan 2021 14:03:54 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 106E3qYX031340 for ; Wed, 6 Jan 2021 09:03:52 -0500 Received: by smtp.corp.redhat.com (Postfix) id 5609137A0; Wed, 6 Jan 2021 14:03:52 +0000 (UTC) Received: from speedmetal.lan (unknown [10.40.208.30]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7335662467 for ; Wed, 6 Jan 2021 14:03:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1609941844; 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=7RnHtSU36jqCqTDyQQEZOYPKePtl1L9LYdxXVb7rEJo=; b=gCvWYG5XLNpMHYfZkQOiZfIk+HQu/7nLkdGuMjl5KDdkHKW4LtwiWPDiw52J9OzXy8jAri p8cMbxDQKo+EqJK4GLjwnp4cJsvt9GnjUsU5g5d4vFVAEp9nXgHIekGFsEt5LoyQaW07/G 3P/1ajzpr75bBgASEjg50OG/+NI40KE= X-MC-Unique: K741d3p1OM-rTvpogchUJQ-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 03/12] qemuMonitorJSONSetMigrationCapabilities: Refactor cleanup Date: Wed, 6 Jan 2021 15:03:34 +0100 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 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.14 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" Use automatic memory freeing and remove the 'cleanup' label and 'ret' variable. Signed-off-by: Peter Krempa Reviewed-by: Michal Privoznik --- src/qemu/qemu_monitor_json.c | 24 +++++++++--------------- 1 file changed, 9 insertions(+), 15 deletions(-) diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c index 0660c37e1e..cb31df3019 100644 --- a/src/qemu/qemu_monitor_json.c +++ b/src/qemu/qemu_monitor_json.c @@ -6974,27 +6974,21 @@ int qemuMonitorJSONSetMigrationCapabilities(qemuMonitorPtr mon, virJSONValuePtr *caps) { - int ret =3D -1; - virJSONValuePtr cmd =3D NULL; - virJSONValuePtr reply =3D NULL; + g_autoptr(virJSONValue) cmd =3D NULL; + g_autoptr(virJSONValue) reply =3D NULL; - cmd =3D qemuMonitorJSONMakeCommand("migrate-set-capabilities", - "a:capabilities", caps, - NULL); - if (!cmd) - goto cleanup; + if (!(cmd =3D qemuMonitorJSONMakeCommand("migrate-set-capabilities", + "a:capabilities", caps, + NULL))) + return -1; if (qemuMonitorJSONCommand(mon, cmd, &reply) < 0) - goto cleanup; + return -1; if (qemuMonitorJSONCheckError(cmd, reply) < 0) - goto cleanup; + return -1; - ret =3D 0; - cleanup: - virJSONValueFree(cmd); - virJSONValueFree(reply); - return ret; + return 0; } --=20 2.29.2 From nobody Thu Apr 25 16:08:15 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) client-ip=63.128.21.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 63.128.21.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=1609941858; cv=none; d=zohomail.com; s=zohoarc; b=n+3iJ2zfhvi5CcFPJOQnsoQ+8dHMgKYbQoGaBKXsiUeuxDMNca47bJt0gdZWPV5egs/YpS0a6umPUFrbgGhTvQ2P1IZUueLVpcF6JsBTZsh2gosagpEUwFYdgmWFfMIJiWmRArMDWBenLvGj8Xo2wbn8+qpIvGoKMW6OHnh2F4k= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1609941858; 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=GSQXHaQy/ZLSr4tSkzGAZZz5ByPoaT8h6jM2G3D6s5E=; b=Ny16AveJpLq92mNtNKlHabqrBoE5WujoV80u3USpgEkxdLXIg6jUKqc7nbJNoOeSwUtP8R62Ew+Jd064CtWDERVa3N05T34RtAf0tEtkBjAj0DuuTi52B9I0FvGWwM9VRN/yH75HZec2+sxyk2onntsAgKK8hz+btf1uMNuA2Ck= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.124 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-124.mimecast.com (us-smtp-delivery-124.mimecast.com [63.128.21.124]) by mx.zohomail.com with SMTPS id 1609941858370203.56209610108567; Wed, 6 Jan 2021 06:04:18 -0800 (PST) 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-_cmVdms3NeKCaNoftz6MCw-1; Wed, 06 Jan 2021 09:04:14 -0500 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 8F2EC80362D; Wed, 6 Jan 2021 14:04:07 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 6B26F5D9CD; Wed, 6 Jan 2021 14:04:07 +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 31CB64EEEE; Wed, 6 Jan 2021 14:04:07 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 106E3roK031358 for ; Wed, 6 Jan 2021 09:03:53 -0500 Received: by smtp.corp.redhat.com (Postfix) id AB5231840B; Wed, 6 Jan 2021 14:03:53 +0000 (UTC) Received: from speedmetal.lan (unknown [10.40.208.30]) by smtp.corp.redhat.com (Postfix) with ESMTP id DF49B37A0 for ; Wed, 6 Jan 2021 14:03:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1609941857; 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=GSQXHaQy/ZLSr4tSkzGAZZz5ByPoaT8h6jM2G3D6s5E=; b=HUepawrzRGLhNVyUI4U69SOYsNN7X1vhIzYCjRFjjCjCFa9oEs6IxSc0aLINW0aekhFwnJ HnuFINxvt6vZD06cUIiE+4EKTizqLZrLN4rpNZll8jntM3S5uzF6hi5jC1rblWWxM5V2CB SVdfSovkrzwMCDtG0SffdRJyS1dHIVo= X-MC-Unique: _cmVdms3NeKCaNoftz6MCw-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 04/12] testQemuMonitorJSONqemuMonitorJSONGetMigrationCapabilities: refactor cleanup Date: Wed, 6 Jan 2021 15:03:35 +0100 Message-Id: <728880c74acf12b1fe44ab3d2eb393957f501463.1609941694.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 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.14 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" Use automatic memory freeing to remove the 'cleanup:' label and 'ret' variable. Signed-off-by: Peter Krempa Reviewed-by: Michal Privoznik --- tests/qemumonitorjsontest.c | 25 +++++++++---------------- 1 file changed, 9 insertions(+), 16 deletions(-) diff --git a/tests/qemumonitorjsontest.c b/tests/qemumonitorjsontest.c index 13794c2886..29c396891b 100644 --- a/tests/qemumonitorjsontest.c +++ b/tests/qemumonitorjsontest.c @@ -2050,11 +2050,10 @@ testQemuMonitorJSONqemuMonitorJSONGetMigrationCapab= ilities(const void *opaque) { const testGenericData *data =3D opaque; virDomainXMLOptionPtr xmlopt =3D data->xmlopt; - int ret =3D -1; const char *cap; - char **caps =3D NULL; - virBitmapPtr bitmap =3D NULL; - virJSONValuePtr json =3D NULL; + g_auto(GStrv) caps =3D NULL; + g_autoptr(virBitmap) bitmap =3D NULL; + g_autoptr(virJSONValue) json =3D NULL; const char *reply =3D "{" " \"return\": [" @@ -2073,32 +2072,26 @@ testQemuMonitorJSONqemuMonitorJSONGetMigrationCapab= ilities(const void *opaque) if (qemuMonitorTestAddItem(test, "query-migrate-capabilities", reply) = < 0 || qemuMonitorTestAddItem(test, "migrate-set-capabilities", "{\"return\":{}}") < 0) - goto cleanup; + return -1; if (qemuMonitorGetMigrationCapabilities(qemuMonitorTestGetMonitor(test= ), &caps) < 0) - goto cleanup; + return -1; cap =3D qemuMigrationCapabilityTypeToString(QEMU_MIGRATION_CAP_XBZRLE); if (!virStringListHasString((const char **) caps, cap)) { virReportError(VIR_ERR_INTERNAL_ERROR, "Expected capability %s is missing", cap); - goto cleanup; + return -1; } bitmap =3D virBitmapNew(QEMU_MIGRATION_CAP_LAST); ignore_value(virBitmapSetBit(bitmap, QEMU_MIGRATION_CAP_XBZRLE)); if (!(json =3D qemuMigrationCapsToJSON(bitmap, bitmap))) - goto cleanup; - - ret =3D qemuMonitorJSONSetMigrationCapabilities(qemuMonitorTestGetMoni= tor(test), - &json); + return -1; - cleanup: - virJSONValueFree(json); - g_strfreev(caps); - virBitmapFree(bitmap); - return ret; + return qemuMonitorJSONSetMigrationCapabilities(qemuMonitorTestGetMonit= or(test), + &json); } static int --=20 2.29.2 From nobody Thu Apr 25 16:08:15 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.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 216.205.24.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=1609941908; cv=none; d=zohomail.com; s=zohoarc; b=HY11muNBErZAaB+n3l0zwIpJ7+Eq8mw/uOo04OYkdKsDTaJQfg98wOf19axTXwZeJjJpWSywIJ1djIWTbn5CXIR/Hk8XORMHPd0YkEAaa7FjVppcvF/ow/HcJpC0Bv2pCJbJxS82/76zM8/1yuygxCwID8QoxAI8GtITmnks+nQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1609941908; 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=ndfLO9CnMBFN8mgnaUsX9io36x2I6ENcIFqhPWKLffo=; b=NwiS92kXsWCzIZazALLFFhcFtKUTOpQNqUQzuIPQ7aAQLTcEpJutaiAFWl9rmcXO7dckIjeKw8BxfSxjWcwkTQhHWRUldzvDLSWCkbEgF2eG109l/JVLhTrj1Ssst9jcHg1qmsfyddlIKWoE1eIVD+sCN1dCh9lQAudRqFQ7fLs= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 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-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mx.zohomail.com with SMTPS id 1609941908953818.3959970821231; Wed, 6 Jan 2021 06:05:08 -0800 (PST) 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-555-J2PvbN05NrC3JFZtPj0SwA-1; Wed, 06 Jan 2021 09:04:18 -0500 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 61949803646; Wed, 6 Jan 2021 14:04:10 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 39D0210016FA; Wed, 6 Jan 2021 14:04:10 +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 01C3950032; Wed, 6 Jan 2021 14:04:10 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 106E3s7A031374 for ; Wed, 6 Jan 2021 09:03:54 -0500 Received: by smtp.corp.redhat.com (Postfix) id D7FC837A0; Wed, 6 Jan 2021 14:03:54 +0000 (UTC) Received: from speedmetal.lan (unknown [10.40.208.30]) by smtp.corp.redhat.com (Postfix) with ESMTP id 21A6762467 for ; Wed, 6 Jan 2021 14:03:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1609941908; 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=ndfLO9CnMBFN8mgnaUsX9io36x2I6ENcIFqhPWKLffo=; b=H38lfdec4Pz6vqUYtqV7tjnzbSOVBEAifrJMbEQ/XIc+p3VJYRhGJ7sacge0SIKmvpHR4Y Maz8m8VqsHkSHXnMt5Yu0arkjJlBFxocdwRREpWJS8KesW8avZvSrp0kdPfK5JBAL7ZOo1 5dj8mD4HCIOek70LS85knQ5jiNSaXEw= X-MC-Unique: J2PvbN05NrC3JFZtPj0SwA-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 05/12] qemuMonitorJSONAddObject: Take double pointer for @props Date: Wed, 6 Jan 2021 15:03:36 +0100 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 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" Prepare for a refactor of qemuMonitorJSONMakeCommandInternal. Signed-off-by: Peter Krempa Reviewed-by: Michal Privoznik --- src/qemu/qemu_monitor.c | 3 +-- src/qemu/qemu_monitor_json.c | 5 +++-- src/qemu/qemu_monitor_json.h | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c index 8b1f90b363..a55c4e19dd 100644 --- a/src/qemu/qemu_monitor.c +++ b/src/qemu/qemu_monitor.c @@ -3076,8 +3076,7 @@ qemuMonitorAddObject(qemuMonitorPtr mon, if (alias) tmp =3D g_strdup(id); - ret =3D qemuMonitorJSONAddObject(mon, *props); - *props =3D NULL; + ret =3D qemuMonitorJSONAddObject(mon, props); if (alias) *alias =3D g_steal_pointer(&tmp); diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c index cb31df3019..9116a8a8cb 100644 --- a/src/qemu/qemu_monitor_json.c +++ b/src/qemu/qemu_monitor_json.c @@ -4593,12 +4593,13 @@ qemuMonitorJSONAddDevice(qemuMonitorPtr mon, int qemuMonitorJSONAddObject(qemuMonitorPtr mon, - virJSONValuePtr props) + virJSONValuePtr *props) { g_autoptr(virJSONValue) cmd =3D NULL; g_autoptr(virJSONValue) reply =3D NULL; + virJSONValuePtr pr =3D g_steal_pointer(props); - if (!(cmd =3D qemuMonitorJSONMakeCommandInternal("object-add", props))) + if (!(cmd =3D qemuMonitorJSONMakeCommandInternal("object-add", pr))) return -1; if (qemuMonitorJSONCommand(mon, cmd, &reply) < 0) diff --git a/src/qemu/qemu_monitor_json.h b/src/qemu/qemu_monitor_json.h index 4a5292a69c..ba1531fee8 100644 --- a/src/qemu/qemu_monitor_json.h +++ b/src/qemu/qemu_monitor_json.h @@ -244,7 +244,7 @@ int qemuMonitorJSONDelDevice(qemuMonitorPtr mon, const char *devalias); int qemuMonitorJSONAddObject(qemuMonitorPtr mon, - virJSONValuePtr props); + virJSONValuePtr *props); int qemuMonitorJSONDelObject(qemuMonitorPtr mon, const char *objalias, --=20 2.29.2 From nobody Thu Apr 25 16:08:15 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) client-ip=63.128.21.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 63.128.21.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=1609941907; cv=none; d=zohomail.com; s=zohoarc; b=NL4yEfPw7rVFehrEYZT9umxZvpAmzohm1Jk+hpBzHep6MuFwxUqoyQct2euPR98vcCJjDblYciyMPb03UpB3SSAWe0pSKRzHWfFBgVNd03Q8VLLXAma1D2nZ96nX65qP6GhB+1622xhkcD/xCNxJEoM0Pbp8jRWGG7xkBHzLRYM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1609941907; 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=WbSy65InA8GjDM7zOhr3hoBMsz9C8QOYuDWgM9F0uYY=; b=KK5succxUVItZNM9wwWoGpvVjvvcDAsBZ0ztjYdzhDTzaT6wsmazqI5PbmlB259iV0hO1/Z6ChwdLed67ncrar5LrBoCNzeA9t+Cr3F4VPfz6Buylrw/LlsZWyKLDvQoaxv7M6Dj+K2mNOTohEqgWDxLFj1GT2Nt329aunnXRkk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.124 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-124.mimecast.com (us-smtp-delivery-124.mimecast.com [63.128.21.124]) by mx.zohomail.com with SMTPS id 1609941907050104.78040518662965; Wed, 6 Jan 2021 06:05:07 -0800 (PST) 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-26-2yO4rM9cPiO02Krky8IRiw-1; Wed, 06 Jan 2021 09:04:13 -0500 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 3560D107ACFB; Wed, 6 Jan 2021 14:04:07 +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 0B2DC6A8F3; Wed, 6 Jan 2021 14:04:07 +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 C5B841809CA1; Wed, 6 Jan 2021 14:04:06 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 106E3ugW031383 for ; Wed, 6 Jan 2021 09:03:56 -0500 Received: by smtp.corp.redhat.com (Postfix) id 195E137A0; Wed, 6 Jan 2021 14:03:56 +0000 (UTC) Received: from speedmetal.lan (unknown [10.40.208.30]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4D2186267A for ; Wed, 6 Jan 2021 14:03:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1609941905; 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=WbSy65InA8GjDM7zOhr3hoBMsz9C8QOYuDWgM9F0uYY=; b=ggC3NaCSG1sbWNXVr4XN6c+MLm3oY4gPrEqkh0kE7LyGAcKJOEwbBK6TmqPcMvD0Nf8tez Mkhj8xHZRoyQTXwwGtTI4ZXvjCKZHvP5HXniJnN+UcBUVUyrJ+5SKSiFmsLMNd89EjBpZk tudcZSb9yZxcjwdCR3XJ/ZI5q6GYLiQ= X-MC-Unique: 2yO4rM9cPiO02Krky8IRiw-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 06/12] qemuMonitorJSONMakeCommandInternal: Clear @arguments when stolen Date: Wed, 6 Jan 2021 15:03:37 +0100 Message-Id: <44dfcb3113bfbfc11c0f10232cb89dd6e93ebf61.1609941694.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 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.15 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" All callers of qemuMonitorJSONMakeCommandInternal will benefit from making @arguments a double pointer and passing it to virJSONValueObjectCreate directly which will clear it if it steals the value. Signed-off-by: Peter Krempa Reviewed-by: Michal Privoznik --- src/qemu/qemu_monitor_json.c | 32 ++++++++++++-------------------- 1 file changed, 12 insertions(+), 20 deletions(-) diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c index 9116a8a8cb..8a75a2734e 100644 --- a/src/qemu/qemu_monitor_json.c +++ b/src/qemu/qemu_monitor_json.c @@ -546,20 +546,18 @@ qemuMonitorJSONTransactionAdd(virJSONValuePtr actions, * * Create a JSON object used on the QMP monitor to call a command. * - * Note that @arguments is always consumed and should not be referenced af= ter - * the call to this function. + * Note that @arguments is consumed and cleared. */ static virJSONValuePtr qemuMonitorJSONMakeCommandInternal(const char *cmdname, - virJSONValuePtr arguments) + virJSONValuePtr *arguments) { virJSONValuePtr ret =3D NULL; ignore_value(virJSONValueObjectCreate(&ret, "s:execute", cmdname, - "A:arguments", &arguments, NULL)= ); + "A:arguments", arguments, NULL)); - virJSONValueFree(arguments); return ret; } @@ -569,7 +567,7 @@ qemuMonitorJSONMakeCommand(const char *cmdname, ...) { virJSONValuePtr obj =3D NULL; - virJSONValuePtr jargs =3D NULL; + g_autoptr(virJSONValue) jargs =3D NULL; va_list args; va_start(args, cmdname); @@ -577,7 +575,7 @@ qemuMonitorJSONMakeCommand(const char *cmdname, if (virJSONValueObjectCreateVArgs(&jargs, args) < 0) goto cleanup; - obj =3D qemuMonitorJSONMakeCommandInternal(cmdname, jargs); + obj =3D qemuMonitorJSONMakeCommandInternal(cmdname, &jargs); cleanup: va_end(args); @@ -3465,9 +3463,8 @@ qemuMonitorJSONSetMigrationParams(qemuMonitorPtr mon, { g_autoptr(virJSONValue) cmd =3D NULL; g_autoptr(virJSONValue) reply =3D NULL; - virJSONValuePtr par =3D g_steal_pointer(params); - if (!(cmd =3D qemuMonitorJSONMakeCommandInternal("migrate-set-paramete= rs", par))) + if (!(cmd =3D qemuMonitorJSONMakeCommandInternal("migrate-set-paramete= rs", params))) return -1; if (qemuMonitorJSONCommand(mon, cmd, &reply) < 0) @@ -3984,7 +3981,7 @@ int qemuMonitorJSONAddFileHandleToSet(qemuMonitorPtr = mon, return -1; } - if (!(cmd =3D qemuMonitorJSONMakeCommandInternal("add-fd", g_steal_poi= nter(&args)))) + if (!(cmd =3D qemuMonitorJSONMakeCommandInternal("add-fd", &args))) return -1; if (qemuMonitorJSONCommandWithFd(mon, cmd, fd, &reply) < 0) @@ -4168,9 +4165,8 @@ qemuMonitorJSONAddNetdev(qemuMonitorPtr mon, { g_autoptr(virJSONValue) cmd =3D NULL; g_autoptr(virJSONValue) reply =3D NULL; - virJSONValuePtr pr =3D g_steal_pointer(props); - if (!(cmd =3D qemuMonitorJSONMakeCommandInternal("netdev_add", pr))) + if (!(cmd =3D qemuMonitorJSONMakeCommandInternal("netdev_add", props))) return -1; if (qemuMonitorJSONCommand(mon, cmd, &reply) < 0) @@ -4597,9 +4593,8 @@ qemuMonitorJSONAddObject(qemuMonitorPtr mon, { g_autoptr(virJSONValue) cmd =3D NULL; g_autoptr(virJSONValue) reply =3D NULL; - virJSONValuePtr pr =3D g_steal_pointer(props); - if (!(cmd =3D qemuMonitorJSONMakeCommandInternal("object-add", pr))) + if (!(cmd =3D qemuMonitorJSONMakeCommandInternal("object-add", props))) return -1; if (qemuMonitorJSONCommand(mon, cmd, &reply) < 0) @@ -7347,9 +7342,8 @@ qemuMonitorJSONBlockExportAdd(qemuMonitorPtr mon, { g_autoptr(virJSONValue) cmd =3D NULL; g_autoptr(virJSONValue) reply =3D NULL; - virJSONValuePtr pr =3D g_steal_pointer(props); - if (!(cmd =3D qemuMonitorJSONMakeCommandInternal("block-export-add", p= r))) + if (!(cmd =3D qemuMonitorJSONMakeCommandInternal("block-export-add", p= rops))) return -1; if (qemuMonitorJSONCommand(mon, cmd, &reply) < 0) @@ -8866,9 +8860,8 @@ qemuMonitorJSONBlockdevAdd(qemuMonitorPtr mon, { g_autoptr(virJSONValue) cmd =3D NULL; g_autoptr(virJSONValue) reply =3D NULL; - virJSONValuePtr pr =3D g_steal_pointer(props); - if (!(cmd =3D qemuMonitorJSONMakeCommandInternal("blockdev-add", pr))) + if (!(cmd =3D qemuMonitorJSONMakeCommandInternal("blockdev-add", props= ))) return -1; if (qemuMonitorJSONCommand(mon, cmd, &reply) < 0) @@ -8887,9 +8880,8 @@ qemuMonitorJSONBlockdevReopen(qemuMonitorPtr mon, { g_autoptr(virJSONValue) cmd =3D NULL; g_autoptr(virJSONValue) reply =3D NULL; - virJSONValuePtr pr =3D g_steal_pointer(props); - if (!(cmd =3D qemuMonitorJSONMakeCommandInternal("blockdev-reopen", pr= ))) + if (!(cmd =3D qemuMonitorJSONMakeCommandInternal("blockdev-reopen", pr= ops))) return -1; if (qemuMonitorJSONCommand(mon, cmd, &reply) < 0) --=20 2.29.2 From nobody Thu Apr 25 16:08:15 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) client-ip=63.128.21.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 63.128.21.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=1609941866; cv=none; d=zohomail.com; s=zohoarc; b=QHOuXMt6CoFG4XEt1flDtIw1W3hNRZaTAEcWLibwBdJi8oYij7lkJ+B92/mK94LC3fXIRTf0A0vDBE5KAJzEHviA9JhJke6rvkAJJQz1cbqOML4QJL7H52f+W+ahvvZuR3cjOST1zZ3pkSR8ZFwNk6TR6LvmS4AItvoTlTeRFwk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1609941866; 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=xg0e3wC+zinCDIPEP9gtiVGEy148edL3BusunFPDw7I=; b=n/KdUY18SQJPxtHm1Q7lIihS2Q9+D1RvB+cqLuW4dfSaGMV2iLanZUhE+f8MMCcIgoM0uFFHNO6difndZhbDPJA0k3sksgTIcGW8r8W//CIpTeibQp3CQfa9WY3gdPN3vjw7tsgIIvsFC9J6QS3x4hJCPvTOLaYXgauyzW24cQM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.124 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-124.mimecast.com (us-smtp-delivery-124.mimecast.com [63.128.21.124]) by mx.zohomail.com with SMTPS id 1609941866746897.6529874787428; Wed, 6 Jan 2021 06:04:26 -0800 (PST) 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-262-VO3JXwTIM0aYP7c3ilfRrg-1; Wed, 06 Jan 2021 09:04:22 -0500 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 67686EC1A3; Wed, 6 Jan 2021 14:04:15 +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 42C7C5C1C4; Wed, 6 Jan 2021 14:04:15 +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 F2B1B1809CA9; Wed, 6 Jan 2021 14:04:14 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 106E3vfb031394 for ; Wed, 6 Jan 2021 09:03:57 -0500 Received: by smtp.corp.redhat.com (Postfix) id 49E6037A0; Wed, 6 Jan 2021 14:03:57 +0000 (UTC) Received: from speedmetal.lan (unknown [10.40.208.30]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8B9FA6267A for ; Wed, 6 Jan 2021 14:03:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1609941865; 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=xg0e3wC+zinCDIPEP9gtiVGEy148edL3BusunFPDw7I=; b=AO5t4v3O29ig684V+SUoLhQneJ725RHEwVVV+qtTUuAzgNv5trF2B6MCG0oTWMEYYFeGFw eUz3Es8LQo6KQ5ZjYJNTd09Sn2t7sShxxVlo/yRUll0MZzH1hmvy7ifPk6nhlmEjBDh+jF cVHJcs+BcdQHv1i7rsgr31vQuNlAuvE= X-MC-Unique: VO3JXwTIM0aYP7c3ilfRrg-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 07/12] qemuMonitorAddObject: Fix semantics of @alias Date: Wed, 6 Jan 2021 15:03:38 +0100 Message-Id: <8d3207ca31888dbb4a31a60d0b97ee9216b8f754.1609941694.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 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) Content-Type: text/plain; charset="utf-8" The callers of qemuMonitorAddObject rely on the fact that @alias is filled only when the object is added successfully. This is documented but the code didn't behave like that. Signed-off-by: Peter Krempa Reviewed-by: Michal Privoznik --- src/qemu/qemu_monitor.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c index a55c4e19dd..7919eb3a04 100644 --- a/src/qemu/qemu_monitor.c +++ b/src/qemu/qemu_monitor.c @@ -3076,11 +3076,14 @@ qemuMonitorAddObject(qemuMonitorPtr mon, if (alias) tmp =3D g_strdup(id); - ret =3D qemuMonitorJSONAddObject(mon, props); + if (qemuMonitorJSONAddObject(mon, props) < 0) + goto cleanup; if (alias) *alias =3D g_steal_pointer(&tmp); + ret =3D 0; + cleanup: VIR_FREE(tmp); virJSONValueFree(*props); --=20 2.29.2 From nobody Thu Apr 25 16:08:15 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) client-ip=63.128.21.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 63.128.21.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=1609941859; cv=none; d=zohomail.com; s=zohoarc; b=lmxV8bec5q+YngMOzmx7/xx+shWH+rER8fkaqkWGjqjXkv8CnbPSY9GbCXAW5bVqNZw2D4VLy+i4ANFVn/wCQpsM4andFRg8NwFrof5fJ0ggDEdCq17c18r435mc2UssLLaMT4liB/Ooj2s0FD9Ny3cO9tYPj4pyb/nS9ojb1kU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1609941859; 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=w7q/VKJmOEuo16BNoyfPGreOcZ21fjZnq44s3AEpRh8=; b=f4PZvve09xj4wjLkk6rT+5t1PXOjVbHCGDZ+Bg9kn+sMrQruys3BOj+Aj/WTebuj7QEvu+z5qLhuPaVw8Lx/PSTbM3lFI5nFKGnHzO7YPDxqtFnzRG8LsqBKDgR2P/SH98WaF8iBCqXXcw2cNEm8KzaqluvnYDtp5I4nzaRDJPY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.124 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-124.mimecast.com (us-smtp-delivery-124.mimecast.com [63.128.21.124]) by mx.zohomail.com with SMTPS id 1609941859606949.3330507140188; Wed, 6 Jan 2021 06:04:19 -0800 (PST) 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-382-Oi8ZvnxuPg2JZel-P3dMiQ-1; Wed, 06 Jan 2021 09:04:16 -0500 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 06E01803627; Wed, 6 Jan 2021 14:04:10 +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 DAABD5D9D7; Wed, 6 Jan 2021 14:04:09 +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 A25E51809CA2; Wed, 6 Jan 2021 14:04:09 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 106E3wTA031409 for ; Wed, 6 Jan 2021 09:03:58 -0500 Received: by smtp.corp.redhat.com (Postfix) id 7CD4F37A0; Wed, 6 Jan 2021 14:03:58 +0000 (UTC) Received: from speedmetal.lan (unknown [10.40.208.30]) by smtp.corp.redhat.com (Postfix) with ESMTP id B60A462467 for ; Wed, 6 Jan 2021 14:03:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1609941858; 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=w7q/VKJmOEuo16BNoyfPGreOcZ21fjZnq44s3AEpRh8=; b=TKMyZBw1zpBec5KPWrwubKBv0WBo+Oj4bSJUHGDHRZOni4qVHbIRG9FKUv1ixn6u8ZHIeu v9mXnF3pHnJGLIhxTAiscv9yYvnb8s5ZznfvRBwVRj0sEvvm5f5451mVquUuMB+edtTDqm 4NDYhKuh3lYOc3p+QSKFeyGl2knYFDw= X-MC-Unique: Oi8ZvnxuPg2JZel-P3dMiQ-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 08/12] qemuMonitorAddObject: Refactor cleanup Date: Wed, 6 Jan 2021 15:03:39 +0100 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 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.14 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" Remove freeing/clearing of @props as the function doesn't guarantee that it happens on success, rename the variable hodling copy of the alias and use g_autofree to automatically free it and remove the cleanup label as well as 'ret' variable. Signed-off-by: Peter Krempa Reviewed-by: Michal Privoznik --- src/qemu/qemu_monitor.c | 23 ++++++++--------------- 1 file changed, 8 insertions(+), 15 deletions(-) diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c index 7919eb3a04..55ec032b5f 100644 --- a/src/qemu/qemu_monitor.c +++ b/src/qemu/qemu_monitor.c @@ -3050,13 +3050,12 @@ qemuMonitorAddObject(qemuMonitorPtr mon, { const char *type =3D NULL; const char *id =3D NULL; - char *tmp =3D NULL; - int ret =3D -1; + g_autofree char *aliasCopy =3D NULL; if (!*props) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("object props can't be NULL")); - goto cleanup; + return -1; } type =3D virJSONValueObjectGetString(*props, "qom-type"); @@ -3064,31 +3063,25 @@ qemuMonitorAddObject(qemuMonitorPtr mon, VIR_DEBUG("type=3D%s id=3D%s", NULLSTR(type), NULLSTR(id)); - QEMU_CHECK_MONITOR_GOTO(mon, cleanup); + QEMU_CHECK_MONITOR(mon); if (!id || !type) { virReportError(VIR_ERR_INTERNAL_ERROR, _("missing alias or qom-type for qemu object '%s'"), NULLSTR(type)); - goto cleanup; + return -1; } if (alias) - tmp =3D g_strdup(id); + aliasCopy =3D g_strdup(id); if (qemuMonitorJSONAddObject(mon, props) < 0) - goto cleanup; + return -1; if (alias) - *alias =3D g_steal_pointer(&tmp); - - ret =3D 0; + *alias =3D g_steal_pointer(&aliasCopy); - cleanup: - VIR_FREE(tmp); - virJSONValueFree(*props); - *props =3D NULL; - return ret; + return 0; } --=20 2.29.2 From nobody Thu Apr 25 16:08:15 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=1609941865; cv=none; d=zohomail.com; s=zohoarc; b=Ulkz0W4T5X/47tP5zUom/AjdReK/2ZHyjYkbF3b/b3ci1J7sStmgRnQwxNQt9x2zDpMZAv20xhc6yeRDcuHjywE2Huv6OR9GUgBhe2d3VVnqCKuiFTuiZp24vf6XvE2qkxigYSPdfQ+q6ymxZgXHViOsInXDw7yL2WsXPs8t03k= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1609941865; 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=OTVULDqW36+UgYIcOnw5RUkMyK3+5xFhRw/ndkN9VyY=; b=VVPwl5EwC/l5p9qiESQSRzwH8rbpZb+ESaKVc9J7YwcVrZMBH8F1I5YsTHhklnRFHHt0Z2ekgxEVE66DlpUhY86k4J0h7D1730HFz/a5jczV5w3UIwuDRC3TlLj3myY1k7IH0RL47raZ6KFxclmM8Uq1r0sEjeTOHI3Q9iFADDo= 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) header.from= 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 1609941865799177.58082925115104; Wed, 6 Jan 2021 06:04:25 -0800 (PST) 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-10-DGDt-pqbNsG28_7TbwuRlg-1; Wed, 06 Jan 2021 09:04:22 -0500 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 159A0180E46C; Wed, 6 Jan 2021 14:04:13 +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 E0E6C1002393; Wed, 6 Jan 2021 14:04:12 +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 A71261809CA5; Wed, 6 Jan 2021 14:04:12 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 106E3xLd031420 for ; Wed, 6 Jan 2021 09:03:59 -0500 Received: by smtp.corp.redhat.com (Postfix) id 99AE26267A; Wed, 6 Jan 2021 14:03:59 +0000 (UTC) Received: from speedmetal.lan (unknown [10.40.208.30]) by smtp.corp.redhat.com (Postfix) with ESMTP id F15B462680 for ; Wed, 6 Jan 2021 14:03:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1609941864; 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=OTVULDqW36+UgYIcOnw5RUkMyK3+5xFhRw/ndkN9VyY=; b=aI9dq4vywxo6bIkpK+a/4Q0wkUZYBuVPkkopE2tm2amUGVQZqbxUQ3GBs4d2T+C6o2KoO8 ojh1/uSWUnoK3Nv9Wn0OQgZjFTnA2lCASAzQGbO2XoCIJ9PL9dSiGBPmN/z2N2T//RQwQ7 GFpi1kCvjp7iMDR/sPGgW2Fky/FZ3YE= X-MC-Unique: DGDt-pqbNsG28_7TbwuRlg-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 09/12] util: json: Replace virJSONValueObjectSteal by virJSONValueObjectRemoveKey Date: Wed, 6 Jan 2021 15:03:40 +0100 Message-Id: <6e90af722d0d52f26b115bd814e5f5ca2a10cbc8.1609941694.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 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" virJSONValueObjectRemoveKey can be used as direct replacement. Fix the one caller and remove the duplicate function. Signed-off-by: Peter Krempa Reviewed-by: Michal Privoznik --- src/util/virjson.c | 29 ++++------------------------- 1 file changed, 4 insertions(+), 25 deletions(-) diff --git a/src/util/virjson.c b/src/util/virjson.c index c80c2f1ecb..f85b61957c 100644 --- a/src/util/virjson.c +++ b/src/util/virjson.c @@ -883,30 +883,6 @@ virJSONValueObjectGet(virJSONValuePtr object, } -static virJSONValuePtr -virJSONValueObjectSteal(virJSONValuePtr object, - const char *key) -{ - size_t i; - virJSONValuePtr obj =3D NULL; - - if (object->type !=3D VIR_JSON_TYPE_OBJECT) - return NULL; - - for (i =3D 0; i < object->data.object.npairs; i++) { - if (STREQ(object->data.object.pairs[i].key, key)) { - obj =3D g_steal_pointer(&object->data.object.pairs[i].value); - VIR_FREE(object->data.object.pairs[i].key); - VIR_DELETE_ELEMENT(object->data.object.pairs, i, - object->data.object.npairs); - break; - } - } - - return obj; -} - - /* Return the value associated with KEY within OBJECT, but return NULL * if the key is missing or if value is not the correct TYPE. */ virJSONValuePtr @@ -929,7 +905,10 @@ virJSONValueObjectStealByType(virJSONValuePtr object, const char *key, virJSONType type) { - virJSONValuePtr value =3D virJSONValueObjectSteal(object, key); + virJSONValuePtr value; + + if (virJSONValueObjectRemoveKey(object, key, &value) <=3D 0) + return NULL; if (value && value->type =3D=3D type) return value; --=20 2.29.2 From nobody Thu Apr 25 16:08:15 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.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 216.205.24.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=1609941904; cv=none; d=zohomail.com; s=zohoarc; b=EJOzKpC/CGGyuAyuJADD7jeI6h/0KDO1//flgZhsjUEJtLqISSbxmCyODBb5pjqDU9sF4MawJQEN/fTARvKXdP6csQNb7nMnbeaJN7iefKGF/gDH4KHaTQL8Ji6MjuMQAFMJ7skOhrDsmBT0wdn75L3Xm/b9igcLMaJx6Qa2xyg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1609941904; 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=NIp8HimGrFLWRyZMWlLETSjKuS2Op1ZlIZpPf84KDbo=; b=FdjNQCveb0pCKRbxYKw3WA/FsDiz4V7fFtozGuN55VX5uqWpt0EhaBTI6nSECIGfAU5lH4dKw6uwlEx8V5DttfozvxdKixv1aVkHo6DC6mnhWdvy+SFa1+AGvS/YyF9V0VwMPC5+rpKoMEBObRqN/niI7dzVbEZkG9bTYMfGBEc= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 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-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mx.zohomail.com with SMTPS id 1609941904001570.0557632681506; Wed, 6 Jan 2021 06:05:04 -0800 (PST) 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-391-SLfA__YBOV6q6KGH4ZnDpQ-1; Wed, 06 Jan 2021 09:04:24 -0500 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id DA3C1180E492; Wed, 6 Jan 2021 14:04:15 +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 A1FF727CB2; Wed, 6 Jan 2021 14:04:15 +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 6123A1809CAB; Wed, 6 Jan 2021 14:04:15 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 106E42Z8031442 for ; Wed, 6 Jan 2021 09:04:02 -0500 Received: by smtp.corp.redhat.com (Postfix) id ACED862686; Wed, 6 Jan 2021 14:04:02 +0000 (UTC) Received: from speedmetal.lan (unknown [10.40.208.30]) by smtp.corp.redhat.com (Postfix) with ESMTP id 093F46267A for ; Wed, 6 Jan 2021 14:03:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1609941902; 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=NIp8HimGrFLWRyZMWlLETSjKuS2Op1ZlIZpPf84KDbo=; b=K7+/oGhSxEZ/MuPJoyljHJJ/XLiYXUwOumZEp1TLwK5KNnrQILyUhOm3P67lWjJ8ngFR0r J4b+DOZxo6BTuv9uo56u0DPzr/Mj1zEfNbpxHQ7PPALdXntnkWAkuGoNjFxHR7YKLsQeRJ m4BsKQb+18tyHBRCWomYuaqpTlP7G6M= X-MC-Unique: SLfA__YBOV6q6KGH4ZnDpQ-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 10/12] tests: qemuxml2argv: Don't check whether -netdev was QAPIfied repeatedly Date: Wed, 6 Jan 2021 15:03:41 +0100 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 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.23 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" Check once before looping through the args. Signed-off-by: Peter Krempa Reviewed-by: Michal Privoznik --- tests/qemuxml2argvtest.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c index d2712e0dce..662d0d5df6 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -524,6 +524,7 @@ testCompareXMLToArgvValidateSchema(virQEMUDriverPtr drv, g_autoptr(GHashTable) schema =3D NULL; g_autoptr(virCommand) cmd =3D NULL; unsigned int parseFlags =3D info->parseFlags; + bool netdevQAPIfied =3D false; if (info->schemafile) schema =3D testQEMUSchemaLoad(info->schemafile); @@ -552,6 +553,8 @@ testCompareXMLToArgvValidateSchema(virQEMUDriverPtr drv, if (virCommandGetArgList(cmd, &args, &nargs) < 0) return -1; + netdevQAPIfied =3D !virQEMUQAPISchemaPathExists("netdev_add/arg-type/t= ype/!string", schema); + for (i =3D 0; i < nargs; i++) { g_auto(virBuffer) debug =3D VIR_BUFFER_INITIALIZER; g_autoptr(virJSONValue) jsonargs =3D NULL; @@ -569,13 +572,14 @@ testCompareXMLToArgvValidateSchema(virQEMUDriverPtr d= rv, i++; } else if (STREQ(args[i], "-netdev")) { + if (!netdevQAPIfied) { + i++; + continue; + } + if (!(jsonargs =3D virJSONValueFromString(args[i + 1]))) return -1; - /* skip the validation for pre-QAPIfication cases */ - if (virQEMUQAPISchemaPathExists("netdev_add/arg-type/type/!str= ing", schema)) - continue; - if (testQEMUSchemaValidateCommand("netdev_add", jsonargs, schema, false, false, &debug= ) < 0) { VIR_TEST_VERBOSE("failed to validate -netdev '%s' against = QAPI schema: %s", --=20 2.29.2 From nobody Thu Apr 25 16:08:15 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.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 216.205.24.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=1609941871; cv=none; d=zohomail.com; s=zohoarc; b=fCmwEjfnZ24LtqBO4pmvRSVu4PvRnaeOAWv5Ecrgplh1/Wcrq85uKBPEPOc5Qnxtvy8eMWLPT/KNltbj9TlpnOCA7XA0zj9C2dk4UgRBQQC/Y68mKYF7MgT6A4Mj9ePqThtDKBm8t5FllstLH+1U94QPY15jHVcDGR1eUJnI9/Q= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1609941871; 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=cqhLTBcFdCnAYizJcfqpKnVyKSPR1AdQw5fIML3CvFU=; b=DrqM1aZQ+XM/IqXpDYztA16eM2Z5IohrOMgWQkr0nLafGD72F16JZCL2QOKu9zX7h/tP1TL/UYWcwgCY0Qx6kRUNfMuzk81MtlVZnchRY3pTKOBA5+MJDaNEh2PKxGEMHuG0pj+eGRV00cp1RelgPG0wALWy2rjYouuHqnheK9k= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 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-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mx.zohomail.com with SMTPS id 1609941871088681.7046243992836; Wed, 6 Jan 2021 06:04:31 -0800 (PST) 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-427-wNGu3dKSNJGBb8vhze4uGg-1; Wed, 06 Jan 2021 09:04:24 -0500 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 53DBC8049C5; Wed, 6 Jan 2021 14:04:18 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 27B411FDE9; Wed, 6 Jan 2021 14:04:18 +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 E445650033; Wed, 6 Jan 2021 14:04:17 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 106E49iu031463 for ; Wed, 6 Jan 2021 09:04:09 -0500 Received: by smtp.corp.redhat.com (Postfix) id 027641945B; Wed, 6 Jan 2021 14:04:09 +0000 (UTC) Received: from speedmetal.lan (unknown [10.40.208.30]) by smtp.corp.redhat.com (Postfix) with ESMTP id 613BA62464 for ; Wed, 6 Jan 2021 14:04:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1609941868; 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=cqhLTBcFdCnAYizJcfqpKnVyKSPR1AdQw5fIML3CvFU=; b=I2Y2yL1dmr3Sc9GJX/4HDi+BbpAlcCAjzUumW77EqDriSi3tsnhDcW7A/dVA2RZHWCJe9G +/aHCvTyOP7O5l1HUELar0RlDsEtY8axuOZ38BGFl82JB6LBHJs+sKlWrLx3jUUhwh2iuH xWvC07ZfVnesjT4oIaW6wY/g4j4FTIE= X-MC-Unique: wNGu3dKSNJGBb8vhze4uGg-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 11/12] qemuBuildChrChardevStr: Rename 'flags' to 'cdevflags' Date: Wed, 6 Jan 2021 15:03:42 +0100 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 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.23 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" The monitor code uses 'flags' for the flags of the monitor builder, while in this function it's a different set of flags. All callers pass a variable named 'cdevflags', so rename the argument to suit. Signed-off-by: Peter Krempa Reviewed-by: Michal Privoznik --- src/qemu/qemu_command.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 02f956ce48..3e6518b96d 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -4756,7 +4756,7 @@ qemuBuildChrChardevStr(virLogManagerPtr logManager, const virDomainChrSourceDef *dev, const char *alias, virQEMUCapsPtr qemuCaps, - unsigned int flags) + unsigned int cdevflags) { qemuDomainChrSourcePrivatePtr chrSourcePriv =3D QEMU_DOMAIN_CHR_SOURCE= _PRIVATE(dev); g_auto(virBuffer) buf =3D VIR_BUFFER_INITIALIZER; @@ -4789,7 +4789,7 @@ qemuBuildChrChardevStr(virLogManagerPtr logManager, case VIR_DOMAIN_CHR_TYPE_FILE: virBufferAsprintf(&buf, "file,id=3D%s", charAlias); - if (qemuBuildChrChardevFileStr(flags & QEMU_BUILD_CHARDEV_FILE_LOG= D ? + if (qemuBuildChrChardevFileStr(cdevflags & QEMU_BUILD_CHARDEV_FILE= _LOGD ? logManager : NULL, cmd, def, &buf, "path", dev->data.file.path, @@ -4838,7 +4838,7 @@ qemuBuildChrChardevStr(virLogManagerPtr logManager, if (dev->data.tcp.listen) { virBufferAddLit(&buf, ",server"); - if (flags & QEMU_BUILD_CHARDEV_TCP_NOWAIT) + if (cdevflags & QEMU_BUILD_CHARDEV_TCP_NOWAIT) virBufferAddLit(&buf, ",nowait"); } @@ -4878,7 +4878,7 @@ qemuBuildChrChardevStr(virLogManagerPtr logManager, case VIR_DOMAIN_CHR_TYPE_UNIX: virBufferAsprintf(&buf, "socket,id=3D%s", charAlias); if (dev->data.nix.listen && - (flags & QEMU_BUILD_CHARDEV_UNIX_FD_PASS) && + (cdevflags & QEMU_BUILD_CHARDEV_UNIX_FD_PASS) && virQEMUCapsGet(qemuCaps, QEMU_CAPS_CHARDEV_FD_PASS)) { int fd; @@ -4901,7 +4901,7 @@ qemuBuildChrChardevStr(virLogManagerPtr logManager, } if (dev->data.nix.listen) { virBufferAddLit(&buf, ",server"); - if (flags & QEMU_BUILD_CHARDEV_TCP_NOWAIT) + if (cdevflags & QEMU_BUILD_CHARDEV_TCP_NOWAIT) virBufferAddLit(&buf, ",nowait"); } --=20 2.29.2 From nobody Thu Apr 25 16:08:15 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) client-ip=63.128.21.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 63.128.21.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=1609941871; cv=none; d=zohomail.com; s=zohoarc; b=HJC7eis+gKLYXNVCQqEVYAvXJiRAKCxW9KOk7JHzJEfm/N5RKurvuig5G1SXxpmLFd/iBkSJfyRECs72mNtDDLE30UGhFafjzRLoiJH+6P44qospnDUYxFMuYYS25Y3KKXfCjJxhkEZEY+uKUj5bevLZ3GM5vXar4lkwAAHnpSI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1609941871; 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=MTOlyA/c9yGIPBwJ9hDSN7UfWCGKhnH1BUv0BCX94sE=; b=PloXZUANAVDTW04Y1H4swzu75lVFhRPh1b1ggilC0q+lEIYAtovnaup7YBviOK8Z/6Yf5zkAwGTW6Fd3GQ5ngVISC56YSQ6p2IR3iWZbUB9oQI3OhFa6woJYzTtEd88IfUmK7rBXovrHQotSMIrMJJYGNUxaLsjcKC2f7mLVh5U= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.124 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-124.mimecast.com (us-smtp-delivery-124.mimecast.com [63.128.21.124]) by mx.zohomail.com with SMTPS id 1609941871922882.2888221502794; Wed, 6 Jan 2021 06:04:31 -0800 (PST) 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-206-_1dYO0ohOGmh_FioKqSYpw-1; Wed, 06 Jan 2021 09:04:27 -0500 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 1E025107ACFC; Wed, 6 Jan 2021 14:04:21 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id EF92C60BE5; Wed, 6 Jan 2021 14:04:20 +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 BD59950037; Wed, 6 Jan 2021 14:04:20 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 106E4CUt031502 for ; Wed, 6 Jan 2021 09:04:12 -0500 Received: by smtp.corp.redhat.com (Postfix) id 6600162464; Wed, 6 Jan 2021 14:04:12 +0000 (UTC) Received: from speedmetal.lan (unknown [10.40.208.30]) by smtp.corp.redhat.com (Postfix) with ESMTP id B80505B699 for ; Wed, 6 Jan 2021 14:04:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1609941870; 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=MTOlyA/c9yGIPBwJ9hDSN7UfWCGKhnH1BUv0BCX94sE=; b=gvCo+JC5/jmweEe9PVIUHNxE+uF4R4eMCd0zw2tSkpIVG1/gnpvXhw/w3Tn9Hrl3Y3huqT GfKRBSsW7TXebDsLHFPTJxuMD26TrqgA4UajJfKtKcRBHu5KXzms3sXyyK0W5mjaI3jPcJ DjDvrYjRhj++gilkzylvETG8kHHDARg= X-MC-Unique: _1dYO0ohOGmh_FioKqSYpw-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 12/12] testCompareXMLToArgvValidateSchema: Populate autoNodeset Date: Wed, 6 Jan 2021 15:03:43 +0100 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 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.12 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" We create a new 'vm' so we must also fake the nodeset. Signed-off-by: Peter Krempa Reviewed-by: Michal Privoznik --- tests/qemuxml2argvtest.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c index 662d0d5df6..8b2df07448 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -519,6 +519,7 @@ testCompareXMLToArgvValidateSchema(virQEMUDriverPtr drv, { g_auto(GStrv) args =3D NULL; g_autoptr(virDomainObj) vm =3D NULL; + qemuDomainObjPrivatePtr priv =3D NULL; size_t nargs =3D 0; size_t i; g_autoptr(GHashTable) schema =3D NULL; @@ -546,6 +547,11 @@ testCompareXMLToArgvValidateSchema(virQEMUDriverPtr dr= v, NULL, parseFlags))) return -1; + priv =3D vm->privateData; + + if (virBitmapParse("0-3", &priv->autoNodeset, 4) < 0) + return -1; + if (!(cmd =3D testCompareXMLToArgvCreateArgs(drv, vm, migrateURI, info= , flags, true))) return -1; --=20 2.29.2