mirror of
https://github.com/libvirt/libvirt.git
synced 2025-02-25 18:55:26 -06:00
* src/xend_internal.c src/xml.c: add an extra element currentMemory
to the XML description and handle its serialization back and forth between XML and S-Expr * tests/sexpr2xmltest.c tests/xml2sexprtest.c tests/sexpr2xmldata/sexpr2xml-curmem.* tests/xml2sexprdata/xml2sexpr-curmem.*: added specific regression tests for this, this didn't disturb any of the other tests. Daniel
This commit is contained in:
50
tests/sexpr2xmldata/sexpr2xml-curmem.sexpr
Normal file
50
tests/sexpr2xmldata/sexpr2xml-curmem.sexpr
Normal file
@@ -0,0 +1,50 @@
|
||||
(domain
|
||||
(domid 5)
|
||||
(uuid 4f77abd2-3019-58e8-3bab-6fbf2118f880)
|
||||
(vcpus 1)
|
||||
(cpu_weight 1.0)
|
||||
(memory 175)
|
||||
(shadow_memory 0)
|
||||
(maxmem 385)
|
||||
(bootloader /usr/bin/pygrub)
|
||||
(features )
|
||||
(name rhel5)
|
||||
(on_poweroff destroy)
|
||||
(on_reboot restart)
|
||||
(on_crash restart)
|
||||
(image
|
||||
(linux
|
||||
(ramdisk /var/lib/xen/initrd.gULTf1)
|
||||
(kernel /var/lib/xen/vmlinuz.blj7cs)
|
||||
(args 'ro root=/dev/VolGroup00/LogVol00 rhgb quiet')
|
||||
(vncunused 1)
|
||||
(vnc 1)
|
||||
(display localhost:10.0)
|
||||
(xauthority /root/.Xauthority)
|
||||
)
|
||||
)
|
||||
(device
|
||||
(vif
|
||||
(backend 0)
|
||||
(script vif-bridge)
|
||||
(bridge xenbr0)
|
||||
(mac 00:16:3e:1d:06:15)
|
||||
)
|
||||
)
|
||||
(device
|
||||
(tap
|
||||
(backend 0)
|
||||
(dev xvda:disk)
|
||||
(uname tap:aio:/xen/rhel5.img)
|
||||
(mode w)
|
||||
)
|
||||
)
|
||||
(state -b----)
|
||||
(shutdown_reason poweroff)
|
||||
(cpu_time 137.189121425)
|
||||
(online_vcpus 1)
|
||||
(up_time 66492.0194759)
|
||||
(start_time 1163083021.65)
|
||||
(store_mfn 74407)
|
||||
(console_mfn 198038)
|
||||
)
|
||||
30
tests/sexpr2xmldata/sexpr2xml-curmem.xml
Normal file
30
tests/sexpr2xmldata/sexpr2xml-curmem.xml
Normal file
@@ -0,0 +1,30 @@
|
||||
<domain type='xen' id='5'>
|
||||
<name>rhel5</name>
|
||||
<uuid>4f77abd2301958e83bab6fbf2118f880</uuid>
|
||||
<bootloader>/usr/bin/pygrub</bootloader>
|
||||
<os>
|
||||
<type>linux</type>
|
||||
<kernel>/var/lib/xen/vmlinuz.blj7cs</kernel>
|
||||
<initrd>/var/lib/xen/initrd.gULTf1</initrd>
|
||||
<cmdline>ro root=/dev/VolGroup00/LogVol00 rhgb quiet</cmdline>
|
||||
</os>
|
||||
<memory>394240</memory>
|
||||
<currentMemory>179200</currentMemory>
|
||||
<vcpu>1</vcpu>
|
||||
<on_poweroff>destroy</on_poweroff>
|
||||
<on_reboot>restart</on_reboot>
|
||||
<on_crash>restart</on_crash>
|
||||
<devices>
|
||||
<interface type='bridge'>
|
||||
<source bridge='xenbr0'/>
|
||||
<mac address='00:16:3e:1d:06:15'/>
|
||||
<script path='vif-bridge'/>
|
||||
</interface>
|
||||
<disk type='file' device='disk'>
|
||||
<driver name='tap' type='aio'/>
|
||||
<source file='/xen/rhel5.img'/>
|
||||
<target dev='xvda:disk'/>
|
||||
</disk>
|
||||
<graphics type='vnc' port='5905'/>
|
||||
</devices>
|
||||
</domain>
|
||||
@@ -90,6 +90,12 @@ static int testCompareDiskDrvBlktapRaw(void *data ATTRIBUTE_UNUSED) {
|
||||
1);
|
||||
}
|
||||
|
||||
static int testCompareResizedMemory(void *data ATTRIBUTE_UNUSED) {
|
||||
return testCompareFiles("sexpr2xmldata/sexpr2xml-curmem.xml",
|
||||
"sexpr2xmldata/sexpr2xml-curmem.sexpr",
|
||||
1);
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
main(int argc, char **argv)
|
||||
@@ -135,5 +141,9 @@ main(int argc, char **argv)
|
||||
1, testCompareDiskDrvBlktapRaw, NULL) != 0)
|
||||
ret = -1;
|
||||
|
||||
if (virtTestRun("SEXPR-2-XML Resized memory config",
|
||||
1, testCompareResizedMemory, NULL) != 0)
|
||||
ret = -1;
|
||||
|
||||
exit(ret==0 ? EXIT_SUCCESS : EXIT_FAILURE);
|
||||
}
|
||||
|
||||
1
tests/xml2sexprdata/xml2sexpr-curmem.sexpr
Normal file
1
tests/xml2sexprdata/xml2sexpr-curmem.sexpr
Normal file
@@ -0,0 +1 @@
|
||||
(vm (name 'rhel5')(memory 175)(maxmem 385)(vcpus 1)(uuid '4f77abd2301958e83bab6fbf2118f880')(bootloader '/usr/bin/pygrub')(on_poweroff 'destroy')(on_reboot 'restart')(on_crash 'restart')(image (linux (kernel '/var/lib/xen/vmlinuz.blj7cs')(ramdisk '/var/lib/xen/initrd.gULTf1')(args 'ro root=/dev/VolGroup00/LogVol00 rhgb quiet')(vnc 1)(vncdisplay 5)))(device (tap (dev 'xvda:disk')(uname 'tap:aio:/xen/rhel5.img')(mode 'w')))(device (vif (mac '00:16:3e:1d:06:15')(bridge 'xenbr0')(script 'vif-bridge'))))
|
||||
30
tests/xml2sexprdata/xml2sexpr-curmem.xml
Normal file
30
tests/xml2sexprdata/xml2sexpr-curmem.xml
Normal file
@@ -0,0 +1,30 @@
|
||||
<domain type='xen' id='5'>
|
||||
<name>rhel5</name>
|
||||
<uuid>4f77abd2301958e83bab6fbf2118f880</uuid>
|
||||
<bootloader>/usr/bin/pygrub</bootloader>
|
||||
<os>
|
||||
<type>linux</type>
|
||||
<kernel>/var/lib/xen/vmlinuz.blj7cs</kernel>
|
||||
<initrd>/var/lib/xen/initrd.gULTf1</initrd>
|
||||
<cmdline>ro root=/dev/VolGroup00/LogVol00 rhgb quiet</cmdline>
|
||||
</os>
|
||||
<memory>394240</memory>
|
||||
<currentMemory>179200</currentMemory>
|
||||
<vcpu>1</vcpu>
|
||||
<on_poweroff>destroy</on_poweroff>
|
||||
<on_reboot>restart</on_reboot>
|
||||
<on_crash>restart</on_crash>
|
||||
<devices>
|
||||
<interface type='bridge'>
|
||||
<source bridge='xenbr0'/>
|
||||
<mac address='00:16:3e:1d:06:15'/>
|
||||
<script path='vif-bridge'/>
|
||||
</interface>
|
||||
<disk type='file' device='disk'>
|
||||
<driver name='tap' type='aio'/>
|
||||
<source file='/xen/rhel5.img'/>
|
||||
<target dev='xvda:disk'/>
|
||||
</disk>
|
||||
<graphics type='vnc' port='5905'/>
|
||||
</devices>
|
||||
</domain>
|
||||
@@ -131,6 +131,13 @@ static int testCompareDiskDrvBlktapRaw(void *data ATTRIBUTE_UNUSED) {
|
||||
2);
|
||||
}
|
||||
|
||||
static int testCompareMemoryResize(void *data ATTRIBUTE_UNUSED) {
|
||||
return testCompareFiles("xml2sexprdata/xml2sexpr-curmem.xml",
|
||||
"xml2sexprdata/xml2sexpr-curmem.sexpr",
|
||||
"rhel5",
|
||||
2);
|
||||
}
|
||||
|
||||
int
|
||||
main(int argc, char **argv)
|
||||
{
|
||||
@@ -191,6 +198,10 @@ main(int argc, char **argv)
|
||||
1, testCompareDiskDrvBlktapRaw, NULL) != 0)
|
||||
ret = -1;
|
||||
|
||||
if (virtTestRun("XML-2-SEXPR Memory Resize",
|
||||
1, testCompareMemoryResize, NULL) != 0)
|
||||
ret = -1;
|
||||
|
||||
|
||||
exit(ret==0 ? EXIT_SUCCESS : EXIT_FAILURE);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user