qemu: Don't add default memballoon device on ARM

And add test cases for a basic working ARM guest.
This commit is contained in:
Cole Robinson 2013-07-30 15:41:14 -04:00
parent d40cde318a
commit 7c9617641d
6 changed files with 89 additions and 1 deletions

View File

@ -304,6 +304,7 @@
<ref name="hvmppc"/>
<ref name="hvmppc64"/>
<ref name="hvms390"/>
<ref name="hvmarm"/>
</choice>
</optional>
<value>hvm</value>
@ -413,6 +414,24 @@
</optional>
</group>
</define>
<define name="hvmarm">
<group>
<optional>
<attribute name="arch">
<choice>
<value>armv7l</value>
</choice>
</attribute>
</optional>
<optional>
<attribute name="machine">
<data type="string">
<param name="pattern">[a-zA-Z0-9_\.\-]+</param>
</data>
</attribute>
</optional>
</group>
</define>
<define name="osexe">
<element name="os">
<element name="type">

View File

@ -703,6 +703,7 @@ qemuDomainDefPostParse(virDomainDefPtr def,
bool addImplicitSATA = false;
bool addPCIRoot = false;
bool addPCIeRoot = false;
bool addDefaultMemballoon = true;
/* check for emulator and create a default one if needed */
if (!def->emulator &&
@ -737,6 +738,7 @@ qemuDomainDefPostParse(virDomainDefPtr def,
case VIR_ARCH_ARMV7L:
addDefaultUSB = false;
addDefaultMemballoon = false;
break;
case VIR_ARCH_ALPHA:
@ -785,7 +787,7 @@ qemuDomainDefPostParse(virDomainDefPtr def,
}
}
if (!def->memballoon) {
if (addDefaultMemballoon && !def->memballoon) {
virDomainMemballoonDefPtr memballoon;
if (VIR_ALLOC(memballoon) < 0)
return -1;

View File

@ -0,0 +1,5 @@
LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test QEMU_AUDIO_DRV=none \
/usr/bin/qemu-system-arm -S -M vexpress-a9 -m 1024 -smp 1 -nographic \
-nodefconfig -nodefaults -monitor unix:/tmp/test-monitor,server,nowait \
-boot c -kernel /arm.kernel -initrd /arm.initrd \
-append console=ttyAMA0,115200n8 -dtb /arm.dtb -usb

View File

@ -0,0 +1,26 @@
<domain type="qemu">
<name>armtest</name>
<uuid>496d7ea8-9739-544b-4ebd-ef08be936e6a</uuid>
<memory>1048576</memory>
<currentMemory>1048576</currentMemory>
<vcpu>1</vcpu>
<os>
<type arch="armv7l" machine="vexpress-a9">hvm</type>
<kernel>/arm.kernel</kernel>
<initrd>/arm.initrd</initrd>
<dtb>/arm.dtb</dtb>
<cmdline>console=ttyAMA0,115200n8</cmdline>
</os>
<features>
<acpi/>
<apic/>
<pae/>
</features>
<clock offset="utc"/>
<on_poweroff>destroy</on_poweroff>
<on_reboot>restart</on_reboot>
<on_crash>restart</on_crash>
<devices>
<emulator>/usr/bin/qemu-system-arm</emulator>
</devices>
</domain>

View File

@ -1061,6 +1061,9 @@ mymain(void)
QEMU_CAPS_VGA_QXL, QEMU_CAPS_DEVICE_QXL,
QEMU_CAPS_Q35_PCI_HOLE64_SIZE);
DO_TEST("arm-vexpressa9-nodevs",
QEMU_CAPS_DEVICE, QEMU_CAPS_NODEFCONFIG, QEMU_CAPS_DTB);
virObjectUnref(driver.config);
virObjectUnref(driver.caps);
virObjectUnref(driver.xmlopt);

View File

@ -145,6 +145,36 @@ error:
return -1;
}
static int testQemuAddArmGuest(virCapsPtr caps)
{
static const char *machines[] = { "vexpress-a9",
"vexpress-a15",
"versatilepb" };
virCapsGuestMachinePtr *capsmachines = NULL;
virCapsGuestPtr guest;
capsmachines = virCapabilitiesAllocMachines(machines,
ARRAY_CARDINALITY(machines));
if (!capsmachines)
goto error;
guest = virCapabilitiesAddGuest(caps, "hvm", VIR_ARCH_ARMV7L,
"/usr/bin/qemu-system-arm", NULL,
ARRAY_CARDINALITY(machines),
capsmachines);
if (!guest)
goto error;
if (!virCapabilitiesAddGuestDomain(guest, "qemu", NULL, NULL, 0, NULL))
goto error;
return 0;
error:
virCapabilitiesFreeMachines(capsmachines, ARRAY_CARDINALITY(machines));
return -1;
}
virCapsPtr testQemuCapsInit(void) {
virCapsPtr caps;
@ -270,6 +300,9 @@ virCapsPtr testQemuCapsInit(void) {
if (testQemuAddS390Guest(caps))
goto cleanup;
if (testQemuAddArmGuest(caps))
goto cleanup;
if (virTestGetDebug()) {
char *caps_str;