* 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:
Daniel Veillard
2006-11-10 11:13:01 +00:00
parent 3869766df9
commit 28a60cbcdb
11 changed files with 192 additions and 32 deletions

View 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)
)

View 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>

View File

@@ -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);
}

View 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'))))

View 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>

View File

@@ -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);
}