Fix localtime handling for newer XenD

This commit is contained in:
Daniel P. Berrange 2009-04-01 10:36:52 +00:00
parent e4c65831e3
commit b02c0455d1
10 changed files with 87 additions and 4 deletions

View File

@ -1,3 +1,19 @@
Wed Apr 1 11:36:22 BST 2009 Daniel P. Berrange <berrange@redhat.com>
Fix localtime handling for new XenD
* src/xend_internal.c: Update SEXPR for new location of
(localtime 1) field.
* src/xm_internal.c: Read localtime=1 param for PV guests
too
* tests/xml2sexprtest.c, tests/sexpr2xmltest.c: Add testing
of new (localtime 1) handling
* tests/sexpr2xmldata/sexpr2xml-pv-localtime.sexpr,
tests/sexpr2xmldata/sexpr2xml-pv-localtime.xml,
tests/xml2sexprdata/xml2sexpr-fv-localtime.sexpr,
tests/xml2sexprdata/xml2sexpr-pv-localtime.sexpr,
tests/xml2sexprdata/xml2sexpr-pv-localtime.xml: Data files
for extended tests
Wed Apr 1 11:27:22 BST 2009 Daniel P. Berrange <berrange@redhat.com>
Misc fixes uncovered from OOM testing

View File

@ -2293,10 +2293,15 @@ xenDaemonParseSxpr(virConnectPtr conn,
if (sexpr_int(root, "domain/image/hvm/pae"))
def->features |= (1 << VIR_DOMAIN_FEATURE_PAE);
/* Old XenD only allows localtime here for HVM */
if (sexpr_int(root, "domain/image/hvm/localtime"))
def->localtime = 1;
}
/* Current XenD allows localtime here, for PV and HVM */
if (sexpr_int(root, "domain/localtime"))
def->localtime = 1;
if (sexpr_node_copy(root, hvm ?
"domain/image/hvm/device_model" :
"domain/image/linux/device_model",
@ -5375,6 +5380,10 @@ xenDaemonFormatSxpr(virConnectPtr conn,
}
virBufferVSprintf(&buf, "(on_crash '%s')", tmp);
/* Set localtime here for current XenD (both PV & HVM) */
if (def->localtime)
virBufferAddLit(&buf, "(localtime 1)");
if (!def->os.bootloader) {
if (STREQ(def->os.type, "hvm"))
hvm = 1;
@ -5490,6 +5499,7 @@ xenDaemonFormatSxpr(virConnectPtr conn,
virBufferAddLit(&buf, "(serial none)");
}
/* Set localtime here to keep old XenD happy for HVM */
if (def->localtime)
virBufferAddLit(&buf, "(localtime 1)");

View File

@ -817,10 +817,10 @@ xenXMDomainConfigParse(virConnectPtr conn, virConfPtr conf) {
goto cleanup;
else if (val)
def->features |= (1 << VIR_DOMAIN_FEATURE_APIC);
if (xenXMConfigGetBool(conn, conf, "localtime", &def->localtime, 0) < 0)
goto cleanup;
}
if (xenXMConfigGetBool(conn, conf, "localtime", &def->localtime, 0) < 0)
goto cleanup;
if (xenXMConfigCopyStringOpt(conn, conf, "device_model", &def->emulator) < 0)
goto cleanup;

View File

@ -0,0 +1,2 @@
(domain (domid 6)(name 'pvtest')(memory 420)(maxmem 420)(vcpus 2)(uuid '596a5d2171f48fb2e068e2386a5c413e')(on_poweroff 'destroy')(on_reboot 'destroy')(on_crash 'destroy')(localtime 1)(image (linux (kernel '/var/lib/xen/vmlinuz.2Dn2YT')(ramdisk '/var/lib/xen/initrd.img.0u-Vhq')(args ' method=http://download.fedora.devel.redhat.com/pub/fedora/linux/core/test/5.91/x86_64/os ')))(device (vbd (dev 'xvda')(uname 'file:/root/some.img')(mode 'w'))))

View File

@ -0,0 +1,27 @@
<domain type='xen' id='6'>
<name>pvtest</name>
<uuid>596a5d21-71f4-8fb2-e068-e2386a5c413e</uuid>
<memory>430080</memory>
<currentMemory>430080</currentMemory>
<vcpu>2</vcpu>
<os>
<type>linux</type>
<kernel>/var/lib/xen/vmlinuz.2Dn2YT</kernel>
<initrd>/var/lib/xen/initrd.img.0u-Vhq</initrd>
<cmdline> method=http://download.fedora.devel.redhat.com/pub/fedora/linux/core/test/5.91/x86_64/os </cmdline>
</os>
<clock offset='localtime'/>
<on_poweroff>destroy</on_poweroff>
<on_reboot>destroy</on_reboot>
<on_crash>destroy</on_crash>
<devices>
<disk type='file' device='disk'>
<driver name='file'/>
<source file='/root/some.img'/>
<target dev='xvda' bus='xen'/>
</disk>
<console type='pty'>
<target port='0'/>
</console>
</devices>
</domain>

View File

@ -144,6 +144,7 @@ mymain(int argc, char **argv)
DO_TEST("net-e1000", "net-e1000", 2);
DO_TEST("bridge-ipaddr", "bridge-ipaddr", 3);
DO_TEST("no-source-cdrom", "no-source-cdrom", 2);
DO_TEST("pv-localtime", "pv-localtime", 2);
DO_TEST("fv-utc", "fv-utc", 1);
DO_TEST("fv-localtime", "fv-localtime", 1);

View File

@ -1 +1 @@
(vm (name 'fvtest')(memory 400)(maxmem 400)(vcpus 1)(uuid 'b5d70dd2-75cd-aca5-1776-9660b059d8bc')(on_poweroff 'destroy')(on_reboot 'restart')(on_crash 'restart')(image (hvm (kernel '/usr/lib/xen/boot/hvmloader')(vcpus 1)(boot c)(cdrom '/root/boot.iso')(acpi 1)(usb 1)(parallel none)(serial none)(localtime 1)(device_model '/usr/lib64/xen/bin/qemu-dm')(vnc 1)))(device (vbd (dev 'ioemu:hda')(uname 'file:/root/foo.img')(mode 'w')))(device (vif (mac '00:16:3e:1b:b1:47')(bridge 'xenbr0')(script 'vif-bridge')(type ioemu))))
(vm (name 'fvtest')(memory 400)(maxmem 400)(vcpus 1)(uuid 'b5d70dd2-75cd-aca5-1776-9660b059d8bc')(on_poweroff 'destroy')(on_reboot 'restart')(on_crash 'restart')(localtime 1)(image (hvm (kernel '/usr/lib/xen/boot/hvmloader')(vcpus 1)(boot c)(cdrom '/root/boot.iso')(acpi 1)(usb 1)(parallel none)(serial none)(localtime 1)(device_model '/usr/lib64/xen/bin/qemu-dm')(vnc 1)))(device (vbd (dev 'ioemu:hda')(uname 'file:/root/foo.img')(mode 'w')))(device (vif (mac '00:16:3e:1b:b1:47')(bridge 'xenbr0')(script 'vif-bridge')(type ioemu))))

View File

@ -0,0 +1 @@
(vm (name 'rhel5')(memory 175)(maxmem 385)(vcpus 1)(uuid '4f77abd2-3019-58e8-3bab-6fbf2118f880')(bootloader '/usr/bin/pygrub')(on_poweroff 'destroy')(on_reboot 'restart')(on_crash 'restart')(localtime 1)(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,25 @@
<domain type='xen' id='5'>
<name>rhel5</name>
<uuid>4f77abd2301958e83bab6fbf2118f880</uuid>
<bootloader>/usr/bin/pygrub</bootloader>
<memory>394240</memory>
<currentMemory>179200</currentMemory>
<vcpu>1</vcpu>
<on_poweroff>destroy</on_poweroff>
<on_reboot>restart</on_reboot>
<on_crash>restart</on_crash>
<clock offset='localtime'/>
<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

@ -129,6 +129,7 @@ mymain(int argc, char **argv)
DO_TEST("net-e1000", "net-e1000", "pvtest", 2);
DO_TEST("bridge-ipaddr", "bridge-ipaddr", "pvtest", 2);
DO_TEST("no-source-cdrom", "no-source-cdrom", "test", 2);
DO_TEST("pv-localtime", "pv-localtime", "pvtest", 1);
DO_TEST("fv-utc", "fv-utc", "fvtest", 1);
DO_TEST("fv-localtime", "fv-localtime", "fvtest", 1);