mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-03 11:35:19 +00:00
qemu: Add qemu command-line to generate the nvdimm unarmed property
According to the result parsing from xml, add the unarmed property into QEMU command line: -device nvdimm,...[,unarmed=on] Signed-off-by: Luyao Zhong <luyao.zhong@intel.com> Reviewed-by: John Ferlan <jferlan@redhat.com>
This commit is contained in:
parent
82576d8f35
commit
87c87f41f6
@ -3561,7 +3561,8 @@ qemuBuildMemoryDimmBackendStr(virBufferPtr buf,
|
|||||||
|
|
||||||
|
|
||||||
char *
|
char *
|
||||||
qemuBuildMemoryDeviceStr(virDomainMemoryDefPtr mem)
|
qemuBuildMemoryDeviceStr(virDomainMemoryDefPtr mem,
|
||||||
|
qemuDomainObjPrivatePtr priv)
|
||||||
{
|
{
|
||||||
virBuffer buf = VIR_BUFFER_INITIALIZER;
|
virBuffer buf = VIR_BUFFER_INITIALIZER;
|
||||||
const char *device;
|
const char *device;
|
||||||
@ -3589,6 +3590,16 @@ qemuBuildMemoryDeviceStr(virDomainMemoryDefPtr mem)
|
|||||||
if (mem->labelsize)
|
if (mem->labelsize)
|
||||||
virBufferAsprintf(&buf, "label-size=%llu,", mem->labelsize * 1024);
|
virBufferAsprintf(&buf, "label-size=%llu,", mem->labelsize * 1024);
|
||||||
|
|
||||||
|
if (mem->readonly) {
|
||||||
|
if (!virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_DEVICE_NVDIMM_UNARMED)) {
|
||||||
|
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
||||||
|
_("nvdimm readonly property is not available "
|
||||||
|
"with this QEMU binary"));
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
virBufferAddLit(&buf, "unarmed=on,");
|
||||||
|
}
|
||||||
|
|
||||||
virBufferAsprintf(&buf, "memdev=mem%s,id=%s",
|
virBufferAsprintf(&buf, "memdev=mem%s,id=%s",
|
||||||
mem->info.alias, mem->info.alias);
|
mem->info.alias, mem->info.alias);
|
||||||
|
|
||||||
@ -7888,7 +7899,7 @@ qemuBuildMemoryDeviceCommandLine(virCommandPtr cmd,
|
|||||||
virCommandAddArg(cmd, "-object");
|
virCommandAddArg(cmd, "-object");
|
||||||
virCommandAddArgBuffer(cmd, &buf);
|
virCommandAddArgBuffer(cmd, &buf);
|
||||||
|
|
||||||
if (!(dimmStr = qemuBuildMemoryDeviceStr(def->mems[i])))
|
if (!(dimmStr = qemuBuildMemoryDeviceStr(def->mems[i], priv)))
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
virCommandAddArgList(cmd, "-device", dimmStr, NULL);
|
virCommandAddArgList(cmd, "-device", dimmStr, NULL);
|
||||||
|
@ -128,7 +128,8 @@ int qemuBuildMemoryBackendProps(virJSONValuePtr *backendProps,
|
|||||||
virDomainMemoryDefPtr mem,
|
virDomainMemoryDefPtr mem,
|
||||||
bool force);
|
bool force);
|
||||||
|
|
||||||
char *qemuBuildMemoryDeviceStr(virDomainMemoryDefPtr mem);
|
char *qemuBuildMemoryDeviceStr(virDomainMemoryDefPtr mem,
|
||||||
|
qemuDomainObjPrivatePtr priv);
|
||||||
|
|
||||||
/* Current, best practice */
|
/* Current, best practice */
|
||||||
char *qemuBuildPCIHostdevDevStr(const virDomainDef *def,
|
char *qemuBuildPCIHostdevDevStr(const virDomainDef *def,
|
||||||
|
@ -2563,7 +2563,7 @@ qemuDomainAttachMemory(virQEMUDriverPtr driver,
|
|||||||
if (virAsprintf(&objalias, "mem%s", mem->info.alias) < 0)
|
if (virAsprintf(&objalias, "mem%s", mem->info.alias) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
if (!(devstr = qemuBuildMemoryDeviceStr(mem)))
|
if (!(devstr = qemuBuildMemoryDeviceStr(mem, priv)))
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
if (qemuBuildMemoryBackendProps(&props, objalias, cfg,
|
if (qemuBuildMemoryBackendProps(&props, objalias, cfg,
|
||||||
|
@ -0,0 +1,36 @@
|
|||||||
|
LC_ALL=C \
|
||||||
|
PATH=/bin \
|
||||||
|
HOME=/home/test \
|
||||||
|
USER=test \
|
||||||
|
LOGNAME=test \
|
||||||
|
QEMU_AUDIO_DRV=none \
|
||||||
|
/usr/bin/qemu-system-i686 \
|
||||||
|
-name guest=QEMUGuest1,debug-threads=on \
|
||||||
|
-S \
|
||||||
|
-object secret,id=masterKey0,format=raw,\
|
||||||
|
file=/tmp/lib/domain--1-QEMUGuest1/master-key.aes \
|
||||||
|
-machine pc,accel=tcg,usb=off,dump-guest-core=off,nvdimm=on \
|
||||||
|
-m size=219136k,slots=16,maxmem=1099511627776k \
|
||||||
|
-realtime mlock=off \
|
||||||
|
-smp 2,sockets=2,cores=1,threads=1 \
|
||||||
|
-numa node,nodeid=0,cpus=0-1,mem=214 \
|
||||||
|
-object memory-backend-file,id=memnvdimm0,prealloc=yes,mem-path=/tmp/nvdimm,\
|
||||||
|
share=no,size=536870912 \
|
||||||
|
-device nvdimm,node=0,unarmed=on,memdev=memnvdimm0,id=nvdimm0,slot=0 \
|
||||||
|
-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \
|
||||||
|
-display none \
|
||||||
|
-no-user-config \
|
||||||
|
-nodefaults \
|
||||||
|
-chardev socket,id=charmonitor,fd=1729,server,nowait \
|
||||||
|
-mon chardev=charmonitor,id=monitor,mode=control \
|
||||||
|
-rtc base=utc \
|
||||||
|
-no-shutdown \
|
||||||
|
-no-acpi \
|
||||||
|
-boot strict=on \
|
||||||
|
-device piix3-usb-uhci,id=usb,bus=pci.0,addr=0x1.0x2 \
|
||||||
|
-drive file=/dev/HostVG/QEMUGuest1,format=raw,if=none,id=drive-ide0-0-0 \
|
||||||
|
-device ide-hd,bus=ide.0,unit=0,drive=drive-ide0-0-0,id=ide0-0-0,bootindex=1 \
|
||||||
|
-device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3 \
|
||||||
|
-sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,\
|
||||||
|
resourcecontrol=deny \
|
||||||
|
-msg timestamp=on
|
@ -2760,6 +2760,7 @@ mymain(void)
|
|||||||
DO_TEST_CAPS_LATEST("memory-hotplug-nvdimm-label");
|
DO_TEST_CAPS_LATEST("memory-hotplug-nvdimm-label");
|
||||||
DO_TEST_CAPS_LATEST("memory-hotplug-nvdimm-align");
|
DO_TEST_CAPS_LATEST("memory-hotplug-nvdimm-align");
|
||||||
DO_TEST_CAPS_LATEST("memory-hotplug-nvdimm-pmem");
|
DO_TEST_CAPS_LATEST("memory-hotplug-nvdimm-pmem");
|
||||||
|
DO_TEST_CAPS_LATEST("memory-hotplug-nvdimm-readonly");
|
||||||
|
|
||||||
DO_TEST("machine-aeskeywrap-on-caps",
|
DO_TEST("machine-aeskeywrap-on-caps",
|
||||||
QEMU_CAPS_AES_KEY_WRAP,
|
QEMU_CAPS_AES_KEY_WRAP,
|
||||||
|
Loading…
Reference in New Issue
Block a user