mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-22 05:35:25 +00: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:
parent
3869766df9
commit
28a60cbcdb
10
ChangeLog
10
ChangeLog
@ -1,3 +1,13 @@
|
||||
Fri Nov 10 11:19:32 CET 2006 Daniel Veillard <veillard@redhat.com>
|
||||
|
||||
* 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.
|
||||
|
||||
Thu Nov 9 15:39:19 CET 2006 Daniel Veillard <veillard@redhat.com>
|
||||
|
||||
* python/generator.py: changed the generator to generate a reference
|
||||
|
26
po/en_GB.po
26
po/en_GB.po
@ -8,7 +8,7 @@ msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: libvirt\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2006-11-09 14:26+0100\n"
|
||||
"POT-Creation-Date: 2006-11-10 11:04+0100\n"
|
||||
"PO-Revision-Date: 2006-09-20 10:20-0400\n"
|
||||
"Last-Translator: Daniel Berrange <berrange@redhat.com>\n"
|
||||
"Language-Team: English <en@li.org>\n"
|
||||
@ -373,8 +373,8 @@ msgid "allocate new context"
|
||||
msgstr ""
|
||||
|
||||
#: src/hash.c:628 src/hash.c:634 src/test.c:725 src/test.c:750 src/test.c:773
|
||||
#: src/test.c:797 src/xend_internal.c:1920 src/xend_internal.c:2616
|
||||
#: src/xend_internal.c:2827 src/xs_internal.c:594 src/proxy_internal.c:791
|
||||
#: src/test.c:797 src/xend_internal.c:1927 src/xend_internal.c:2623
|
||||
#: src/xend_internal.c:2834 src/xs_internal.c:594 src/proxy_internal.c:791
|
||||
#: src/proxy_internal.c:838 src/proxy_internal.c:889
|
||||
msgid "allocating domain"
|
||||
msgstr ""
|
||||
@ -495,7 +495,7 @@ msgstr ""
|
||||
msgid "growing buffer"
|
||||
msgstr ""
|
||||
|
||||
#: src/xml.c:116 src/xend_internal.c:1611 src/xend_internal.c:1630
|
||||
#: src/xml.c:116 src/xend_internal.c:1618 src/xend_internal.c:1637
|
||||
msgid "allocate new buffer"
|
||||
msgstr ""
|
||||
|
||||
@ -531,7 +531,7 @@ msgstr ""
|
||||
msgid "domain information incomplete, missing uuid"
|
||||
msgstr ""
|
||||
|
||||
#: src/xend_internal.c:1158 src/xend_internal.c:1500
|
||||
#: src/xend_internal.c:1158 src/xend_internal.c:1501
|
||||
msgid "domain information incomplete, missing name"
|
||||
msgstr ""
|
||||
|
||||
@ -539,37 +539,37 @@ msgstr ""
|
||||
msgid "domain information incomplete, missing kernel"
|
||||
msgstr ""
|
||||
|
||||
#: src/xend_internal.c:1590
|
||||
#: src/xend_internal.c:1597
|
||||
msgid "domain information incomplete, vbd has no src"
|
||||
msgstr ""
|
||||
|
||||
#: src/xend_internal.c:1596
|
||||
#: src/xend_internal.c:1603
|
||||
msgid "domain information incomplete, vbd has no dev"
|
||||
msgstr ""
|
||||
|
||||
#: src/xend_internal.c:1604
|
||||
#: src/xend_internal.c:1611
|
||||
msgid "cannot parse vbd filename, missing driver name"
|
||||
msgstr ""
|
||||
|
||||
#: src/xend_internal.c:1623
|
||||
#: src/xend_internal.c:1630
|
||||
msgid "cannot parse vbd filename, missing driver type"
|
||||
msgstr ""
|
||||
|
||||
#: src/xend_internal.c:1931
|
||||
#: src/xend_internal.c:1938
|
||||
msgid "failed to parse Xend domain information"
|
||||
msgstr ""
|
||||
|
||||
#: src/xend_internal.c:2892
|
||||
#: src/xend_internal.c:2899
|
||||
#, c-format
|
||||
msgid "Failed to create domain %s\n"
|
||||
msgstr ""
|
||||
|
||||
#: src/xend_internal.c:2898
|
||||
#: src/xend_internal.c:2905
|
||||
#, c-format
|
||||
msgid "Failed to get devices for domain %s\n"
|
||||
msgstr ""
|
||||
|
||||
#: src/xend_internal.c:2909
|
||||
#: src/xend_internal.c:2916
|
||||
#, c-format
|
||||
msgid "Failed to resume new domain %s\n"
|
||||
msgstr ""
|
||||
|
@ -8,7 +8,7 @@ msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: PACKAGE VERSION\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2006-11-09 14:26+0100\n"
|
||||
"POT-Creation-Date: 2006-11-10 11:04+0100\n"
|
||||
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
||||
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
||||
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||
@ -373,8 +373,8 @@ msgid "allocate new context"
|
||||
msgstr ""
|
||||
|
||||
#: src/hash.c:628 src/hash.c:634 src/test.c:725 src/test.c:750 src/test.c:773
|
||||
#: src/test.c:797 src/xend_internal.c:1920 src/xend_internal.c:2616
|
||||
#: src/xend_internal.c:2827 src/xs_internal.c:594 src/proxy_internal.c:791
|
||||
#: src/test.c:797 src/xend_internal.c:1927 src/xend_internal.c:2623
|
||||
#: src/xend_internal.c:2834 src/xs_internal.c:594 src/proxy_internal.c:791
|
||||
#: src/proxy_internal.c:838 src/proxy_internal.c:889
|
||||
msgid "allocating domain"
|
||||
msgstr ""
|
||||
@ -495,7 +495,7 @@ msgstr ""
|
||||
msgid "growing buffer"
|
||||
msgstr ""
|
||||
|
||||
#: src/xml.c:116 src/xend_internal.c:1611 src/xend_internal.c:1630
|
||||
#: src/xml.c:116 src/xend_internal.c:1618 src/xend_internal.c:1637
|
||||
msgid "allocate new buffer"
|
||||
msgstr ""
|
||||
|
||||
@ -531,7 +531,7 @@ msgstr ""
|
||||
msgid "domain information incomplete, missing uuid"
|
||||
msgstr ""
|
||||
|
||||
#: src/xend_internal.c:1158 src/xend_internal.c:1500
|
||||
#: src/xend_internal.c:1158 src/xend_internal.c:1501
|
||||
msgid "domain information incomplete, missing name"
|
||||
msgstr ""
|
||||
|
||||
@ -539,37 +539,37 @@ msgstr ""
|
||||
msgid "domain information incomplete, missing kernel"
|
||||
msgstr ""
|
||||
|
||||
#: src/xend_internal.c:1590
|
||||
#: src/xend_internal.c:1597
|
||||
msgid "domain information incomplete, vbd has no src"
|
||||
msgstr ""
|
||||
|
||||
#: src/xend_internal.c:1596
|
||||
#: src/xend_internal.c:1603
|
||||
msgid "domain information incomplete, vbd has no dev"
|
||||
msgstr ""
|
||||
|
||||
#: src/xend_internal.c:1604
|
||||
#: src/xend_internal.c:1611
|
||||
msgid "cannot parse vbd filename, missing driver name"
|
||||
msgstr ""
|
||||
|
||||
#: src/xend_internal.c:1623
|
||||
#: src/xend_internal.c:1630
|
||||
msgid "cannot parse vbd filename, missing driver type"
|
||||
msgstr ""
|
||||
|
||||
#: src/xend_internal.c:1931
|
||||
#: src/xend_internal.c:1938
|
||||
msgid "failed to parse Xend domain information"
|
||||
msgstr ""
|
||||
|
||||
#: src/xend_internal.c:2892
|
||||
#: src/xend_internal.c:2899
|
||||
#, c-format
|
||||
msgid "Failed to create domain %s\n"
|
||||
msgstr ""
|
||||
|
||||
#: src/xend_internal.c:2898
|
||||
#: src/xend_internal.c:2905
|
||||
#, c-format
|
||||
msgid "Failed to get devices for domain %s\n"
|
||||
msgstr ""
|
||||
|
||||
#: src/xend_internal.c:2909
|
||||
#: src/xend_internal.c:2916
|
||||
#, c-format
|
||||
msgid "Failed to resume new domain %s\n"
|
||||
msgstr ""
|
||||
|
@ -1479,6 +1479,7 @@ xend_parse_sexp_desc(virConnectPtr conn, struct sexpr *root, int xendConfigVersi
|
||||
virBuffer buf;
|
||||
int hvm = 0;
|
||||
int domid = -1;
|
||||
int max_mem, cur_mem;
|
||||
|
||||
if (root == NULL) {
|
||||
/* ERROR */
|
||||
@ -1526,8 +1527,14 @@ xend_parse_sexp_desc(virConnectPtr conn, struct sexpr *root, int xendConfigVersi
|
||||
xend_parse_sexp_desc_os(conn, root, &buf, hvm);
|
||||
}
|
||||
|
||||
virBufferVSprintf(&buf, " <memory>%d</memory>\n",
|
||||
(int) (sexpr_u64(root, "domain/maxmem") << 10));
|
||||
max_mem = (int) (sexpr_u64(root, "domain/maxmem") << 10);
|
||||
cur_mem = (int) (sexpr_u64(root, "domain/memory") << 10);
|
||||
if (cur_mem > max_mem)
|
||||
max_mem = cur_mem;
|
||||
virBufferVSprintf(&buf, " <memory>%d</memory>\n", max_mem);
|
||||
if ((cur_mem > 63) && (cur_mem != max_mem))
|
||||
virBufferVSprintf(&buf, " <currentMemory>%d</currentMemory>\n",
|
||||
cur_mem);
|
||||
virBufferVSprintf(&buf, " <vcpu>%d</vcpu>\n",
|
||||
sexpr_int(root, "domain/vcpus"));
|
||||
tmp = sexpr_node(root, "domain/on_poweroff");
|
||||
|
19
src/xml.c
19
src/xml.c
@ -1196,6 +1196,7 @@ virDomainParseXMLDesc(const char *xmldesc, char **name, int xendConfigVersion)
|
||||
int i, res;
|
||||
int bootloader = 0;
|
||||
int hvm = 0;
|
||||
unsigned long mem = 0, max_mem = 0;
|
||||
|
||||
if (name != NULL)
|
||||
*name = NULL;
|
||||
@ -1256,13 +1257,23 @@ virDomainParseXMLDesc(const char *xmldesc, char **name, int xendConfigVersion)
|
||||
obj = xmlXPathEval(BAD_CAST "number(/domain/memory[1])", ctxt);
|
||||
if ((obj == NULL) || (obj->type != XPATH_NUMBER) ||
|
||||
(isnan(obj->floatval)) || (obj->floatval < 64000)) {
|
||||
virBufferVSprintf(&buf, "(memory 128)(maxmem 128)");
|
||||
max_mem = 128;
|
||||
} else {
|
||||
unsigned long mem = (obj->floatval / 1024);
|
||||
|
||||
virBufferVSprintf(&buf, "(memory %lu)(maxmem %lu)", mem, mem);
|
||||
max_mem = (obj->floatval / 1024);
|
||||
}
|
||||
xmlXPathFreeObject(obj);
|
||||
obj = xmlXPathEval(BAD_CAST "number(/domain/currentMemory[1])", ctxt);
|
||||
if ((obj == NULL) || (obj->type != XPATH_NUMBER) ||
|
||||
(isnan(obj->floatval)) || (obj->floatval < 64000)) {
|
||||
mem = max_mem;
|
||||
} else {
|
||||
mem = (obj->floatval / 1024);
|
||||
if (mem > max_mem) {
|
||||
max_mem = mem;
|
||||
}
|
||||
}
|
||||
xmlXPathFreeObject(obj);
|
||||
virBufferVSprintf(&buf, "(memory %lu)(maxmem %lu)", mem, max_mem);
|
||||
|
||||
obj = xmlXPathEval(BAD_CAST "number(/domain/vcpu[1])", ctxt);
|
||||
if ((obj == NULL) || (obj->type != XPATH_NUMBER) ||
|
||||
|
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);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user