Added new <clock/> element in XML for choosing utc/localtime

This commit is contained in:
Daniel P. Berrange
2007-07-16 21:30:30 +00:00
parent 657b5eb50c
commit 67c346b102
30 changed files with 464 additions and 20 deletions

View File

@@ -0,0 +1 @@
(domain (domid 3)(name 'fvtest')(memory 400)(maxmem 400)(vcpus 1)(uuid 'b5d70dd275cdaca517769660b059d8bc')(on_poweroff 'destroy')(on_reboot 'restart')(on_crash 'restart')(image (hvm (kernel '/usr/lib/xen/boot/hvmloader')(device_model '/usr/lib64/xen/bin/qemu-dm')(boot c)(cdrom '/root/boot.iso')(acpi 1)(vnc 1)(keymap ja)(localtime 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,38 @@
<domain type='xen' id='3'>
<name>fvtest</name>
<uuid>b5d70dd275cdaca517769660b059d8bc</uuid>
<os>
<type>hvm</type>
<loader>/usr/lib/xen/boot/hvmloader</loader>
<boot dev='hd'/>
</os>
<memory>409600</memory>
<vcpu>1</vcpu>
<on_poweroff>destroy</on_poweroff>
<on_reboot>restart</on_reboot>
<on_crash>restart</on_crash>
<features>
<acpi/>
</features>
<clock offset='localtime'/>
<devices>
<emulator>/usr/lib64/xen/bin/qemu-dm</emulator>
<disk type='file' device='disk'>
<driver name='file'/>
<source file='/root/foo.img'/>
<target dev='hda'/>
</disk>
<interface type='bridge'>
<source bridge='xenbr0'/>
<mac address='00:16:3e:1b:b1:47'/>
<script path='vif-bridge'/>
</interface>
<disk type='file' device='cdrom'>
<driver name='file'/>
<source file='/root/boot.iso'/>
<target dev='hdc'/>
<readonly/>
</disk>
<graphics type='vnc' port='5903' keymap='ja'/>
</devices>
</domain>

View File

@@ -0,0 +1 @@
(domain (domid 3)(name 'fvtest')(memory 400)(maxmem 400)(vcpus 1)(uuid 'b5d70dd275cdaca517769660b059d8bc')(on_poweroff 'destroy')(on_reboot 'restart')(on_crash 'restart')(image (hvm (kernel '/usr/lib/xen/boot/hvmloader')(device_model '/usr/lib64/xen/bin/qemu-dm')(boot c)(cdrom '/root/boot.iso')(acpi 1)(vnc 1)(keymap ja)))(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,38 @@
<domain type='xen' id='3'>
<name>fvtest</name>
<uuid>b5d70dd275cdaca517769660b059d8bc</uuid>
<os>
<type>hvm</type>
<loader>/usr/lib/xen/boot/hvmloader</loader>
<boot dev='hd'/>
</os>
<memory>409600</memory>
<vcpu>1</vcpu>
<on_poweroff>destroy</on_poweroff>
<on_reboot>restart</on_reboot>
<on_crash>restart</on_crash>
<features>
<acpi/>
</features>
<clock offset='utc'/>
<devices>
<emulator>/usr/lib64/xen/bin/qemu-dm</emulator>
<disk type='file' device='disk'>
<driver name='file'/>
<source file='/root/foo.img'/>
<target dev='hda'/>
</disk>
<interface type='bridge'>
<source bridge='xenbr0'/>
<mac address='00:16:3e:1b:b1:47'/>
<script path='vif-bridge'/>
</interface>
<disk type='file' device='cdrom'>
<driver name='file'/>
<source file='/root/boot.iso'/>
<target dev='hdc'/>
<readonly/>
</disk>
<graphics type='vnc' port='5903' keymap='ja'/>
</devices>
</domain>

View File

@@ -14,6 +14,7 @@
<features>
<acpi/>
</features>
<clock offset='utc'/>
<devices>
<emulator>/usr/lib64/xen/bin/qemu-dm</emulator>
<disk type='file' device='cdrom'>

View File

@@ -14,6 +14,7 @@
<features>
<acpi/>
</features>
<clock offset='utc'/>
<devices>
<emulator>/usr/lib64/xen/bin/qemu-dm</emulator>
<disk type='file' device='disk'>

View File

@@ -17,6 +17,7 @@
<apic/>
<pae/>
</features>
<clock offset='utc'/>
<devices>
<emulator>/usr/lib/xen/bin/qemu-dm</emulator>
<interface type='bridge'>

View File

@@ -28,12 +28,13 @@ static int testCompareFiles(const char *xml, const char *sexpr, int xendConfigVe
if (!(gotxml = xend_parse_domain_sexp(NULL, sexprData, xendConfigVersion)))
goto fail;
if (getenv("DEBUG_TESTS")) {
printf("Expect %d '%s'\n", (int)strlen(xmlData), xmlData);
printf("Actual %d '%s'\n", (int)strlen(gotxml), gotxml);
}
if (strcmp(xmlData, gotxml))
if (strcmp(xmlData, gotxml)) {
if (getenv("DEBUG_TESTS")) {
printf("Expect %d '%s'\n", (int)strlen(xmlData), xmlData);
printf("Actual %d '%s'\n", (int)strlen(gotxml), gotxml);
}
goto fail;
}
ret = 0;
@@ -136,6 +137,19 @@ static int testCompareNoSourceCDRom(void *data ATTRIBUTE_UNUSED) {
1);
}
static int testCompareFVclockUTC(void *data ATTRIBUTE_UNUSED) {
return testCompareFiles("sexpr2xmldata/sexpr2xml-fv-utc.xml",
"sexpr2xmldata/sexpr2xml-fv-utc.sexpr",
1);
}
static int testCompareFVclockLocaltime(void *data ATTRIBUTE_UNUSED) {
return testCompareFiles("sexpr2xmldata/sexpr2xml-fv-localtime.xml",
"sexpr2xmldata/sexpr2xml-fv-localtime.sexpr",
1);
}
int
main(int argc, char **argv)
@@ -209,6 +223,14 @@ main(int argc, char **argv)
1, testCompareNoSourceCDRom, NULL) != 0)
ret = -1;
if (virtTestRun("SEXPR-2-XML clock UTC",
1, testCompareFVclockUTC, NULL) != 0)
ret = -1;
if (virtTestRun("SEXPR-2-XML clock Localtime",
1, testCompareFVclockLocaltime, NULL) != 0)
ret = -1;
exit(ret==0 ? EXIT_SUCCESS : EXIT_FAILURE);
}
#else /* WITHOUT_XEN */

View File

@@ -0,0 +1,23 @@
name = "XenGuest2"
uuid = "c7a5fdb2cdaf9455926ad65c16db1809"
maxmem = 579
memory = 394
vcpus = 1
builder = "hvm"
kernel = "/usr/lib/xen/boot/hvmloader"
boot = "d"
pae = 1
acpi = 1
apic = 1
localtime = 1
on_poweroff = "destroy"
on_reboot = "restart"
on_crash = "restart"
device_model = "/usr/lib/xen/bin/qemu-dm"
sdl = 0
vnc = 1
vncunused = 1
vnclisten = "127.0.0.1"
vncpasswd = "123poi"
disk = [ "phy:/dev/HostVG/XenGuest2,hda,w", "file:/root/boot.iso,hdc:cdrom,r" ]
vif = [ "mac=00:16:3E:66:92:9C,bridge=xenbr1,type=ioemu" ]

View File

@@ -0,0 +1,40 @@
<domain type='xen'>
<name>XenGuest2</name>
<uuid>c7a5fdb2cdaf9455926ad65c16db1809</uuid>
<os>
<type>hvm</type>
<loader>/usr/lib/xen/boot/hvmloader</loader>
<boot dev='cdrom'/>
</os>
<currentMemory>403456</currentMemory>
<memory>592896</memory>
<vcpu>1</vcpu>
<on_poweroff>destroy</on_poweroff>
<on_reboot>restart</on_reboot>
<on_crash>restart</on_crash>
<features>
<pae/>
<acpi/>
<apic/>
</features>
<clock offset='localtime'/>
<devices>
<emulator>/usr/lib/xen/bin/qemu-dm</emulator>
<disk type='block' device='disk'>
<driver name='phy'/>
<source dev='/dev/HostVG/XenGuest2'/>
<target dev='hda'/>
</disk>
<disk type='file' device='cdrom'>
<driver name='file'/>
<source file='/root/boot.iso'/>
<target dev='hdc'/>
<readonly/>
</disk>
<interface type='bridge'>
<mac address='00:16:3E:66:92:9C'/>
<source bridge='xenbr1'/>
</interface>
<graphics type='vnc' port='-1' listen='127.0.0.1' passwd='123poi'/>
</devices>
</domain>

View File

@@ -9,6 +9,7 @@ boot = "d"
pae = 1
acpi = 1
apic = 1
localtime = 0
on_poweroff = "destroy"
on_reboot = "restart"
on_crash = "restart"

View File

@@ -17,6 +17,7 @@
<acpi/>
<apic/>
</features>
<clock offset='utc'/>
<devices>
<emulator>/usr/lib/xen/bin/qemu-dm</emulator>
<disk type='block' device='disk'>

View File

@@ -9,6 +9,7 @@ boot = "d"
pae = 1
acpi = 1
apic = 1
localtime = 0
cdrom = "/root/boot.iso"
on_poweroff = "destroy"
on_reboot = "restart"

View File

@@ -17,6 +17,7 @@
<acpi/>
<apic/>
</features>
<clock offset='utc'/>
<devices>
<emulator>/usr/lib/xen/bin/qemu-dm</emulator>
<disk type='block' device='disk'>

View File

@@ -0,0 +1,23 @@
name = "XenGuest2"
uuid = "c7a5fdb2cdaf9455926ad65c16db1809"
maxmem = 579
memory = 394
vcpus = 1
builder = "hvm"
kernel = "/usr/lib/xen/boot/hvmloader"
boot = "d"
pae = 1
acpi = 1
apic = 1
localtime = 0
on_poweroff = "destroy"
on_reboot = "restart"
on_crash = "restart"
device_model = "/usr/lib/xen/bin/qemu-dm"
sdl = 0
vnc = 1
vncunused = 1
vnclisten = "127.0.0.1"
vncpasswd = "123poi"
disk = [ "phy:/dev/HostVG/XenGuest2,hda,w", "file:/root/boot.iso,hdc:cdrom,r" ]
vif = [ "mac=00:16:3E:66:92:9C,bridge=xenbr1,type=ioemu" ]

View File

@@ -0,0 +1,40 @@
<domain type='xen'>
<name>XenGuest2</name>
<uuid>c7a5fdb2cdaf9455926ad65c16db1809</uuid>
<os>
<type>hvm</type>
<loader>/usr/lib/xen/boot/hvmloader</loader>
<boot dev='cdrom'/>
</os>
<currentMemory>403456</currentMemory>
<memory>592896</memory>
<vcpu>1</vcpu>
<on_poweroff>destroy</on_poweroff>
<on_reboot>restart</on_reboot>
<on_crash>restart</on_crash>
<features>
<pae/>
<acpi/>
<apic/>
</features>
<clock offset='utc'/>
<devices>
<emulator>/usr/lib/xen/bin/qemu-dm</emulator>
<disk type='block' device='disk'>
<driver name='phy'/>
<source dev='/dev/HostVG/XenGuest2'/>
<target dev='hda'/>
</disk>
<disk type='file' device='cdrom'>
<driver name='file'/>
<source file='/root/boot.iso'/>
<target dev='hdc'/>
<readonly/>
</disk>
<interface type='bridge'>
<mac address='00:16:3E:66:92:9C'/>
<source bridge='xenbr1'/>
</interface>
<graphics type='vnc' port='-1' listen='127.0.0.1' passwd='123poi'/>
</devices>
</domain>

View File

@@ -49,7 +49,7 @@ static int testCompareParseXML(const char *xmcfg, const char *xml, int xendConfi
void *old_priv;
struct _xenUnifiedPrivate priv;
conn = virConnectOpen("test:///default");
conn = virConnectOpenReadOnly("test:///default");
if (!conn) goto fail;
old_priv = conn->privateData;
@@ -70,12 +70,13 @@ static int testCompareParseXML(const char *xmcfg, const char *xml, int xendConfi
goto fail;
gotxmcfgPtr[wrote] = '\0';
if (getenv("DEBUG_TESTS")) {
printf("Expect %d '%s'\n", (int)strlen(xmcfgData), xmcfgData);
printf("Actual %d '%s'\n", (int)strlen(gotxmcfgData), gotxmcfgData);
}
if (strcmp(xmcfgData, gotxmcfgData))
if (strcmp(xmcfgData, gotxmcfgData)) {
if (getenv("DEBUG_TESTS")) {
printf("Expect %d '%s'\n", (int)strlen(xmcfgData), xmcfgData);
printf("Actual %d '%s'\n", (int)strlen(gotxmcfgData), gotxmcfgData);
}
goto fail;
}
ret = 0;
@@ -103,7 +104,7 @@ static int testCompareFormatXML(const char *xmcfg, const char *xml, int xendConf
void *old_priv;
struct _xenUnifiedPrivate priv;
conn = virConnectOpen("test:///default");
conn = virConnectOpenReadOnly("test:///default");
if (!conn) goto fail;
old_priv = conn->privateData;
@@ -123,12 +124,13 @@ static int testCompareFormatXML(const char *xmcfg, const char *xml, int xendConf
if (!(gotxml = xenXMDomainFormatXML(conn, conf)))
goto fail;
if (getenv("DEBUG_TESTS")) {
printf("Expect %d '%s'\n", (int)strlen(xmlData), xmlData);
printf("Actual %d '%s'\n", (int)strlen(gotxml), gotxml);
}
if (strcmp(xmlData, gotxml))
if (strcmp(xmlData, gotxml)) {
if (getenv("DEBUG_TESTS")) {
printf("Expect %d '%s'\n", (int)strlen(xmlData), xmlData);
printf("Actual %d '%s'\n", (int)strlen(gotxml), gotxml);
}
goto fail;
}
ret = 0;
@@ -190,6 +192,29 @@ static int testCompareFullvirtNewCDROMParse(void *data ATTRIBUTE_UNUSED) {
2);
}
static int testCompareFullvirtClockUTCFormat(void *data ATTRIBUTE_UNUSED) {
return testCompareFormatXML("xmconfigdata/test-fullvirt-utc.cfg",
"xmconfigdata/test-fullvirt-utc.xml",
2);
}
static int testCompareFullvirtClockUTCParse(void *data ATTRIBUTE_UNUSED) {
return testCompareParseXML("xmconfigdata/test-fullvirt-utc.cfg",
"xmconfigdata/test-fullvirt-utc.xml",
2);
}
static int testCompareFullvirtClockLocaltimeFormat(void *data ATTRIBUTE_UNUSED) {
return testCompareFormatXML("xmconfigdata/test-fullvirt-localtime.cfg",
"xmconfigdata/test-fullvirt-localtime.xml",
2);
}
static int testCompareFullvirtClockLocaltimeParse(void *data ATTRIBUTE_UNUSED) {
return testCompareParseXML("xmconfigdata/test-fullvirt-localtime.cfg",
"xmconfigdata/test-fullvirt-localtime.xml",
2);
}
int
main(int argc, char **argv)
@@ -203,22 +228,27 @@ main(int argc, char **argv)
exit(EXIT_FAILURE);
}
/* Config -> XML */
if (virtTestRun("Paravirt old PVFB (Format)",
1, testCompareParavirtOldPVFBFormat, NULL) != 0)
ret = -1;
if (virtTestRun("Paravirt new PVFB (Format)",
1, testCompareParavirtNewPVFBFormat, NULL) != 0)
ret = -1;
if (virtTestRun("Fullvirt old PVFB (Format)",
1, testCompareFullvirtOldCDROMFormat, NULL) != 0)
ret = -1;
if (virtTestRun("Fullvirt new PVFB (Format)",
1, testCompareFullvirtNewCDROMFormat, NULL) != 0)
ret = -1;
if (virtTestRun("Fullvirt clock Localtime (Format)",
1, testCompareFullvirtClockLocaltimeFormat, NULL) != 0)
ret = -1;
if (virtTestRun("Fullvirt clock UTC (Format)",
1, testCompareFullvirtClockUTCFormat, NULL) != 0)
ret = -1;
/* XML -> Config */
if (virtTestRun("Paravirt old PVFB (Parse)",
1, testCompareParavirtOldPVFBParse, NULL) != 0)
ret = -1;
@@ -231,6 +261,12 @@ main(int argc, char **argv)
if (virtTestRun("Fullvirt new PVFB (Parse)",
1, testCompareFullvirtNewCDROMParse, NULL) != 0)
ret = -1;
if (virtTestRun("Fullvirt clock Localtime (Parse)",
1, testCompareFullvirtClockLocaltimeParse, NULL) != 0)
ret = -1;
if (virtTestRun("Fullvirt clock UTC (Parse)",
1, testCompareFullvirtClockUTCParse, NULL) != 0)
ret = -1;
exit(ret==0 ? EXIT_SUCCESS : EXIT_FAILURE);
}

View File

@@ -0,0 +1 @@
(vm (name 'fvtest')(memory 400)(maxmem 400)(vcpus 1)(uuid 'b5d70dd275cdaca517769660b059d8bc')(on_poweroff 'destroy')(on_reboot 'restart')(on_crash 'restart')(image (hvm (kernel '/usr/lib/xen/boot/hvmloader')(device_model '/usr/lib64/xen/bin/qemu-dm')(vcpus 1)(boot c)(cdrom '/root/boot.iso')(acpi 1)(vnc 1)(localtime 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,37 @@
<domain type='xen'>
<name>fvtest</name>
<uuid>b5d70dd275cdaca517769660b059d8bc</uuid>
<os>
<type>hvm</type>
<loader>/usr/lib/xen/boot/hvmloader</loader>
<boot dev='hd'/>
</os>
<memory>409600</memory>
<vcpu>1</vcpu>
<on_poweroff>destroy</on_poweroff>
<on_reboot>restart</on_reboot>
<on_crash>restart</on_crash>
<features>
<acpi/>
</features>
<clock offset='localtime'/>
<devices>
<emulator>/usr/lib64/xen/bin/qemu-dm</emulator>
<interface type='bridge'>
<source bridge='xenbr0'/>
<mac address='00:16:3e:1b:b1:47'/>
<script path='vif-bridge'/>
</interface>
<disk type='file' device='cdrom'>
<source file='/root/boot.iso'/>
<target dev='hdc'/>
<readonly/>
</disk>
<disk type='file'>
<source file='/root/foo.img'/>
<target dev='ioemu:hda'/>
</disk>
<graphics type='vnc' port='5917' keymap='ja'/>
</devices>
</domain>

View File

@@ -0,0 +1 @@
(vm (name 'fvtest')(memory 400)(maxmem 400)(vcpus 1)(uuid 'b5d70dd275cdaca517769660b059d8bc')(on_poweroff 'destroy')(on_reboot 'restart')(on_crash 'restart')(image (hvm (kernel '/usr/lib/xen/boot/hvmloader')(device_model '/usr/lib64/xen/bin/qemu-dm')(vcpus 1)(boot c)(cdrom '/root/boot.iso')(acpi 1)(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,37 @@
<domain type='xen'>
<name>fvtest</name>
<uuid>b5d70dd275cdaca517769660b059d8bc</uuid>
<os>
<type>hvm</type>
<loader>/usr/lib/xen/boot/hvmloader</loader>
<boot dev='hd'/>
</os>
<memory>409600</memory>
<vcpu>1</vcpu>
<on_poweroff>destroy</on_poweroff>
<on_reboot>restart</on_reboot>
<on_crash>restart</on_crash>
<features>
<acpi/>
</features>
<clock offset='utc'/>
<devices>
<emulator>/usr/lib64/xen/bin/qemu-dm</emulator>
<interface type='bridge'>
<source bridge='xenbr0'/>
<mac address='00:16:3e:1b:b1:47'/>
<script path='vif-bridge'/>
</interface>
<disk type='file' device='cdrom'>
<source file='/root/boot.iso'/>
<target dev='hdc'/>
<readonly/>
</disk>
<disk type='file'>
<source file='/root/foo.img'/>
<target dev='ioemu:hda'/>
</disk>
<graphics type='vnc' port='5917' keymap='ja'/>
</devices>
</domain>

View File

@@ -187,6 +187,20 @@ static int testCompareNoSourceCDRom(void *data ATTRIBUTE_UNUSED) {
2);
}
static int testCompareFVclockUTC(void *data ATTRIBUTE_UNUSED) {
return testCompareFiles("xml2sexprdata/xml2sexpr-fv-utc.xml",
"xml2sexprdata/xml2sexpr-fv-utc.sexpr",
"fvtest",
1);
}
static int testCompareFVclockLocaltime(void *data ATTRIBUTE_UNUSED) {
return testCompareFiles("xml2sexprdata/xml2sexpr-fv-localtime.xml",
"xml2sexprdata/xml2sexpr-fv-localtime.sexpr",
"fvtest",
1);
}
int
main(int argc, char **argv)
@@ -276,5 +290,13 @@ main(int argc, char **argv)
1, testCompareNoSourceCDRom, NULL) != 0)
ret = -1;
if (virtTestRun("XML-2-SEXPR clock UTC",
1, testCompareFVclockUTC, NULL) != 0)
ret = -1;
if (virtTestRun("XML-2-SEXPR clock Localtime",
1, testCompareFVclockLocaltime, NULL) != 0)
ret = -1;
exit(ret==0 ? EXIT_SUCCESS : EXIT_FAILURE);
}