From nobody Mon Feb 9 06:34:00 2026 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=1606762588; cv=none; d=zohomail.com; s=zohoarc; b=QRaq1GWrGVdjxuD4T1UOU90RUJodF+0PPlxuIiSDLnD6kysAqeJrdoApx9ow/uSb7l2jjM7tAUJXfkcAYhbjYC/L8fD18bDmEkNoAcYXJgWsMGnTvVb/We6ZgmC3DSyhXfe8Q/y0hdhNqTkIIm9JcKbU40qADa3IrDWPwip2ZWA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1606762588; 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=mprgXT8A1ru5xD7ArNyZVSPXQuuVv9GKq5EjXKKRqUk=; b=n7iQn7N3SqLO5+tC5AWWT9nOvTsNt/RFfDaD2C+7mkdF9/olmu0VVC2RTB79HgSGSOB6GgGU1IvCltAj/LmmUNk9SoqhqQyYrJ8Mk8BttfWcj5m06dNpVnrORRc0IMBLmeHvdrZPGFy67ITXrpAi8cLGNBUsvyw2oDyL3voR5b4= 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 1606762588466476.6113481632261; Mon, 30 Nov 2020 10:56:28 -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-89-FzJGx4mbNtudxH3n6k1Sbw-1; Mon, 30 Nov 2020 13:56:24 -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 ED7C18030CD; Mon, 30 Nov 2020 18:56: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 CC5DA5D71D; Mon, 30 Nov 2020 18:56: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 967A31809CB3; Mon, 30 Nov 2020 18:56:15 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 0AUIu4Xn014323 for ; Mon, 30 Nov 2020 13:56:04 -0500 Received: by smtp.corp.redhat.com (Postfix) id 3215860C69; Mon, 30 Nov 2020 18:56:04 +0000 (UTC) Received: from speedmetal.lan (unknown [10.40.208.3]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8A87160C67 for ; Mon, 30 Nov 2020 18:55:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1606762587; 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=mprgXT8A1ru5xD7ArNyZVSPXQuuVv9GKq5EjXKKRqUk=; b=GIIL6Xsbei+j9oB2c15P4plv6WWFLrg4Gb0AXjb5fjFsh0pZG/5/pFide2qI6cQWjLE7NT VNpA794Jym5068bHpC3V/NJYeoaliJXP4slBvD+XNP627Eg2ubDQTIk5mN5Gj/UUt9H6DX xtvW5MhDjsJqrW0A01wqkr5c3l+Ffu8= X-MC-Unique: FzJGx4mbNtudxH3n6k1Sbw-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 13/24] qemu: command: Generate commandline of 'masterKey0' secret via JSON Date: Mon, 30 Nov 2020 19:55:26 +0100 Message-Id: <8d8b0065c1810ad34e993c3983a8aad0216d2873.1606762033.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 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" While the 'masterKey0' secret object will never be hotplugged we want to generate it through JSON so that we'll be able to validate all parameters of '-object' against the QAPI schema once 'object-add' is qapified in qemu. Signed-off-by: Peter Krempa --- src/qemu/qemu_command.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index f0798b5595..86b3c3d642 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -194,6 +194,7 @@ qemuBuildMasterKeyCommandLine(virCommandPtr cmd, g_autofree char *alias =3D NULL; g_autofree char *path =3D NULL; g_auto(virBuffer) buf =3D VIR_BUFFER_INITIALIZER; + g_autoptr(virJSONValue) props =3D NULL; /* If the -object secret does not exist, then just return. This just * means the domain won't be able to use a secret master key and is @@ -215,9 +216,16 @@ qemuBuildMasterKeyCommandLine(virCommandPtr cmd, if (!(path =3D qemuDomainGetMasterKeyFilePath(priv->libDir))) return -1; + if (qemuMonitorCreateObjectProps(&props, "secret", alias, + "s:format", "raw", + "s:file", path, + NULL) < 0) + return -1; + + if (virQEMUBuildObjectCommandlineFromJSON(&buf, props) < 0) + return -1; + virCommandAddArg(cmd, "-object"); - virBufferAsprintf(&buf, "secret,id=3D%s,format=3Draw,file=3D", alias); - virQEMUBuildBufferEscapeComma(&buf, path); virCommandAddArgBuffer(cmd, &buf); return 0; --=20 2.28.0