[PATCH] qemu: fix cannot start a vm with memory device with address

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



When start a vm which have a memory device with address, the error
like this :

error: Failed to start domain test3
error: internal error: early end of file from monitor: possible problem:
2015-03-26T03:45:52.338891Z qemu-kvm: -device pc-dimm,node=0,memdev=memdimm0,
id=dimm0,slot=0,base=4294967296: Property '.base' not found

After check the qemu code i think this 'base' should named as 'addr',
you can see this mail:

http://lists.gnu.org/archive/html/qemu-devel/2014-06/msg00129.html

Or check the include/hw/mem/pc-dimm.h in qemu source.
Also add a tests for this.

Signed-off-by: Luyao Huang <lhuang@xxxxxxxxxx>
---
I didn't change this parameter's name ('base'), because i am not sure
if there is some special mean in it, or it is a result after
discuss.

 src/qemu/qemu_command.c                            |  2 +-
 .../qemuxml2argv-memory-hotplug-dimm-addr.args     |  9 +++++
 .../qemuxml2argv-memory-hotplug-dimm-addr.xml      | 45 ++++++++++++++++++++++
 tests/qemuxml2argvtest.c                           |  2 +
 4 files changed, 57 insertions(+), 1 deletion(-)
 create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-memory-hotplug-dimm-addr.args
 create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-memory-hotplug-dimm-addr.xml

diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 04c8df7..2941e7d 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -4909,7 +4909,7 @@ qemuBuildMemoryDeviceStr(virDomainMemoryDefPtr mem,
 
         if (mem->info.type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_DIMM) {
             virBufferAsprintf(&buf, ",slot=%d", mem->info.addr.dimm.slot);
-            virBufferAsprintf(&buf, ",base=%llu", mem->info.addr.dimm.base);
+            virBufferAsprintf(&buf, ",addr=%llu", mem->info.addr.dimm.base);
         }
 
         break;
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-memory-hotplug-dimm-addr.args b/tests/qemuxml2argvdata/qemuxml2argv-memory-hotplug-dimm-addr.args
new file mode 100644
index 0000000..7c59454
--- /dev/null
+++ b/tests/qemuxml2argvdata/qemuxml2argv-memory-hotplug-dimm-addr.args
@@ -0,0 +1,9 @@
+LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test QEMU_AUDIO_DRV=none \
+/usr/bin/qemu -S -M pc -m size=219136k,slots=16,maxmem=1099511627776k -smp 2 \
+-numa node,nodeid=0,cpus=0-1,mem=214 \
+-object memory-backend-ram,id=memdimm0,size=536870912,host-nodes=1-3,\
+policy=bind \
+-device pc-dimm,node=0,memdev=memdimm0,id=dimm0,slot=0,addr=4294967296 \
+-nographic -nodefaults -monitor unix:/tmp/test-monitor,server,nowait \
+-no-acpi -boot c -usb -hda /dev/HostVG/QEMUGuest1 \
+-device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-memory-hotplug-dimm-addr.xml b/tests/qemuxml2argvdata/qemuxml2argv-memory-hotplug-dimm-addr.xml
new file mode 100644
index 0000000..2e302c4
--- /dev/null
+++ b/tests/qemuxml2argvdata/qemuxml2argv-memory-hotplug-dimm-addr.xml
@@ -0,0 +1,45 @@
+<domain type='qemu'>
+  <name>QEMUGuest1</name>
+  <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+  <maxMemory slots='16' unit='KiB'>1099511627776</maxMemory>
+  <memory unit='KiB'>743423</memory>
+  <currentMemory unit='KiB'>743423</currentMemory>
+  <vcpu placement='static' cpuset='0-1'>2</vcpu>
+  <os>
+    <type arch='i686' machine='pc'>hvm</type>
+    <boot dev='hd'/>
+  </os>
+  <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</emulator>
+    <disk type='block' device='disk'>
+      <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'/>
+    <controller type='usb' index='0'/>
+    <controller type='pci' index='0' model='pci-root'/>
+    <memballoon model='virtio'/>
+    <memory model='dimm'>
+      <source>
+        <nodemask>1-3</nodemask>
+        <pagesize unit='KiB'>4096</pagesize>
+      </source>
+      <target>
+        <size unit='KiB'>524287</size>
+        <node>0</node>
+      </target>
+      <address type='dimm' slot='0' base='0x100000000'/>
+    </memory>
+  </devices>
+</domain>
diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
index 08f374e..a4cb887 100644
--- a/tests/qemuxml2argvtest.c
+++ b/tests/qemuxml2argvtest.c
@@ -1548,6 +1548,8 @@ mymain(void)
     DO_TEST("memory-hotplug", QEMU_CAPS_DEVICE_PC_DIMM, QEMU_CAPS_NUMA);
     DO_TEST("memory-hotplug-dimm", QEMU_CAPS_DEVICE_PC_DIMM, QEMU_CAPS_NUMA,
             QEMU_CAPS_DEVICE, QEMU_CAPS_OBJECT_MEMORY_RAM);
+    DO_TEST("memory-hotplug-dimm-addr", QEMU_CAPS_DEVICE_PC_DIMM, QEMU_CAPS_NUMA,
+            QEMU_CAPS_DEVICE, QEMU_CAPS_OBJECT_MEMORY_RAM);
 
     virObjectUnref(driver.config);
     virObjectUnref(driver.caps);
-- 
1.8.3.1

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]