Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
libvirt
提交
f5456ffd
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看板
提交
f5456ffd
编写于
1月 12, 2011
作者:
J
Jiri Denemark
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
conf: Move boot parsing into a separate function
上级
7f193757
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
58 addition
and
41 deletion
+58
-41
src/conf/domain_conf.c
src/conf/domain_conf.c
+58
-41
未找到文件。
src/conf/domain_conf.c
浏览文件 @
f5456ffd
...
...
@@ -4671,6 +4671,61 @@ static char *virDomainDefDefaultEmulator(virDomainDefPtr def,
return
retemu
;
}
static
int
virDomainDefParseBootXML
(
xmlXPathContextPtr
ctxt
,
virDomainDefPtr
def
)
{
xmlNodePtr
*
nodes
=
NULL
;
int
i
,
n
;
char
*
bootstr
;
int
ret
=
-
1
;
/* analysis of the boot devices */
if
((
n
=
virXPathNodeSet
(
"./os/boot"
,
ctxt
,
&
nodes
))
<
0
)
{
virDomainReportError
(
VIR_ERR_INTERNAL_ERROR
,
"%s"
,
_
(
"cannot extract boot device"
));
goto
cleanup
;
}
for
(
i
=
0
;
i
<
n
&&
i
<
VIR_DOMAIN_BOOT_LAST
;
i
++
)
{
int
val
;
char
*
dev
=
virXMLPropString
(
nodes
[
i
],
"dev"
);
if
(
!
dev
)
{
virDomainReportError
(
VIR_ERR_INTERNAL_ERROR
,
"%s"
,
_
(
"missing boot device"
));
goto
cleanup
;
}
if
((
val
=
virDomainBootTypeFromString
(
dev
))
<
0
)
{
virDomainReportError
(
VIR_ERR_INTERNAL_ERROR
,
_
(
"unknown boot device '%s'"
),
dev
);
VIR_FREE
(
dev
);
goto
cleanup
;
}
VIR_FREE
(
dev
);
def
->
os
.
bootDevs
[
def
->
os
.
nBootDevs
++
]
=
val
;
}
if
(
def
->
os
.
nBootDevs
==
0
)
{
def
->
os
.
nBootDevs
=
1
;
def
->
os
.
bootDevs
[
0
]
=
VIR_DOMAIN_BOOT_DISK
;
}
bootstr
=
virXPathString
(
"string(./os/bootmenu[1]/@enable)"
,
ctxt
);
if
(
bootstr
)
{
if
(
STREQ
(
bootstr
,
"yes"
))
def
->
os
.
bootmenu
=
VIR_DOMAIN_BOOT_MENU_ENABLED
;
else
def
->
os
.
bootmenu
=
VIR_DOMAIN_BOOT_MENU_DISABLED
;
VIR_FREE
(
bootstr
);
}
ret
=
0
;
cleanup:
VIR_FREE
(
nodes
);
return
ret
;
}
static
virDomainDefPtr
virDomainDefParseXML
(
virCapsPtr
caps
,
xmlDocPtr
xml
,
xmlNodePtr
root
,
...
...
@@ -5000,47 +5055,9 @@ static virDomainDefPtr virDomainDefParseXML(virCapsPtr caps,
def
->
os
.
loader
=
virXPathString
(
"string(./os/loader[1])"
,
ctxt
);
}
if
(
STREQ
(
def
->
os
.
type
,
"hvm"
))
{
char
*
bootstr
;
/* analysis of the boot devices */
if
((
n
=
virXPathNodeSet
(
"./os/boot"
,
ctxt
,
&
nodes
))
<
0
)
{
virDomainReportError
(
VIR_ERR_INTERNAL_ERROR
,
"%s"
,
_
(
"cannot extract boot device"
));
goto
error
;
}
for
(
i
=
0
;
i
<
n
&&
i
<
VIR_DOMAIN_BOOT_LAST
;
i
++
)
{
int
val
;
char
*
dev
=
virXMLPropString
(
nodes
[
i
],
"dev"
);
if
(
!
dev
)
{
virDomainReportError
(
VIR_ERR_INTERNAL_ERROR
,
"%s"
,
_
(
"missing boot device"
));
goto
error
;
}
if
((
val
=
virDomainBootTypeFromString
(
dev
))
<
0
)
{
virDomainReportError
(
VIR_ERR_INTERNAL_ERROR
,
_
(
"unknown boot device '%s'"
),
dev
);
VIR_FREE
(
dev
);
goto
error
;
}
VIR_FREE
(
dev
);
def
->
os
.
bootDevs
[
def
->
os
.
nBootDevs
++
]
=
val
;
}
if
(
def
->
os
.
nBootDevs
==
0
)
{
def
->
os
.
nBootDevs
=
1
;
def
->
os
.
bootDevs
[
0
]
=
VIR_DOMAIN_BOOT_DISK
;
}
VIR_FREE
(
nodes
);
bootstr
=
virXPathString
(
"string(./os/bootmenu[1]/@enable)"
,
ctxt
);
if
(
bootstr
)
{
if
(
STREQ
(
bootstr
,
"yes"
))
def
->
os
.
bootmenu
=
VIR_DOMAIN_BOOT_MENU_ENABLED
;
else
def
->
os
.
bootmenu
=
VIR_DOMAIN_BOOT_MENU_DISABLED
;
VIR_FREE
(
bootstr
);
}
if
(
STREQ
(
def
->
os
.
type
,
"hvm"
)
&&
virDomainDefParseBootXML
(
ctxt
,
def
)
<
0
)
{
goto
error
;
}
def
->
emulator
=
virXPathString
(
"string(./devices/emulator[1])"
,
ctxt
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录