[libvirt] [RFC 3/3] qemu: update qemu command-line generating for NVDIMM memory

Zhong, Luyao luyao.zhong at intel.com
Sat Nov 17 12:59:42 UTC 2018



On 11/8/2018 5:17 AM, John Ferlan wrote:
> 
> 
> On 10/16/18 10:21 PM, Luyao Zhong wrote:
>> According to the result parsing from xml, add corresponding properties
>> into QEMU command line, including 'align', 'pmem', 'persistence' and
>> 'nvdimm-persistence'. And add testcases related to these properties.
>>
>> Signed-off-by: Zhong,Luyao <luyao.zhong at intel.com>
>> ---
>>   src/qemu/qemu_command.c                            | 25 ++++++++++
>>   .../memory-hotplug-nvdimm-align.args               | 31 ++++++++++++
>>   .../memory-hotplug-nvdimm-align.xml                | 58 ++++++++++++++++++++++
>>   .../memory-hotplug-nvdimm-persistence.args         | 31 ++++++++++++
>>   .../memory-hotplug-nvdimm-persistence.xml          | 58 ++++++++++++++++++++++
>>   .../memory-hotplug-nvdimm-pmem.args                | 31 ++++++++++++
>>   .../memory-hotplug-nvdimm-pmem.xml                 | 58 ++++++++++++++++++++++
>>   .../memory-hotplug-nvdimm-unarmed.args             | 31 ++++++++++++
>>   .../memory-hotplug-nvdimm-unarmed.xml              | 58 ++++++++++++++++++++++
>>   tests/qemuxml2argvtest.c                           | 12 +++++
>>   10 files changed, 393 insertions(+)
>>   create mode 100644 tests/qemuxml2argvdata/memory-hotplug-nvdimm-align.args
>>   create mode 100644 tests/qemuxml2argvdata/memory-hotplug-nvdimm-align.xml
>>   create mode 100644 tests/qemuxml2argvdata/memory-hotplug-nvdimm-persistence.args
>>   create mode 100644 tests/qemuxml2argvdata/memory-hotplug-nvdimm-persistence.xml
>>   create mode 100644 tests/qemuxml2argvdata/memory-hotplug-nvdimm-pmem.args
>>   create mode 100644 tests/qemuxml2argvdata/memory-hotplug-nvdimm-pmem.xml
>>   create mode 100644 tests/qemuxml2argvdata/memory-hotplug-nvdimm-unarmed.args
>>   create mode 100644 tests/qemuxml2argvdata/memory-hotplug-nvdimm-unarmed.xml
>>
> 
> As I noted in patch2, the .xml files from xml2xmlargvdata belong there...
> 
> You are missing qemu_capabilites.{c,h} and friends changes. Many other
> examples, but they essentially determine which version the attribute was
> added to QEMU and only allow/use it for those versions and beyond.
> 
Got it , I will add this part in next version RFC.

> When adding capabilities, we tend to make them singular patches, but
> you'd only need 1 as I assume all the new switches were added for the
> same qemu release.  You can note that in the commit message too.
> 
Thank you for giving these details.

> Running make check make-check would have told you:
> 
> --- tests/qemuxml2argvdata/memory-hotplug-nvdimm-persistence.args
> 2018-11-07 12:55:59.165965066 -0500
> +++ -	2018-11-07 12:56:21.555957343 -0500
> @@ -7,7 +7,8 @@
>   /usr/bin/qemu-system-i686 \
>   -name QEMUGuest1 \
>   -S \
> --machine
> pc,accel=tcg,usb=off,dump-guest-core=off,nvdimm=on,nvdimm-persistence=mem-ctrl
> \
> +-machine pc,accel=tcg,usb=off,dump-guest-core=off,nvdimm=on,\
> +nvdimm-persistence=mem-ctrl \
>   -m size=219136k,slots=16,maxmem=1099511627776k \
>   -smp 2,sockets=2,cores=1,threads=1 \
>   -numa node,nodeid=0,cpus=0-1,mem=214 \
> Incorrect line wrapping in
> tests/qemuxml2argvdata/memory-hotplug-nvdimm-persistence.args
> Use test-wrap-argv.pl to wrap test data files
> make: *** [cfg.mk:1139: test-wrap-argv] Error 1
> 
I will check this.

> 
> You're also missing a patch to update docs/news.xml to describe your new
> feature. So your simple 3 patches have probably blossomed into 12 or so.
>   Don't feel the need to post all at the same time. Work through the
> <source> changes first, post those, get feedback, maybe get them pushed,
> and then go from there.
> 
Got it. Thanks a lot.

>> diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
>> index 887947d..466a466 100644
>> --- a/src/qemu/qemu_command.c
>> +++ b/src/qemu/qemu_command.c
>> @@ -3319,6 +3319,22 @@ qemuBuildMemoryBackendProps(virJSONValuePtr *backendProps,
>>       if (virJSONValueObjectAdd(props, "U:size", mem->size * 1024, NULL) < 0)
>>           goto cleanup;
>>   
>> +    if (mem->alignsize) {
> 
> mem->alignsize > 0
> 
Got it.
> It's one of my crusades ;-)
> 
>> +        if (virJSONValueObjectAdd(props,
>> +                                  "U:align",
>> +                                  mem->alignsize * 1024,
>> +                                  NULL) < 0)
>> +            goto cleanup;
>> +    }
> 
> Please multiple arguments on a line like "U:size" above - just don't go
> beyond 80 char wide display...
> 
Got it.

>> +
>> +    if (mem->nvdimmPmem) {
> 
> This would be bool, so OK.
> 
>> +        if (virJSONValueObjectAdd(props,
>> +                                  "s:pmem",
>> +                                  virTristateSwitchTypeToString(mem->nvdimmPmem),
>> +                                  NULL) < 0)
> 
>      if (virJSONValueObjectAdd(props, "s:pmem", "on", NULL) < 0)
> 
>> +            goto cleanup;
>> +    }
>> +
>>       if (mem->sourceNodes) {
>>           nodemask = mem->sourceNodes;
>>       } else {
>> @@ -3480,6 +3496,10 @@ qemuBuildMemoryDeviceStr(virDomainMemoryDefPtr mem)
>>           if (mem->labelsize)
>>               virBufferAsprintf(&buf, "label-size=%llu,", mem->labelsize * 1024);
>>   
>> +        if (mem->nvdimmUnarmed)
>> +            virBufferAsprintf(&buf, "unarmed=%s,",
>> +                              virTristateSwitchTypeToString(mem->nvdimmUnarmed));
> 
> use virBufferAddLit here.  There's other examples.
>
Got it, I will try.

>> +
>>           virBufferAsprintf(&buf, "memdev=mem%s,id=%s",
>>                             mem->info.alias, mem->info.alias);
>>   
>> @@ -7256,6 +7276,11 @@ qemuBuildMachineCommandLine(virCommandPtr cmd,
>>                   goto cleanup;
>>               }
>>               virBufferAddLit(&buf, ",nvdimm=on");
>> +
>> +            if (def->mems[i]->nvdimmPersistence) {
> 
> So if more than one entry had this persistence set, then this gets added
> multiple times for each... What happens when they're different? And why
> would we want to add multiple of the same?
> 
I have not noticed this situation. It should be the same, but I have not 
test this case by qemu. I will test more and try to solve this problem.

>> +                virBufferAsprintf(&buf, ",nvdimm-persistence=%s",
>> +                                  virDomainMemoryPersistenceTypeToString(def->mems[i]->nvdimmPersistence));
>> +            }
>>               break;
>>           }
>>       }
>> diff --git a/tests/qemuxml2argvdata/memory-hotplug-nvdimm-align.args b/tests/qemuxml2argvdata/memory-hotplug-nvdimm-align.args
>> new file mode 100644
>> index 0000000..432f622
>> --- /dev/null
>> +++ b/tests/qemuxml2argvdata/memory-hotplug-nvdimm-align.args
>> @@ -0,0 +1,31 @@
>> +LC_ALL=C \
>> +PATH=/bin \
>> +HOME=/home/test \
>> +USER=test \
>> +LOGNAME=test \
>> +QEMU_AUDIO_DRV=none \
>> +/usr/bin/qemu-system-i686 \
>> +-name QEMUGuest1 \
>> +-S \
>> +-machine pc,accel=tcg,usb=off,dump-guest-core=off,nvdimm=on \
>> +-m size=219136k,slots=16,maxmem=1099511627776k \
>> +-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,align=2097152 \
>> +-device nvdimm,node=0,memdev=memnvdimm0,id=nvdimm0,slot=0 \
>> +-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \
>> +-display none \
>> +-no-user-config \
>> +-nodefaults \
>> +-chardev socket,id=charmonitor,path=/tmp/lib/domain--1-QEMUGuest1/monitor.sock,\
>> +server,nowait \
>> +-mon chardev=charmonitor,id=monitor,mode=control \
>> +-rtc base=utc \
>> +-no-shutdown \
>> +-no-acpi \
>> +-usb \
>> +-drive file=/dev/HostVG/QEMUGuest1,format=raw,if=none,id=drive-ide0-0-0 \
>> +-device ide-drive,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
>> diff --git a/tests/qemuxml2argvdata/memory-hotplug-nvdimm-align.xml b/tests/qemuxml2argvdata/memory-hotplug-nvdimm-align.xml
>> new file mode 100644
>> index 0000000..a8c5198
>> --- /dev/null
>> +++ b/tests/qemuxml2argvdata/memory-hotplug-nvdimm-align.xml
>> @@ -0,0 +1,58 @@
>> +<domain type='qemu'>
>> +  <name>QEMUGuest1</name>
>> +  <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
>> +  <maxMemory slots='16' unit='KiB'>1099511627776</maxMemory>
>> +  <memory unit='KiB'>1267710</memory>
>> +  <currentMemory unit='KiB'>1267710</currentMemory>
>> +  <vcpu placement='static' cpuset='0-1'>2</vcpu>
>> +  <os>
>> +    <type arch='i686' machine='pc'>hvm</type>
>> +    <boot dev='hd'/>
>> +  </os>
>> +  <idmap>
>> +    <uid start='0' target='1000' count='10'/>
>> +    <gid start='0' target='1000' count='10'/>
>> +  </idmap>
>> +  <cpu>
>> +    <topology sockets='2' cores='1' threads='1'/>
>> +    <numa>
>> +      <cell id='0' cpus='0-1' memory='219136' unit='KiB'/>
>> +    </numa>
>> +  </cpu>
>> +  <clock offset='utc'/>
>> +  <on_poweroff>destroy</on_poweroff>
>> +  <on_reboot>restart</on_reboot>
>> +  <on_crash>destroy</on_crash>
>> +  <devices>
>> +    <emulator>/usr/bin/qemu-system-i686</emulator>
>> +    <disk type='block' device='disk'>
>> +      <driver name='qemu' type='raw'/>
>> +      <source dev='/dev/HostVG/QEMUGuest1'/>
>> +      <target dev='hda' bus='ide'/>
>> +      <address type='drive' controller='0' bus='0' target='0' unit='0'/>
>> +    </disk>
>> +    <controller type='ide' index='0'>
>> +      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>
>> +    </controller>
>> +    <controller type='usb' index='0'>
>> +      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/>
>> +    </controller>
>> +    <controller type='pci' index='0' model='pci-root'/>
>> +    <input type='mouse' bus='ps2'/>
>> +    <input type='keyboard' bus='ps2'/>
>> +    <memballoon model='virtio'>
>> +      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
>> +    </memballoon>
>> +    <memory model='nvdimm' access='private'>
>> +      <source>
>> +        <path>/tmp/nvdimm</path>
>> +        <alignsize unit='KiB'>2048</alignsize>> +      </source>
>> +      <target>
>> +        <size unit='KiB'>523264</size>
>> +        <node>0</node>
>> +      </target>
>> +      <address type='dimm' slot='0'/>
>> +    </memory>
>> +  </devices>
>> +</domain>
> 
> 
> Please try to trim all these XML files to not include stuff you don't
> need... such as idmap, cpu, numa, etc.  

The 'nvdimm' need numa support.Actually this test xml is based on the 
existing file tests/qemuxml2argvdata/memory-hotplug-nvdimm.xml.

> I would add the <pmem/> here and
> not have a separate test. You can validate both at the same time. In the
> long run there's 3 new tests... Each series of patches would add them.Got it, it's fine to put them together. I will take this into consider 
when I update the pathes.

> All the separation will be painful, but it is useful especially as it
> relates to bisecting where a problem may have begun.
> 
Got it. :)

>> diff --git a/tests/qemuxml2argvdata/memory-hotplug-nvdimm-persistence.args b/tests/qemuxml2argvdata/memory-hotplug-nvdimm-persistence.args
>> new file mode 100644
>> index 0000000..8ff03e3
>> --- /dev/null
>> +++ b/tests/qemuxml2argvdata/memory-hotplug-nvdimm-persistence.args
>> @@ -0,0 +1,31 @@
>> +LC_ALL=C \
>> +PATH=/bin \
>> +HOME=/home/test \
>> +USER=test \
>> +LOGNAME=test \
>> +QEMU_AUDIO_DRV=none \
>> +/usr/bin/qemu-system-i686 \
>> +-name QEMUGuest1 \
>> +-S \
>> +-machine pc,accel=tcg,usb=off,dump-guest-core=off,nvdimm=on,nvdimm-persistence=mem-ctrl \
>> +-m size=219136k,slots=16,maxmem=1099511627776k \
>> +-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,memdev=memnvdimm0,id=nvdimm0,slot=0 \
>> +-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \
>> +-display none \
>> +-no-user-config \
>> +-nodefaults \
>> +-chardev socket,id=charmonitor,path=/tmp/lib/domain--1-QEMUGuest1/monitor.sock,\
>> +server,nowait \
>> +-mon chardev=charmonitor,id=monitor,mode=control \
>> +-rtc base=utc \
>> +-no-shutdown \
>> +-no-acpi \
>> +-usb \
>> +-drive file=/dev/HostVG/QEMUGuest1,format=raw,if=none,id=drive-ide0-0-0 \
>> +-device ide-drive,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
>> diff --git a/tests/qemuxml2argvdata/memory-hotplug-nvdimm-persistence.xml b/tests/qemuxml2argvdata/memory-hotplug-nvdimm-persistence.xml
>> new file mode 100644
>> index 0000000..28f2b7f
>> --- /dev/null
>> +++ b/tests/qemuxml2argvdata/memory-hotplug-nvdimm-persistence.xml
>> @@ -0,0 +1,58 @@
>> +<domain type='qemu'>
>> +  <name>QEMUGuest1</name>
>> +  <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
>> +  <maxMemory slots='16' unit='KiB'>1099511627776</maxMemory>
>> +  <memory unit='KiB'>1267710</memory>
>> +  <currentMemory unit='KiB'>1267710</currentMemory>
>> +  <vcpu placement='static' cpuset='0-1'>2</vcpu>
>> +  <os>
>> +    <type arch='i686' machine='pc'>hvm</type>
>> +    <boot dev='hd'/>
>> +  </os>
>> +  <idmap>
>> +    <uid start='0' target='1000' count='10'/>
>> +    <gid start='0' target='1000' count='10'/>
>> +  </idmap>
>> +  <cpu>
>> +    <topology sockets='2' cores='1' threads='1'/>
>> +    <numa>
>> +      <cell id='0' cpus='0-1' memory='219136' unit='KiB'/>
>> +    </numa>
>> +  </cpu>
>> +  <clock offset='utc'/>
>> +  <on_poweroff>destroy</on_poweroff>
>> +  <on_reboot>restart</on_reboot>
>> +  <on_crash>destroy</on_crash>
>> +  <devices>
>> +    <emulator>/usr/bin/qemu-system-i686</emulator>
>> +    <disk type='block' device='disk'>
>> +      <driver name='qemu' type='raw'/>
>> +      <source dev='/dev/HostVG/QEMUGuest1'/>
>> +      <target dev='hda' bus='ide'/>
>> +      <address type='drive' controller='0' bus='0' target='0' unit='0'/>
>> +    </disk>
>> +    <controller type='ide' index='0'>
>> +      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>
>> +    </controller>
>> +    <controller type='usb' index='0'>
>> +      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/>
>> +    </controller>
>> +    <controller type='pci' index='0' model='pci-root'/>
>> +    <input type='mouse' bus='ps2'/>
>> +    <input type='keyboard' bus='ps2'/>
>> +    <memballoon model='virtio'>
>> +      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
>> +    </memballoon>
>> +    <memory model='nvdimm' access='private'>
>> +      <source>
>> +        <path>/tmp/nvdimm</path>
>> +      </source>
>> +      <target>
>> +        <size unit='KiB'>523264</size>
>> +        <node>0</node>
>> +        <persistence>mem-ctrl</persistence>
>> +      </target>
>> +      <address type='dimm' slot='0'/>
>> +    </memory>
>> +  </devices>
>> +</domain>
>> diff --git a/tests/qemuxml2argvdata/memory-hotplug-nvdimm-pmem.args b/tests/qemuxml2argvdata/memory-hotplug-nvdimm-pmem.args
>> new file mode 100644
>> index 0000000..d34ac5b
>> --- /dev/null
>> +++ b/tests/qemuxml2argvdata/memory-hotplug-nvdimm-pmem.args
>> @@ -0,0 +1,31 @@
>> +LC_ALL=C \
>> +PATH=/bin \
>> +HOME=/home/test \
>> +USER=test \
>> +LOGNAME=test \
>> +QEMU_AUDIO_DRV=none \
>> +/usr/bin/qemu-system-i686 \
>> +-name QEMUGuest1 \
>> +-S \
>> +-machine pc,accel=tcg,usb=off,dump-guest-core=off,nvdimm=on \
>> +-m size=219136k,slots=16,maxmem=1099511627776k \
>> +-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,pmem=on \
>> +-device nvdimm,node=0,memdev=memnvdimm0,id=nvdimm0,slot=0 \
>> +-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \
>> +-display none \
>> +-no-user-config \
>> +-nodefaults \
>> +-chardev socket,id=charmonitor,path=/tmp/lib/domain--1-QEMUGuest1/monitor.sock,\
>> +server,nowait \
>> +-mon chardev=charmonitor,id=monitor,mode=control \
>> +-rtc base=utc \
>> +-no-shutdown \
>> +-no-acpi \
>> +-usb \
>> +-drive file=/dev/HostVG/QEMUGuest1,format=raw,if=none,id=drive-ide0-0-0 \
>> +-device ide-drive,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
>> diff --git a/tests/qemuxml2argvdata/memory-hotplug-nvdimm-pmem.xml b/tests/qemuxml2argvdata/memory-hotplug-nvdimm-pmem.xml
>> new file mode 100644
>> index 0000000..b221ddb
>> --- /dev/null
>> +++ b/tests/qemuxml2argvdata/memory-hotplug-nvdimm-pmem.xml
>> @@ -0,0 +1,58 @@
>> +<domain type='qemu'>
>> +  <name>QEMUGuest1</name>
>> +  <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
>> +  <maxMemory slots='16' unit='KiB'>1099511627776</maxMemory>
>> +  <memory unit='KiB'>1267710</memory>
>> +  <currentMemory unit='KiB'>1267710</currentMemory>
>> +  <vcpu placement='static' cpuset='0-1'>2</vcpu>
>> +  <os>
>> +    <type arch='i686' machine='pc'>hvm</type>
>> +    <boot dev='hd'/>
>> +  </os>
>> +  <idmap>
>> +    <uid start='0' target='1000' count='10'/>
>> +    <gid start='0' target='1000' count='10'/>
>> +  </idmap>
>> +  <cpu>
>> +    <topology sockets='2' cores='1' threads='1'/>
>> +    <numa>
>> +      <cell id='0' cpus='0-1' memory='219136' unit='KiB'/>
>> +    </numa>
>> +  </cpu>
>> +  <clock offset='utc'/>
>> +  <on_poweroff>destroy</on_poweroff>
>> +  <on_reboot>restart</on_reboot>
>> +  <on_crash>destroy</on_crash>
>> +  <devices>
>> +    <emulator>/usr/bin/qemu-system-i686</emulator>
>> +    <disk type='block' device='disk'>
>> +      <driver name='qemu' type='raw'/>
>> +      <source dev='/dev/HostVG/QEMUGuest1'/>
>> +      <target dev='hda' bus='ide'/>
>> +      <address type='drive' controller='0' bus='0' target='0' unit='0'/>
>> +    </disk>
>> +    <controller type='ide' index='0'>
>> +      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>
>> +    </controller>
>> +    <controller type='usb' index='0'>
>> +      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/>
>> +    </controller>
>> +    <controller type='pci' index='0' model='pci-root'/>
>> +    <input type='mouse' bus='ps2'/>
>> +    <input type='keyboard' bus='ps2'/>
>> +    <memballoon model='virtio'>
>> +      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
>> +    </memballoon>
>> +    <memory model='nvdimm' access='private'>
>> +      <source>
>> +        <path>/tmp/nvdimm</path>
>> +        <pmem>on</pmem>
>> +      </source>
>> +      <target>
>> +        <size unit='KiB'>523264</size>
>> +        <node>0</node>
>> +      </target>
>> +      <address type='dimm' slot='0'/>
>> +    </memory>
>> +  </devices>
>> +</domain>
>> diff --git a/tests/qemuxml2argvdata/memory-hotplug-nvdimm-unarmed.args b/tests/qemuxml2argvdata/memory-hotplug-nvdimm-unarmed.args
>> new file mode 100644
>> index 0000000..64dcc5a
>> --- /dev/null
>> +++ b/tests/qemuxml2argvdata/memory-hotplug-nvdimm-unarmed.args
>> @@ -0,0 +1,31 @@
>> +LC_ALL=C \
>> +PATH=/bin \
>> +HOME=/home/test \
>> +USER=test \
>> +LOGNAME=test \
>> +QEMU_AUDIO_DRV=none \
>> +/usr/bin/qemu-system-i686 \
>> +-name QEMUGuest1 \
>> +-S \
>> +-machine pc,accel=tcg,usb=off,dump-guest-core=off,nvdimm=on \
>> +-m size=219136k,slots=16,maxmem=1099511627776k \
>> +-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,path=/tmp/lib/domain--1-QEMUGuest1/monitor.sock,\
>> +server,nowait \
>> +-mon chardev=charmonitor,id=monitor,mode=control \
>> +-rtc base=utc \
>> +-no-shutdown \
>> +-no-acpi \
>> +-usb \
>> +-drive file=/dev/HostVG/QEMUGuest1,format=raw,if=none,id=drive-ide0-0-0 \
>> +-device ide-drive,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
>> diff --git a/tests/qemuxml2argvdata/memory-hotplug-nvdimm-unarmed.xml b/tests/qemuxml2argvdata/memory-hotplug-nvdimm-unarmed.xml
>> new file mode 100644
>> index 0000000..f60abbf
>> --- /dev/null
>> +++ b/tests/qemuxml2argvdata/memory-hotplug-nvdimm-unarmed.xml
>> @@ -0,0 +1,58 @@
>> +<domain type='qemu'>
>> +  <name>QEMUGuest1</name>
>> +  <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
>> +  <maxMemory slots='16' unit='KiB'>1099511627776</maxMemory>
>> +  <memory unit='KiB'>1267710</memory>
>> +  <currentMemory unit='KiB'>1267710</currentMemory>
>> +  <vcpu placement='static' cpuset='0-1'>2</vcpu>
>> +  <os>
>> +    <type arch='i686' machine='pc'>hvm</type>
>> +    <boot dev='hd'/>
>> +  </os>
>> +  <idmap>
>> +    <uid start='0' target='1000' count='10'/>
>> +    <gid start='0' target='1000' count='10'/>
>> +  </idmap>
>> +  <cpu>
>> +    <topology sockets='2' cores='1' threads='1'/>
>> +    <numa>
>> +      <cell id='0' cpus='0-1' memory='219136' unit='KiB'/>
>> +    </numa>
>> +  </cpu>
>> +  <clock offset='utc'/>
>> +  <on_poweroff>destroy</on_poweroff>
>> +  <on_reboot>restart</on_reboot>
>> +  <on_crash>destroy</on_crash>
>> +  <devices>
>> +    <emulator>/usr/bin/qemu-system-i686</emulator>
>> +    <disk type='block' device='disk'>
>> +      <driver name='qemu' type='raw'/>
>> +      <source dev='/dev/HostVG/QEMUGuest1'/>
>> +      <target dev='hda' bus='ide'/>
>> +      <address type='drive' controller='0' bus='0' target='0' unit='0'/>
>> +    </disk>
>> +    <controller type='ide' index='0'>
>> +      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>
>> +    </controller>
>> +    <controller type='usb' index='0'>
>> +      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/>
>> +    </controller>
>> +    <controller type='pci' index='0' model='pci-root'/>
>> +    <input type='mouse' bus='ps2'/>
>> +    <input type='keyboard' bus='ps2'/>
>> +    <memballoon model='virtio'>
>> +      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
>> +    </memballoon>
>> +    <memory model='nvdimm' access='private'>
>> +      <source>
>> +        <path>/tmp/nvdimm</path>
>> +      </source>
>> +      <target>
>> +        <size unit='KiB'>523264</size>
>> +        <node>0</node>
>> +        <unarmed>on</unarmed>
>> +      </target>
>> +      <address type='dimm' slot='0'/>
>> +    </memory>
>> +  </devices>
>> +</domain>
>> diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
>> index a7cde3e..05ffca5 100644
>> --- a/tests/qemuxml2argvtest.c
>> +++ b/tests/qemuxml2argvtest.c
>> @@ -2717,6 +2717,18 @@ mymain(void)
>>       DO_TEST("memory-hotplug-nvdimm-label",
>>               QEMU_CAPS_DEVICE_NVDIMM,
>>               QEMU_CAPS_NUMA, QEMU_CAPS_OBJECT_MEMORY_RAM, QEMU_CAPS_OBJECT_MEMORY_FILE);
>> +    DO_TEST("memory-hotplug-nvdimm-align",
>> +            QEMU_CAPS_DEVICE_NVDIMM,
>> +            QEMU_CAPS_NUMA, QEMU_CAPS_OBJECT_MEMORY_RAM, QEMU_CAPS_OBJECT_MEMORY_FILE);
>> +    DO_TEST("memory-hotplug-nvdimm-pmem",
>> +            QEMU_CAPS_DEVICE_NVDIMM,
>> +            QEMU_CAPS_NUMA, QEMU_CAPS_OBJECT_MEMORY_RAM, QEMU_CAPS_OBJECT_MEMORY_FILE);
>> +    DO_TEST("memory-hotplug-nvdimm-persistence",
>> +            QEMU_CAPS_DEVICE_NVDIMM,
>> +            QEMU_CAPS_NUMA, QEMU_CAPS_OBJECT_MEMORY_RAM, QEMU_CAPS_OBJECT_MEMORY_FILE);
>> +    DO_TEST("memory-hotplug-nvdimm-unarmed",
>> +            QEMU_CAPS_DEVICE_NVDIMM,
>> +            QEMU_CAPS_NUMA, QEMU_CAPS_OBJECT_MEMORY_RAM, QEMU_CAPS_OBJECT_MEMORY_FILE);
>>   
> 
> These should be DO_TEST_CAPS_LATEST...
> 
Got it.

> John
> 
Thanks a lot for your review. I need more rewords and recode work.
Luyao
>>       DO_TEST("machine-aeskeywrap-on-caps",
>>               QEMU_CAPS_AES_KEY_WRAP,
>>




More information about the libvir-list mailing list