Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
libvirt
提交
67c346b1
L
libvirt
项目概览
openeuler
/
libvirt
通知
3
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
L
libvirt
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
67c346b1
编写于
7月 16, 2007
作者:
D
Daniel P. Berrange
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Added new <clock/> element in XML for choosing utc/localtime
上级
657b5eb5
变更
30
显示空白变更内容
内联
并排
Showing
30 changed file
with
464 addition
and
20 deletion
+464
-20
ChangeLog
ChangeLog
+13
-0
docs/format.html
docs/format.html
+8
-0
docs/libvir.html
docs/libvir.html
+8
-0
src/qemu_conf.c
src/qemu_conf.c
+22
-0
src/qemu_conf.h
src/qemu_conf.h
+1
-0
src/xend_internal.c
src/xend_internal.c
+5
-0
src/xm_internal.c
src/xm_internal.c
+15
-0
src/xml.c
src/xml.c
+5
-0
tests/sexpr2xmldata/sexpr2xml-fv-localtime.sexpr
tests/sexpr2xmldata/sexpr2xml-fv-localtime.sexpr
+1
-0
tests/sexpr2xmldata/sexpr2xml-fv-localtime.xml
tests/sexpr2xmldata/sexpr2xml-fv-localtime.xml
+38
-0
tests/sexpr2xmldata/sexpr2xml-fv-utc.sexpr
tests/sexpr2xmldata/sexpr2xml-fv-utc.sexpr
+1
-0
tests/sexpr2xmldata/sexpr2xml-fv-utc.xml
tests/sexpr2xmldata/sexpr2xml-fv-utc.xml
+38
-0
tests/sexpr2xmldata/sexpr2xml-fv-v2.xml
tests/sexpr2xmldata/sexpr2xml-fv-v2.xml
+1
-0
tests/sexpr2xmldata/sexpr2xml-fv.xml
tests/sexpr2xmldata/sexpr2xml-fv.xml
+1
-0
tests/sexpr2xmldata/sexpr2xml-no-source-cdrom.xml
tests/sexpr2xmldata/sexpr2xml-no-source-cdrom.xml
+1
-0
tests/sexpr2xmltest.c
tests/sexpr2xmltest.c
+27
-5
tests/xmconfigdata/test-fullvirt-localtime.cfg
tests/xmconfigdata/test-fullvirt-localtime.cfg
+23
-0
tests/xmconfigdata/test-fullvirt-localtime.xml
tests/xmconfigdata/test-fullvirt-localtime.xml
+40
-0
tests/xmconfigdata/test-fullvirt-new-cdrom.cfg
tests/xmconfigdata/test-fullvirt-new-cdrom.cfg
+1
-0
tests/xmconfigdata/test-fullvirt-new-cdrom.xml
tests/xmconfigdata/test-fullvirt-new-cdrom.xml
+1
-0
tests/xmconfigdata/test-fullvirt-old-cdrom.cfg
tests/xmconfigdata/test-fullvirt-old-cdrom.cfg
+1
-0
tests/xmconfigdata/test-fullvirt-old-cdrom.xml
tests/xmconfigdata/test-fullvirt-old-cdrom.xml
+1
-0
tests/xmconfigdata/test-fullvirt-utc.cfg
tests/xmconfigdata/test-fullvirt-utc.cfg
+23
-0
tests/xmconfigdata/test-fullvirt-utc.xml
tests/xmconfigdata/test-fullvirt-utc.xml
+40
-0
tests/xmconfigtest.c
tests/xmconfigtest.c
+51
-15
tests/xml2sexprdata/xml2sexpr-fv-localtime.sexpr
tests/xml2sexprdata/xml2sexpr-fv-localtime.sexpr
+1
-0
tests/xml2sexprdata/xml2sexpr-fv-localtime.xml
tests/xml2sexprdata/xml2sexpr-fv-localtime.xml
+37
-0
tests/xml2sexprdata/xml2sexpr-fv-utc.sexpr
tests/xml2sexprdata/xml2sexpr-fv-utc.sexpr
+1
-0
tests/xml2sexprdata/xml2sexpr-fv-utc.xml
tests/xml2sexprdata/xml2sexpr-fv-utc.xml
+37
-0
tests/xml2sexprtest.c
tests/xml2sexprtest.c
+22
-0
未找到文件。
ChangeLog
浏览文件 @
67c346b1
Mon Jul 16 16:59:24 EST 2007 Daniel P. Berrange <berrange@redhat.com>
* src/qemu_conf.c, src/qemu_conf.h, src/xend_internal.c,
src/xm_internal.c, src/xml.c: Added support for the <clock/>
element to switch between UTC and localtime in guests
* tests/sexpr2xmltest.c, tests/xmconfigtest.c,
tests/xml2sexprtest.c, tests/sexpr2xmldata/*,
tests/xml2sexprdata/*, tests/xmconfigdata/*: Added test
cases for new <clock/> element, and adapted existing expected
data files where needed.
* docs/libvir.html, docs/format.html: Added docs about the
new <clock/> element
Fri Jul 13 14:25:16 CEST 2007 Daniel Veillard <veillard@redhat.com>
* src/xml.c: applied modified patch from Masayuki Sunou for
...
...
docs/format.html
浏览文件 @
67c346b1
...
...
@@ -117,6 +117,7 @@ systems:</p><pre><domain type='xen' id='3'>
<
acpi/
>
<
apic/
>
</span>
<
/features
>
<span
style=
"color: #0000E5; background-color: #FFFFFF"
>
<
clock sync="localtime"/
>
</span>
<
devices
>
<span
style=
"color: #0000E5; background-color: #FFFFFF"
>
<
emulator
>
/usr/lib/xen/bin/qemu-dm
<
/emulator
>
</span>
<
interface type='bridge'
>
...
...
@@ -146,6 +147,11 @@ systems:</p><pre><domain type='xen' id='3'>
<li><code>
apic
</code>
- enable IO APIC
</li>
<li><code>
acpi
</code>
- enable ACPI bios
</li>
</ul></li>
<li>
the optional
<code>
<
clock
>
</code>
element is used to specify
whether the emulated BIOS clock in the guest is synced to either
<code>
localtime
</code>
or
<code>
utc
</code>
. In general Windows will
want
<code>
localtime
</code>
while all other operating systems will
want
<code>
utc
</code>
. The default is thus
<code>
utc
</code></li>
<li>
the
<code>
<
os
>
</code>
block description is very different, first
it indicates that the type is 'hvm' for hardware virtualization, then
instead of a kernel, boot and command line arguments, it points to an os
...
...
@@ -194,6 +200,7 @@ XML description is quite similar, here is a simple example:</p><pre><domain <
<
os
>
<
type
>
hvm
<
/type
>
<
/os
>
<span
style=
"color: #0000E5; background-color: #FFFFFF"
>
<
clock sync="localtime"/
>
</span>
<
devices
>
<span
style=
"color: #FF0000; background-color: #FFFFFF"
>
<
emulator
>
/home/user/usr/kvm-devel/bin/qemu-system-x86_64
<
/emulator
>
</span>
<
disk type='file' device='disk'
>
...
...
@@ -206,6 +213,7 @@ XML description is quite similar, here is a simple example:</p><pre><domain <
<
graphics type='vnc' port='-1'/
>
<
/devices
>
<
/domain
>
</pre><p>
The specific points to note if using KVM are:
</p><ul><li>
the top level domain element carries a type of 'kvm'
</li>
<li>
the
<
clock
>
optional is supported as with Xen HVM
</li>
<li>
the
<
devices
>
emulator points to the special qemu binary required
for KVM
</li>
<li>
networking interface definitions definitions are somewhat different due
...
...
docs/libvir.html
浏览文件 @
67c346b1
...
...
@@ -738,6 +738,7 @@ systems:</p>
<
acpi/
>
<
apic/
>
</span>
<
/features
>
<span
style=
"color: #0000E5; background-color: #FFFFFF"
>
<
clock sync="localtime"/
>
</span>
<
devices
>
<span
style=
"color: #0000E5; background-color: #FFFFFF"
>
<
emulator
>
/usr/lib/xen/bin/qemu-dm
<
/emulator
>
</span>
<
interface type='bridge'
>
...
...
@@ -773,6 +774,11 @@ systems:</p>
<li><code>
acpi
</code>
- enable ACPI bios
</li>
</ul>
</li>
<li>
the optional
<code>
<
clock
>
</code>
element is used to specify
whether the emulated BIOS clock in the guest is synced to either
<code>
localtime
</code>
or
<code>
utc
</code>
. In general Windows will
want
<code>
localtime
</code>
while all other operating systems will
want
<code>
utc
</code>
. The default is thus
<code>
utc
</code></li>
<li>
the
<code>
<
os
>
</code>
block description is very different, first
it indicates that the type is 'hvm' for hardware virtualization, then
instead of a kernel, boot and command line arguments, it points to an os
...
...
@@ -832,6 +838,7 @@ XML description is quite similar, here is a simple example:</p>
<
os
>
<
type
>
hvm
<
/type
>
<
/os
>
<span
style=
"color: #0000E5; background-color: #FFFFFF"
>
<
clock sync="localtime"/
>
</span>
<
devices
>
<span
style=
"color: #FF0000; background-color: #FFFFFF"
>
<
emulator
>
/home/user/usr/kvm-devel/bin/qemu-system-x86_64
<
/emulator
>
</span>
<
disk type='file' device='disk'
>
...
...
@@ -848,6 +855,7 @@ XML description is quite similar, here is a simple example:</p>
<p>
The specific points to note if using KVM are:
</p>
<ul>
<li>
the top level domain element carries a type of 'kvm'
</li>
<li>
the
<
clock
>
optional is supported as with Xen HVM
</li>
<li>
the
<
devices
>
emulator points to the special qemu binary required
for KVM
</li>
<li>
networking interface definitions definitions are somewhat different due
...
...
src/qemu_conf.c
浏览文件 @
67c346b1
...
...
@@ -967,6 +967,20 @@ static struct qemud_vm_def *qemudParseXML(virConnectPtr conn,
if
(
obj
)
xmlXPathFreeObject
(
obj
);
/* See if we set clock to localtime */
obj
=
xmlXPathEval
(
BAD_CAST
"string(/domain/clock/@offset)"
,
ctxt
);
if
((
obj
==
NULL
)
||
(
obj
->
type
!=
XPATH_STRING
)
||
(
obj
->
stringval
==
NULL
)
||
(
obj
->
stringval
[
0
]
==
0
))
{
def
->
localtime
=
0
;
}
else
{
if
(
!
strcmp
((
char
*
)
obj
->
stringval
,
"localtime"
))
def
->
localtime
=
1
;
else
def
->
localtime
=
0
;
}
if
(
obj
)
xmlXPathFreeObject
(
obj
);
/* Extract OS type info */
obj
=
xmlXPathEval
(
BAD_CAST
"string(/domain/os/type[1])"
,
ctxt
);
...
...
@@ -1338,6 +1352,7 @@ int qemudBuildCommandLine(virConnectPtr conn,
2
+
/* cpus */
2
+
/* boot device */
2
+
/* monitor */
(
vm
->
def
->
localtime
?
1
:
0
)
+
/* localtime */
(
driver
->
qemuCmdFlags
&
QEMUD_CMD_FLAG_NO_REBOOT
&&
vm
->
def
->
noReboot
?
1
:
0
)
+
/* no-reboot */
(
vm
->
def
->
features
&
QEMUD_FEATURE_ACPI
?
0
:
1
)
+
/* acpi */
...
...
@@ -1376,6 +1391,11 @@ int qemudBuildCommandLine(virConnectPtr conn,
if
(
!
((
*
argv
)[
++
n
]
=
strdup
(
"pty"
)))
goto
no_memory
;
if
(
vm
->
def
->
localtime
)
{
if
(
!
((
*
argv
)[
++
n
]
=
strdup
(
"-localtime"
)))
goto
no_memory
;
}
if
(
driver
->
qemuCmdFlags
&
QEMUD_CMD_FLAG_NO_REBOOT
&&
vm
->
def
->
noReboot
)
{
if
(
!
((
*
argv
)[
++
n
]
=
strdup
(
"-no-reboot"
)))
...
...
@@ -2623,6 +2643,8 @@ char *qemudGenerateXML(virConnectPtr conn,
goto
no_memory
;
}
virBufferVSprintf
(
buf
,
" <clock offset='%s'/>
\n
"
,
def
->
localtime
?
"localtime"
:
"utc"
);
if
(
virBufferAdd
(
buf
,
" <on_poweroff>destroy</on_poweroff>
\n
"
,
-
1
)
<
0
)
goto
no_memory
;
if
(
def
->
noReboot
)
{
...
...
src/qemu_conf.h
浏览文件 @
67c346b1
...
...
@@ -164,6 +164,7 @@ struct qemud_vm_def {
struct
qemud_vm_os_def
os
;
int
localtime
;
int
features
;
int
graphicsType
;
int
vncPort
;
...
...
src/xend_internal.c
浏览文件 @
67c346b1
...
...
@@ -1442,6 +1442,8 @@ xend_parse_sexp_desc(virConnectPtr conn, struct sexpr *root, int xendConfigVersi
virBufferVSprintf
(
&
buf
,
" <on_crash>%s</on_crash>
\n
"
,
tmp
);
if
(
hvm
)
{
int
clockLocal
;
virBufferAdd
(
&
buf
,
" <features>
\n
"
,
13
);
if
(
sexpr_int
(
root
,
"domain/image/hvm/acpi"
))
virBufferAdd
(
&
buf
,
" <acpi/>
\n
"
,
12
);
...
...
@@ -1450,6 +1452,9 @@ xend_parse_sexp_desc(virConnectPtr conn, struct sexpr *root, int xendConfigVersi
if
(
sexpr_int
(
root
,
"domain/image/hvm/pae"
))
virBufferAdd
(
&
buf
,
" <pae/>
\n
"
,
11
);
virBufferAdd
(
&
buf
,
" </features>
\n
"
,
14
);
clockLocal
=
sexpr_int
(
root
,
"domain/image/hvm/localtime"
);
virBufferVSprintf
(
&
buf
,
" <clock offset='%s'/>
\n
"
,
clockLocal
?
"localtime"
:
"utc"
);
}
virBufferAdd
(
&
buf
,
" <devices>
\n
"
,
12
);
...
...
src/xm_internal.c
浏览文件 @
67c346b1
...
...
@@ -708,6 +708,10 @@ char *xenXMDomainFormatXML(virConnectPtr conn, virConfPtr conf) {
val
)
virBufferAdd
(
buf
,
" <apic/>
\n
"
,
-
1
);
virBufferAdd
(
buf
,
" </features>
\n
"
,
-
1
);
if
(
xenXMConfigGetInt
(
conf
,
"localtime"
,
&
val
)
<
0
)
val
=
0
;
virBufferVSprintf
(
buf
,
" <clock offset='%s'/>
\n
"
,
val
?
"localtime"
:
"utc"
);
}
virBufferAdd
(
buf
,
" <devices>
\n
"
,
-
1
);
...
...
@@ -1812,6 +1816,7 @@ virConfPtr xenXMParseXMLToConfig(virConnectPtr conn, const char *xml) {
if
(
hvm
)
{
const
char
*
boot
=
"c"
;
int
clockLocal
=
0
;
if
(
xenXMConfigSetString
(
conf
,
"builder"
,
"hvm"
)
<
0
)
goto
error
;
...
...
@@ -1845,6 +1850,16 @@ virConfPtr xenXMParseXMLToConfig(virConnectPtr conn, const char *xml) {
"cannot set the apic parameter"
)
<
0
)
goto
error
;
obj
=
xmlXPathEval
(
BAD_CAST
"string(/domain/clock/@offset)"
,
ctxt
);
if
((
obj
!=
NULL
)
&&
(
obj
->
type
==
XPATH_STRING
)
&&
(
obj
->
stringval
!=
NULL
))
{
if
(
!
strcmp
((
const
char
*
)
obj
->
stringval
,
"localtime"
))
clockLocal
=
1
;
}
xmlXPathFreeObject
(
obj
);
if
(
xenXMConfigSetInt
(
conf
,
"localtime"
,
clockLocal
)
<
0
)
goto
error
;
if
(
priv
->
xendConfigVersion
==
1
)
{
if
(
xenXMConfigSetStringFromXPath
(
conn
,
conf
,
ctxt
,
"cdrom"
,
"string(/domain/devices/disk[@device='cdrom']/source/@file)"
,
1
,
"cannot set the cdrom parameter"
)
<
0
)
...
...
src/xml.c
浏览文件 @
67c346b1
...
...
@@ -562,6 +562,11 @@ virDomainParseXMLOSDescHVM(virConnectPtr conn, xmlNodePtr node, virBufferPtr buf
}
}
str
=
virXPathString
(
"string(/domain/clock/@offset)"
,
ctxt
);
if
(
str
!=
NULL
&&
!
strcmp
(
str
,
"localtime"
))
{
virBufferAdd
(
buf
,
"(localtime 1)"
,
13
);
}
virBufferAdd
(
buf
,
"))"
,
2
);
return
(
0
);
...
...
tests/sexpr2xmldata/sexpr2xml-fv-localtime.sexpr
0 → 100644
浏览文件 @
67c346b1
(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))))
tests/sexpr2xmldata/sexpr2xml-fv-localtime.xml
0 → 100644
浏览文件 @
67c346b1
<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>
tests/sexpr2xmldata/sexpr2xml-fv-utc.sexpr
0 → 100644
浏览文件 @
67c346b1
(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))))
tests/sexpr2xmldata/sexpr2xml-fv-utc.xml
0 → 100644
浏览文件 @
67c346b1
<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>
tests/sexpr2xmldata/sexpr2xml-fv-v2.xml
浏览文件 @
67c346b1
...
...
@@ -14,6 +14,7 @@
<features>
<acpi/>
</features>
<clock
offset=
'utc'
/>
<devices>
<emulator>
/usr/lib64/xen/bin/qemu-dm
</emulator>
<disk
type=
'file'
device=
'cdrom'
>
...
...
tests/sexpr2xmldata/sexpr2xml-fv.xml
浏览文件 @
67c346b1
...
...
@@ -14,6 +14,7 @@
<features>
<acpi/>
</features>
<clock
offset=
'utc'
/>
<devices>
<emulator>
/usr/lib64/xen/bin/qemu-dm
</emulator>
<disk
type=
'file'
device=
'disk'
>
...
...
tests/sexpr2xmldata/sexpr2xml-no-source-cdrom.xml
浏览文件 @
67c346b1
...
...
@@ -17,6 +17,7 @@
<apic/>
<pae/>
</features>
<clock
offset=
'utc'
/>
<devices>
<emulator>
/usr/lib/xen/bin/qemu-dm
</emulator>
<interface
type=
'bridge'
>
...
...
tests/sexpr2xmltest.c
浏览文件 @
67c346b1
...
...
@@ -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
(
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
);
}
if
(
strcmp
(
xmlData
,
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 */
...
...
tests/xmconfigdata/test-fullvirt-localtime.cfg
0 → 100755
浏览文件 @
67c346b1
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" ]
tests/xmconfigdata/test-fullvirt-localtime.xml
0 → 100644
浏览文件 @
67c346b1
<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>
tests/xmconfigdata/test-fullvirt-new-cdrom.cfg
浏览文件 @
67c346b1
...
...
@@ -9,6 +9,7 @@ boot = "d"
pae = 1
acpi = 1
apic = 1
localtime = 0
on_poweroff = "destroy"
on_reboot = "restart"
on_crash = "restart"
...
...
tests/xmconfigdata/test-fullvirt-new-cdrom.xml
浏览文件 @
67c346b1
...
...
@@ -17,6 +17,7 @@
<acpi/>
<apic/>
</features>
<clock
offset=
'utc'
/>
<devices>
<emulator>
/usr/lib/xen/bin/qemu-dm
</emulator>
<disk
type=
'block'
device=
'disk'
>
...
...
tests/xmconfigdata/test-fullvirt-old-cdrom.cfg
浏览文件 @
67c346b1
...
...
@@ -9,6 +9,7 @@ boot = "d"
pae = 1
acpi = 1
apic = 1
localtime = 0
cdrom = "/root/boot.iso"
on_poweroff = "destroy"
on_reboot = "restart"
...
...
tests/xmconfigdata/test-fullvirt-old-cdrom.xml
浏览文件 @
67c346b1
...
...
@@ -17,6 +17,7 @@
<acpi/>
<apic/>
</features>
<clock
offset=
'utc'
/>
<devices>
<emulator>
/usr/lib/xen/bin/qemu-dm
</emulator>
<disk
type=
'block'
device=
'disk'
>
...
...
tests/xmconfigdata/test-fullvirt-utc.cfg
0 → 100755
浏览文件 @
67c346b1
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" ]
tests/xmconfigdata/test-fullvirt-utc.xml
0 → 100644
浏览文件 @
67c346b1
<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>
tests/xmconfigtest.c
浏览文件 @
67c346b1
...
...
@@ -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
=
virConnectOpen
ReadOnly
(
"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
(
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
);
}
if
(
strcmp
(
xmcfgData
,
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
=
virConnectOpen
ReadOnly
(
"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
(
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
);
}
if
(
strcmp
(
xmlData
,
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
);
}
...
...
tests/xml2sexprdata/xml2sexpr-fv-localtime.sexpr
0 → 100644
浏览文件 @
67c346b1
(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))))
\ No newline at end of file
tests/xml2sexprdata/xml2sexpr-fv-localtime.xml
0 → 100644
浏览文件 @
67c346b1
<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>
tests/xml2sexprdata/xml2sexpr-fv-utc.sexpr
0 → 100644
浏览文件 @
67c346b1
(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))))
\ No newline at end of file
tests/xml2sexprdata/xml2sexpr-fv-utc.xml
0 → 100644
浏览文件 @
67c346b1
<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>
tests/xml2sexprtest.c
浏览文件 @
67c346b1
...
...
@@ -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
);
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录