Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
libvirt
提交
1ed4d292
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看板
体验新版 GitCode,发现更多精彩内容 >>
提交
1ed4d292
编写于
9月 12, 2006
作者:
D
Daniel P. Berrange
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Allow setting of VNC port when creating domains
上级
25786cc0
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
87 addition
and
7 deletion
+87
-7
ChangeLog
ChangeLog
+7
-0
src/xml.c
src/xml.c
+31
-6
tests/xml2sexprdata/xml2sexpr-fv-v2.sexpr
tests/xml2sexprdata/xml2sexpr-fv-v2.sexpr
+1
-1
tests/xml2sexprdata/xml2sexpr-fv-vncunused.sexpr
tests/xml2sexprdata/xml2sexpr-fv-vncunused.sexpr
+1
-0
tests/xml2sexprdata/xml2sexpr-fv-vncunused.xml
tests/xml2sexprdata/xml2sexpr-fv-vncunused.xml
+36
-0
tests/xml2sexprtest.c
tests/xml2sexprtest.c
+11
-0
未找到文件。
ChangeLog
浏览文件 @
1ed4d292
Tue Sep 11 20:37:28 EDT 2006 Daniel Berrange <berrange@redhat.com>
* src/xml.c: Added support for setting VNC port when creating
domains with new (version 2) style XenD config
* tests/xml2sexprtest.c: Added test for setting VNC port
* tests/xml2sexprdata/*vncunused*: Data files for new VNC test
Tue Sep 11 20:23:42 EDT 2006 Daniel Berrange <berrange@redhat.com>
* docs/Makefile.am: Added test XML files to EXTRA_DIST
...
...
src/xml.c
浏览文件 @
1ed4d292
...
...
@@ -574,6 +574,7 @@ virDomainGetXMLDesc(virDomainPtr domain, int flags)
* virtDomainParseXMLGraphicsDesc:
* @node: node containing graphics description
* @buf: a buffer for the result S-Expr
* @xendConfigVersion: xend configuration file format
*
* Parse the graphics part of the XML description and add it to the S-Expr
* in buf. This is a temporary interface as the S-Expr interface will be
...
...
@@ -582,7 +583,7 @@ virDomainGetXMLDesc(virDomainPtr domain, int flags)
*
* Returns 0 in case of success, -1 in case of error
*/
static
int
virDomainParseXMLGraphicsDesc
(
xmlNodePtr
node
,
virBufferPtr
buf
)
static
int
virDomainParseXMLGraphicsDesc
(
xmlNodePtr
node
,
virBufferPtr
buf
,
int
xendConfigVersion
)
{
xmlChar
*
graphics_type
=
NULL
;
...
...
@@ -596,8 +597,22 @@ static int virDomainParseXMLGraphicsDesc(xmlNodePtr node, virBufferPtr buf)
//virBufferAdd(buf, "(display localhost:10.0)", 24);
//virBufferAdd(buf, "(xauthority /root/.Xauthority)", 30);
}
else
if
(
xmlStrEqual
(
graphics_type
,
BAD_CAST
"vnc"
))
else
if
(
xmlStrEqual
(
graphics_type
,
BAD_CAST
"vnc"
))
{
xmlChar
*
vncport
=
NULL
;
long
port
;
virBufferAdd
(
buf
,
"(vnc 1)"
,
7
);
if
(
xendConfigVersion
>=
2
)
{
vncport
=
xmlGetProp
(
node
,
BAD_CAST
"port"
);
if
(
vncport
!=
NULL
)
{
port
=
strtol
((
const
char
*
)
vncport
,
NULL
,
10
);
if
(
port
==
-
1
)
virBufferAdd
(
buf
,
"(vncunused 1)"
,
13
);
else
if
(
port
>
5900
)
virBufferVSprintf
(
buf
,
"(vncdisplay %d)"
,
port
-
5900
);
}
}
}
xmlFree
(
graphics_type
);
}
return
0
;
...
...
@@ -771,7 +786,7 @@ virDomainParseXMLOSDescHVM(xmlNodePtr node, virBufferPtr buf, xmlXPathContextPtr
obj
=
xmlXPathEval
(
BAD_CAST
"/domain/devices/graphics[1]"
,
ctxt
);
if
((
obj
!=
NULL
)
&&
(
obj
->
type
==
XPATH_NODESET
)
&&
(
obj
->
nodesetval
!=
NULL
)
&&
(
obj
->
nodesetval
->
nodeNr
>
0
))
{
res
=
virDomainParseXMLGraphicsDesc
(
obj
->
nodesetval
->
nodeTab
[
0
],
buf
);
res
=
virDomainParseXMLGraphicsDesc
(
obj
->
nodesetval
->
nodeTab
[
0
],
buf
,
xendConfigVersion
);
if
(
res
!=
0
)
{
goto
error
;
}
...
...
@@ -792,6 +807,7 @@ error:
* @node: node containing PV OS description
* @buf: a buffer for the result S-Expr
* @ctxt: a path context representing the XML description
* @xendConfigVersion: xend configuration file format
*
* Parse the OS part of the XML description for a paravirtualized domain
* and add it to the S-Expr in buf. This is a temporary interface as the
...
...
@@ -801,7 +817,7 @@ error:
* Returns 0 in case of success, -1 in case of error.
*/
static
int
virDomainParseXMLOSDescPV
(
xmlNodePtr
node
,
virBufferPtr
buf
,
xmlXPathContextPtr
ctxt
)
virDomainParseXMLOSDescPV
(
xmlNodePtr
node
,
virBufferPtr
buf
,
xmlXPathContextPtr
ctxt
,
int
xendConfigVersion
)
{
xmlNodePtr
cur
,
txt
;
xmlXPathObjectPtr
obj
=
NULL
;
...
...
@@ -872,7 +888,7 @@ virDomainParseXMLOSDescPV(xmlNodePtr node, virBufferPtr buf, xmlXPathContextPtr
obj
=
xmlXPathEval
(
BAD_CAST
"/domain/devices/graphics[1]"
,
ctxt
);
if
((
obj
!=
NULL
)
&&
(
obj
->
type
==
XPATH_NODESET
)
&&
(
obj
->
nodesetval
!=
NULL
)
&&
(
obj
->
nodesetval
->
nodeNr
>
0
))
{
res
=
virDomainParseXMLGraphicsDesc
(
obj
->
nodesetval
->
nodeTab
[
0
],
buf
);
res
=
virDomainParseXMLGraphicsDesc
(
obj
->
nodesetval
->
nodeTab
[
0
],
buf
,
xendConfigVersion
);
if
(
res
!=
0
)
{
goto
error
;
}
...
...
@@ -1234,7 +1250,7 @@ virDomainParseXMLDesc(const char *xmldesc, char **name, int xendConfigVersion)
}
if
((
tmpobj
==
NULL
)
||
!
xmlStrEqual
(
tmpobj
->
stringval
,
BAD_CAST
"hvm"
))
{
res
=
virDomainParseXMLOSDescPV
(
obj
->
nodesetval
->
nodeTab
[
0
],
&
buf
,
ctxt
);
res
=
virDomainParseXMLOSDescPV
(
obj
->
nodesetval
->
nodeTab
[
0
],
&
buf
,
ctxt
,
xendConfigVersion
);
}
else
{
hvm
=
1
;
res
=
virDomainParseXMLOSDescHVM
(
obj
->
nodesetval
->
nodeTab
[
0
],
&
buf
,
ctxt
,
xendConfigVersion
);
...
...
@@ -1364,3 +1380,12 @@ unsigned char *virParseUUID(char **ptr, const char *uuid) {
error:
return
(
dst_uuid
);
}
/*
* Local variables:
* indent-tabs-mode: nil
* c-indent-level: 4
* c-basic-offset: 4
* tab-width: 4
* End:
*/
tests/xml2sexprdata/xml2sexpr-fv-v2.sexpr
浏览文件 @
1ed4d292
(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')(boot c)(acpi 1)(vnc 1)))(device (vbd (dev 'hdc:cdrom')(uname 'file:/root/boot.iso')(mode 'r')))(device (vbd (dev '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
(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')(boot c)(acpi 1)(vnc 1)(vncdisplay 17)))(device (vbd (dev 'hdc:cdrom')(uname 'file:/root/boot.iso')(mode 'r')))(device (vbd (dev '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-vncunused.sexpr
0 → 100644
浏览文件 @
1ed4d292
(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')(boot c)(acpi 1)(vnc 1)(vncunused 1)))(device (vbd (dev 'hdc:cdrom')(uname 'file:/root/boot.iso')(mode 'r')))(device (vbd (dev '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-vncunused.xml
0 → 100644
浏览文件 @
1ed4d292
<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>
<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=
'-1'
/>
</devices>
</domain>
tests/xml2sexprtest.c
浏览文件 @
1ed4d292
...
...
@@ -68,6 +68,13 @@ static int testCompareFVversion2(void *data ATTRIBUTE_UNUSED) {
2
);
}
static
int
testCompareFVversion2VNC
(
void
*
data
ATTRIBUTE_UNUSED
)
{
return
testCompareFiles
(
"xml2sexprdata/xml2sexpr-fv-vncunused.xml"
,
"xml2sexprdata/xml2sexpr-fv-vncunused.sexpr"
,
"fvtest"
,
2
);
}
int
main
(
int
argc
,
char
**
argv
)
{
...
...
@@ -96,5 +103,9 @@ main(int argc, char **argv)
1
,
testCompareFVversion2
,
NULL
)
!=
0
)
ret
=
-
1
;
if
(
virtTestRun
(
"XML-2-SEXPR FV config (format 2, VNC unused)"
,
1
,
testCompareFVversion2VNC
,
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.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录