From nobody Mon Feb 9 16:01:40 2026 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; dmarc=fail(p=none dis=none) header.from=intel.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1545038833283340.08799103050285; Mon, 17 Dec 2018 01:27:13 -0800 (PST) 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 mx1.redhat.com (Postfix) with ESMTPS id 6F45F7AE95; Mon, 17 Dec 2018 09:27:11 +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 399D8105958F; Mon, 17 Dec 2018 09:27:11 +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 CFE32184B54B; Mon, 17 Dec 2018 09:27:10 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id wBH9R6qw018903 for ; Mon, 17 Dec 2018 04:27:06 -0500 Received: by smtp.corp.redhat.com (Postfix) id 62A352C8EA; Mon, 17 Dec 2018 09:27:06 +0000 (UTC) Received: from mx1.redhat.com (ext-mx01.extmail.prod.ext.phx2.redhat.com [10.5.110.25]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 9D3B466064 for ; Mon, 17 Dec 2018 09:27:00 +0000 (UTC) Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 7B5897F6CB for ; Mon, 17 Dec 2018 09:26:59 +0000 (UTC) Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga107.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 17 Dec 2018 01:26:59 -0800 Received: from zly-optiplex-9020.bj.intel.com ([10.238.135.151]) by orsmga008.jf.intel.com with ESMTP; 17 Dec 2018 01:26:58 -0800 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.56,364,1539673200"; d="scan'208";a="102099873" From: Luyao Zhong To: libvir-list@redhat.com Date: Mon, 17 Dec 2018 17:26:20 +0800 Message-Id: <1545038781-18468-11-git-send-email-luyao.zhong@intel.com> In-Reply-To: <1545038781-18468-1-git-send-email-luyao.zhong@intel.com> References: <1545038781-18468-1-git-send-email-luyao.zhong@intel.com> X-Greylist: Sender passed SPF test, Sender IP whitelisted by DNSRBL, ACL 216 matched, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Mon, 17 Dec 2018 09:26:59 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Mon, 17 Dec 2018 09:26:59 +0000 (UTC) for IP:'192.55.52.151' DOMAIN:'mga17.intel.com' HELO:'mga17.intel.com' FROM:'luyao.zhong@intel.com' RCPT:'' X-RedHat-Spam-Score: -2.301 (RCVD_IN_DNSWL_MED, SPF_PASS) 192.55.52.151 mga17.intel.com 192.55.52.151 mga17.intel.com X-Scanned-By: MIMEDefang 2.83 on 10.5.110.25 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH v4 10/11] nvdimm: qemu command-line generating for unarmed property 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.84 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Mon, 17 Dec 2018 09:27:12 +0000 (UTC) Content-Type: text/plain; charset="utf-8" According to the result parsing from xml, add unarmed property into QEMU command line. Signed-off-by: Luyao Zhong --- src/qemu/qemu_command.c | 16 ++++++++-- src/qemu/qemu_command.h | 3 +- src/qemu/qemu_hotplug.c | 2 +- ...emory-hotplug-nvdimm-unarmed.x86_64-latest.args | 36 ++++++++++++++++++= ++++ tests/qemuxml2argvtest.c | 1 + 5 files changed, 54 insertions(+), 4 deletions(-) create mode 100644 tests/qemuxml2argvdata/memory-hotplug-nvdimm-unarmed.x8= 6_64-latest.args diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 6a06161..c60b097 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -3567,7 +3567,8 @@ qemuBuildMemoryDimmBackendStr(virBufferPtr buf, =20 =20 char * -qemuBuildMemoryDeviceStr(virDomainMemoryDefPtr mem) +qemuBuildMemoryDeviceStr(virDomainMemoryDefPtr mem, + qemuDomainObjPrivatePtr priv) { virBuffer buf =3D VIR_BUFFER_INITIALIZER; const char *device; @@ -3595,6 +3596,17 @@ qemuBuildMemoryDeviceStr(virDomainMemoryDefPtr mem) if (mem->labelsize) virBufferAsprintf(&buf, "label-size=3D%llu,", mem->labelsize *= 1024); =20 + if (mem->nvdimmUnarmed) { + if (!virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_DEVICE_NVDIMM_UN= ARMED)) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("unarmed property is not available " + "with this QEMU binary")); + return NULL; + } + virBufferAsprintf(&buf, "unarmed=3D%s,", + mem->nvdimmUnarmed ? "on" : "off"); + } + virBufferAsprintf(&buf, "memdev=3Dmem%s,id=3D%s", mem->info.alias, mem->info.alias); =20 @@ -7894,7 +7906,7 @@ qemuBuildMemoryDeviceCommandLine(virCommandPtr cmd, virCommandAddArg(cmd, "-object"); virCommandAddArgBuffer(cmd, &buf); =20 - if (!(dimmStr =3D qemuBuildMemoryDeviceStr(def->mems[i]))) + if (!(dimmStr =3D qemuBuildMemoryDeviceStr(def->mems[i], priv))) return -1; =20 virCommandAddArgList(cmd, "-device", dimmStr, NULL); diff --git a/src/qemu/qemu_command.h b/src/qemu/qemu_command.h index 4647260..1a4f1f5 100644 --- a/src/qemu/qemu_command.h +++ b/src/qemu/qemu_command.h @@ -128,7 +128,8 @@ int qemuBuildMemoryBackendProps(virJSONValuePtr *backen= dProps, virDomainMemoryDefPtr mem, bool force); =20 -char *qemuBuildMemoryDeviceStr(virDomainMemoryDefPtr mem); +char *qemuBuildMemoryDeviceStr(virDomainMemoryDefPtr mem, + qemuDomainObjPrivatePtr priv); =20 /* Current, best practice */ char *qemuBuildPCIHostdevDevStr(const virDomainDef *def, diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c index 8da0233..a1c3ca9 100644 --- a/src/qemu/qemu_hotplug.c +++ b/src/qemu/qemu_hotplug.c @@ -2563,7 +2563,7 @@ qemuDomainAttachMemory(virQEMUDriverPtr driver, if (virAsprintf(&objalias, "mem%s", mem->info.alias) < 0) goto cleanup; =20 - if (!(devstr =3D qemuBuildMemoryDeviceStr(mem))) + if (!(devstr =3D qemuBuildMemoryDeviceStr(mem, priv))) goto cleanup; =20 if (qemuBuildMemoryBackendProps(&props, objalias, cfg, diff --git a/tests/qemuxml2argvdata/memory-hotplug-nvdimm-unarmed.x86_64-la= test.args b/tests/qemuxml2argvdata/memory-hotplug-nvdimm-unarmed.x86_64-lat= est.args new file mode 100644 index 0000000..783d16b --- /dev/null +++ b/tests/qemuxml2argvdata/memory-hotplug-nvdimm-unarmed.x86_64-latest.ar= gs @@ -0,0 +1,36 @@ +LC_ALL=3DC \ +PATH=3D/bin \ +HOME=3D/home/test \ +USER=3Dtest \ +LOGNAME=3Dtest \ +QEMU_AUDIO_DRV=3Dnone \ +/usr/bin/qemu-system-i686 \ +-name guest=3DQEMUGuest1,debug-threads=3Don \ +-S \ +-object secret,id=3DmasterKey0,format=3Draw,\ +file=3D/tmp/lib/domain--1-QEMUGuest1/master-key.aes \ +-machine pc,accel=3Dtcg,usb=3Doff,dump-guest-core=3Doff,nvdimm=3Don \ +-m size=3D219136k,slots=3D16,maxmem=3D1099511627776k \ +-realtime mlock=3Doff \ +-smp 2,sockets=3D2,cores=3D1,threads=3D1 \ +-numa node,nodeid=3D0,cpus=3D0-1,mem=3D214 \ +-object memory-backend-file,id=3Dmemnvdimm0,prealloc=3Dyes,mem-path=3D/tmp= /nvdimm,\ +share=3Dno,size=3D536870912 \ +-device nvdimm,node=3D0,unarmed=3Don,memdev=3Dmemnvdimm0,id=3Dnvdimm0,slot= =3D0 \ +-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \ +-display none \ +-no-user-config \ +-nodefaults \ +-chardev socket,id=3Dcharmonitor,fd=3D1729,server,nowait \ +-mon chardev=3Dcharmonitor,id=3Dmonitor,mode=3Dcontrol \ +-rtc base=3Dutc \ +-no-shutdown \ +-no-acpi \ +-boot strict=3Don \ +-device piix3-usb-uhci,id=3Dusb,bus=3Dpci.0,addr=3D0x1.0x2 \ +-drive file=3D/dev/HostVG/QEMUGuest1,format=3Draw,if=3Dnone,id=3Ddrive-ide= 0-0-0 \ +-device ide-hd,bus=3Dide.0,unit=3D0,drive=3Ddrive-ide0-0-0,id=3Dide0-0-0,b= ootindex=3D1 \ +-device virtio-balloon-pci,id=3Dballoon0,bus=3Dpci.0,addr=3D0x3 \ +-sandbox on,obsolete=3Ddeny,elevateprivileges=3Ddeny,spawn=3Ddeny,\ +resourcecontrol=3Ddeny \ +-msg timestamp=3Don diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c index b1a0c0b..bd30c25 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -2760,6 +2760,7 @@ mymain(void) DO_TEST_CAPS_LATEST("memory-hotplug-nvdimm-label"); DO_TEST_CAPS_LATEST("memory-hotplug-nvdimm-align"); DO_TEST_CAPS_LATEST("memory-hotplug-nvdimm-pmem"); + DO_TEST_CAPS_LATEST("memory-hotplug-nvdimm-unarmed"); =20 DO_TEST("machine-aeskeywrap-on-caps", QEMU_CAPS_AES_KEY_WRAP, --=20 2.7.4 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list