mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-04-26 07:04:42 +00:00
conf: Introduce 'pmem' element into xml for NVDIMM memory
The 'pmem' option allows users to specify whether the backend storage of memory-backend-file is a real persistent memory: <devices> ... <memory model='nvdimm' access='shared'> <source> <path>/dev/dax0.0</path> <pmem/> </source> <target> <size unit='MiB'>4094</size> <node>0</node> <label> <size unit='MiB'>2</size> </label> </target> </memory> ... </devices> Signed-off-by: Luyao Zhong <luyao.zhong@intel.com> Reviewed-by: John Ferlan <jferlan@redhat.com>
This commit is contained in:
parent
80d1ed9773
commit
73fc8c491e
@ -8332,6 +8332,19 @@ qemu-kvm -net nic,model=? /dev/null
|
|||||||
</label>
|
</label>
|
||||||
</target>
|
</target>
|
||||||
</memory>
|
</memory>
|
||||||
|
<memory model='nvdimm'>
|
||||||
|
<source>
|
||||||
|
<path>/dev/dax0.0</path>
|
||||||
|
<pmem/>
|
||||||
|
</source>
|
||||||
|
<target>
|
||||||
|
<size unit='KiB'>524288</size>
|
||||||
|
<node>1</node>
|
||||||
|
<label>
|
||||||
|
<size unit='KiB'>128</size>
|
||||||
|
</label>
|
||||||
|
</target>
|
||||||
|
</memory>
|
||||||
</devices>
|
</devices>
|
||||||
...
|
...
|
||||||
</pre>
|
</pre>
|
||||||
@ -8422,6 +8435,17 @@ qemu-kvm -net nic,model=? /dev/null
|
|||||||
<span class="since">Since 5.0.0</span>
|
<span class="since">Since 5.0.0</span>
|
||||||
</p>
|
</p>
|
||||||
</dd>
|
</dd>
|
||||||
|
|
||||||
|
<dt><code>pmem</code></dt>
|
||||||
|
<dd>
|
||||||
|
<p>
|
||||||
|
If persistent memory is supported and enabled by the hypervisor
|
||||||
|
in order to guarantee the persistence of writes to the vNVDIMM
|
||||||
|
backend, then use the <code>pmem</code> element in order to
|
||||||
|
utilize the feature.
|
||||||
|
<span class="since">Since 5.0.0</span>
|
||||||
|
</p>
|
||||||
|
</dd>
|
||||||
</dl>
|
</dl>
|
||||||
</dd>
|
</dd>
|
||||||
|
|
||||||
|
@ -5393,6 +5393,11 @@
|
|||||||
<ref name="scaledInteger"/>
|
<ref name="scaledInteger"/>
|
||||||
</element>
|
</element>
|
||||||
</optional>
|
</optional>
|
||||||
|
<optional>
|
||||||
|
<element name="pmem">
|
||||||
|
<empty/>
|
||||||
|
</element>
|
||||||
|
</optional>
|
||||||
</interleave>
|
</interleave>
|
||||||
</group>
|
</group>
|
||||||
</choice>
|
</choice>
|
||||||
|
@ -15785,6 +15785,9 @@ virDomainMemorySourceDefParseXML(xmlNodePtr node,
|
|||||||
&def->alignsize, false, false) < 0)
|
&def->alignsize, false, false) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
|
if (virXPathBoolean("boolean(./pmem)", ctxt))
|
||||||
|
def->nvdimmPmem = true;
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case VIR_DOMAIN_MEMORY_MODEL_NONE:
|
case VIR_DOMAIN_MEMORY_MODEL_NONE:
|
||||||
@ -22756,6 +22759,13 @@ virDomainMemoryDefCheckABIStability(virDomainMemoryDefPtr src,
|
|||||||
src->alignsize, dst->alignsize);
|
src->alignsize, dst->alignsize);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (src->nvdimmPmem != dst->nvdimmPmem) {
|
||||||
|
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
||||||
|
_("Target NVDIMM pmem flag doesn't match "
|
||||||
|
"source NVDIMM pmem flag"));
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return virDomainDeviceInfoCheckABIStability(&src->info, &dst->info);
|
return virDomainDeviceInfoCheckABIStability(&src->info, &dst->info);
|
||||||
@ -26296,6 +26306,9 @@ virDomainMemorySourceDefFormat(virBufferPtr buf,
|
|||||||
if (def->alignsize)
|
if (def->alignsize)
|
||||||
virBufferAsprintf(buf, "<alignsize unit='KiB'>%llu</alignsize>\n",
|
virBufferAsprintf(buf, "<alignsize unit='KiB'>%llu</alignsize>\n",
|
||||||
def->alignsize);
|
def->alignsize);
|
||||||
|
|
||||||
|
if (def->nvdimmPmem)
|
||||||
|
virBufferAddLit(buf, "<pmem/>\n");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case VIR_DOMAIN_MEMORY_MODEL_NONE:
|
case VIR_DOMAIN_MEMORY_MODEL_NONE:
|
||||||
|
@ -2148,6 +2148,7 @@ struct _virDomainMemoryDef {
|
|||||||
unsigned long long pagesize; /* kibibytes */
|
unsigned long long pagesize; /* kibibytes */
|
||||||
char *nvdimmPath;
|
char *nvdimmPath;
|
||||||
unsigned long long alignsize; /* kibibytes; valid only for NVDIMM */
|
unsigned long long alignsize; /* kibibytes; valid only for NVDIMM */
|
||||||
|
bool nvdimmPmem; /* valid only for NVDIMM */
|
||||||
|
|
||||||
/* target */
|
/* target */
|
||||||
int model; /* virDomainMemoryModel */
|
int model; /* virDomainMemoryModel */
|
||||||
|
58
tests/qemuxml2argvdata/memory-hotplug-nvdimm-pmem.xml
Normal file
58
tests/qemuxml2argvdata/memory-hotplug-nvdimm-pmem.xml
Normal file
@ -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/>
|
||||||
|
</source>
|
||||||
|
<target>
|
||||||
|
<size unit='KiB'>523264</size>
|
||||||
|
<node>0</node>
|
||||||
|
</target>
|
||||||
|
<address type='dimm' slot='0'/>
|
||||||
|
</memory>
|
||||||
|
</devices>
|
||||||
|
</domain>
|
1
tests/qemuxml2xmloutdata/memory-hotplug-nvdimm-pmem.xml
Symbolic link
1
tests/qemuxml2xmloutdata/memory-hotplug-nvdimm-pmem.xml
Symbolic link
@ -0,0 +1 @@
|
|||||||
|
../qemuxml2argvdata/memory-hotplug-nvdimm-pmem.xml
|
@ -1117,6 +1117,7 @@ mymain(void)
|
|||||||
DO_TEST("memory-hotplug-nvdimm-access", NONE);
|
DO_TEST("memory-hotplug-nvdimm-access", NONE);
|
||||||
DO_TEST("memory-hotplug-nvdimm-label", NONE);
|
DO_TEST("memory-hotplug-nvdimm-label", NONE);
|
||||||
DO_TEST("memory-hotplug-nvdimm-align", NONE);
|
DO_TEST("memory-hotplug-nvdimm-align", NONE);
|
||||||
|
DO_TEST("memory-hotplug-nvdimm-pmem", NONE);
|
||||||
DO_TEST("net-udp", NONE);
|
DO_TEST("net-udp", NONE);
|
||||||
|
|
||||||
DO_TEST("video-virtio-gpu-device", NONE);
|
DO_TEST("video-virtio-gpu-device", NONE);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user