From nobody Wed May 14 21:49:27 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1516211312284245.15039665191864; Wed, 17 Jan 2018 09:48:32 -0800 (PST) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 2DCC47854C; Wed, 17 Jan 2018 17:48:24 +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 441756090C; Wed, 17 Jan 2018 17:48:19 +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 DCDED4ED2D; Wed, 17 Jan 2018 17:48:12 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w0HHbtwb007439 for ; Wed, 17 Jan 2018 12:37:55 -0500 Received: by smtp.corp.redhat.com (Postfix) id D23485D97C; Wed, 17 Jan 2018 17:37:55 +0000 (UTC) Received: from localhost.localdomain.com (unknown [10.42.22.189]) by smtp.corp.redhat.com (Postfix) with ESMTP id 189E05D969; Wed, 17 Jan 2018 17:37:54 +0000 (UTC) From: "Daniel P. Berrange" To: libvir-list@redhat.com Date: Wed, 17 Jan 2018 17:37:45 +0000 Message-Id: <20180117173745.17754-3-berrange@redhat.com> In-Reply-To: <20180117173745.17754-1-berrange@redhat.com> References: <20180117173745.17754-1-berrange@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH v2 2/2] qemu: add support for generating SMBIOS OEM strings command line 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: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Wed, 17 Jan 2018 17:48:26 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" This wires up the previously added OEM strings XML schema to be able to generate comamnd line args for QEMU. This requires QEMU >=3D 2.12 release containing this patch: commit 2d6dcbf93fb01b4a7f45a93d276d4d74b16392dd Author: Daniel P. Berrange Date: Sat Oct 28 21:51:36 2017 +0100 smbios: support setting OEM strings table Signed-off-by: Daniel P. Berrange Reviewed-by: John Ferlan --- src/qemu/qemu_command.c | 28 ++++++++++++++++++++++++++++ tests/qemuxml2argvdata/smbios.args | 2 ++ tests/qemuxml2argvdata/smbios.xml | 5 +++++ tests/qemuxml2xmloutdata/smbios.xml | 5 +++++ 4 files changed, 40 insertions(+) diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index b8aede32d2..96bd0ad8ee 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -6142,6 +6142,26 @@ qemuBuildSmbiosBaseBoardStr(virSysinfoBaseBoardDefPt= r def) } =20 =20 +static char * +qemuBuildSmbiosOEMStringsStr(virSysinfoOEMStringsDefPtr def) +{ + virBuffer buf =3D VIR_BUFFER_INITIALIZER; + size_t i; + + if (!def) + return NULL; + + virBufferAddLit(&buf, "type=3D11"); + + for (i =3D 0; i < def->nvalues; i++) { + virBufferAddLit(&buf, ",value=3D"); + virQEMUBuildBufferEscapeComma(&buf, def->values[i]); + } + + return virBufferContentAndReset(&buf); +} + + static int qemuBuildSmbiosCommandLine(virCommandPtr cmd, virQEMUDriverPtr driver, @@ -6212,6 +6232,14 @@ qemuBuildSmbiosCommandLine(virCommandPtr cmd, virCommandAddArgList(cmd, "-smbios", smbioscmd, NULL); VIR_FREE(smbioscmd); } + + if (source->oemStrings) { + if (!(smbioscmd =3D qemuBuildSmbiosOEMStringsStr(source->oemSt= rings))) + return -1; + + virCommandAddArgList(cmd, "-smbios", smbioscmd, NULL); + VIR_FREE(smbioscmd); + } } =20 return 0; diff --git a/tests/qemuxml2argvdata/smbios.args b/tests/qemuxml2argvdata/sm= bios.args index 3d94a109f9..d27d436a3a 100644 --- a/tests/qemuxml2argvdata/smbios.args +++ b/tests/qemuxml2argvdata/smbios.args @@ -17,6 +17,8 @@ serial=3D32dfcb37-5af1-552b-357c-be8c3aa38310,\ uuid=3Dc7a5fdbd-edaf-9455-926a-d65c16db1809,sku=3D1234567890,family=3DRed = Hat' \ -smbios 'type=3D2,manufacturer=3DHewlett-Packard,product=3D0B4Ch,version= =3DD,\ serial=3DCZC1065993,asset=3DCZC1065993,location=3DUpside down' \ +-smbios 'type=3D11,value=3DHello,value=3DWorld,value=3DThis is,,\ + more tricky value=3Descaped' \ -nographic \ -nodefaults \ -chardev socket,id=3Dcharmonitor,path=3D/tmp/lib/domain--1-QEMUGuest1/moni= tor.sock,\ diff --git a/tests/qemuxml2argvdata/smbios.xml b/tests/qemuxml2argvdata/smb= ios.xml index c12477dcb5..319bdf61df 100644 --- a/tests/qemuxml2argvdata/smbios.xml +++ b/tests/qemuxml2argvdata/smbios.xml @@ -26,6 +26,11 @@ CZC1065993 Upside down + + Hello + World + This is, more tricky value=3Descaped + hvm diff --git a/tests/qemuxml2xmloutdata/smbios.xml b/tests/qemuxml2xmloutdata= /smbios.xml index d21f6275f0..cbe616c7da 100644 --- a/tests/qemuxml2xmloutdata/smbios.xml +++ b/tests/qemuxml2xmloutdata/smbios.xml @@ -26,6 +26,11 @@ CZC1065993 Upside down + + Hello + World + This is, more tricky value=3Descaped + hvm --=20 2.14.3 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list