Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
libvirt
提交
ea1c08e7
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,体验更适合开发者的 AI 搜索 >>
提交
ea1c08e7
编写于
3月 17, 2008
作者:
D
Daniel P. Berrange
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Use explicit logic rules for opening Xen sub-drivers
上级
a34bcb78
变更
5
显示空白变更内容
内联
并排
Showing
5 changed file
with
91 addition
and
38 deletion
+91
-38
ChangeLog
ChangeLog
+10
-0
configure.in
configure.in
+3
-0
src/remote_internal.c
src/remote_internal.c
+8
-0
src/xen_unified.c
src/xen_unified.c
+63
-30
src/xend_internal.c
src/xend_internal.c
+7
-8
未找到文件。
ChangeLog
浏览文件 @
ea1c08e7
Mon Mar 17 13:24:22 EDT 2008 Daniel P. Berrange <berrange@redhat.com>
* configure.in: Add WITH_PROXY to config.h file
* src/remote_internal.c: Handle local Xen URIs if Xen drivers
declines them
* src/xen_unfied.c: Use explicit logic for opening sub-drivers
rather than a hacked loop.
* src/xend_internal.c: Don't complain about failing to open
xend when non-root read-only.
Mon Mar 17 17:55:56 CET 2008 Jim Meyering <meyering@redhat.com>
Treat ENOTSUP like ENODATA, after failed fgetfilecon.
...
...
configure.in
浏览文件 @
ea1c08e7
...
...
@@ -869,6 +869,9 @@ fi
AC_MSG_RESULT([$with_xen_proxy])
AM_CONDITIONAL(WITH_PROXY,[test "$with_xen_proxy" = "yes"])
if test "$with_xen_proxy" = "yes"; then
AC_DEFINE(WITH_PROXY, 1, [Whether Xen proxy is enabled])
fi
dnl Enable building libvirtd?
AM_CONDITIONAL(WITH_LIBVIRTD,[test "x$with_libvirtd" = "xyes"])
...
...
src/remote_internal.c
浏览文件 @
ea1c08e7
...
...
@@ -835,6 +835,14 @@ remoteOpen (virConnectPtr conn,
}
}
#endif
#if WITH_XEN
if
(
uri
&&
uri
->
scheme
&&
STREQ
(
uri
->
scheme
,
"xen"
)
&&
(
!
uri
->
server
||
STREQ
(
uri
->
server
,
""
))
&&
(
!
uri
->
path
||
STREQ
(
uri
->
path
,
"/"
)))
{
rflags
|=
VIR_DRV_OPEN_REMOTE_UNIX
;
}
#endif
priv
->
magic
=
DEAD
;
priv
->
sock
=
-
1
;
...
...
src/xen_unified.c
浏览文件 @
ea1c08e7
...
...
@@ -42,6 +42,7 @@
#include "util.h"
#define DEBUG(fmt,...) VIR_DEBUG(__FILE__, fmt,__VA_ARGS__)
#define DEBUG0(msg) VIR_DEBUG(__FILE__, "%s", msg)
static
int
xenUnifiedNodeGetInfo
(
virConnectPtr
conn
,
virNodeInfoPtr
info
);
...
...
@@ -239,7 +240,7 @@ xenUnifiedProbe (void)
static
int
xenUnifiedOpen
(
virConnectPtr
conn
,
xmlURIPtr
uri
,
virConnectAuthPtr
auth
,
int
flags
)
{
int
i
,
j
;
int
i
;
xenUnifiedPrivatePtr
priv
;
/* Refuse any scheme which isn't "xen://" or "http://". */
...
...
@@ -276,41 +277,73 @@ xenUnifiedOpen (virConnectPtr conn, xmlURIPtr uri, virConnectAuthPtr auth, int f
priv
->
xshandle
=
NULL
;
priv
->
proxy
=
-
1
;
for
(
i
=
0
;
i
<
XEN_UNIFIED_NR_DRIVERS
;
++
i
)
{
priv
->
opened
[
i
]
=
0
;
/* Only use XM driver for Xen <= 3.0.3 (ie xendConfigVersion <= 2) */
if
(
drivers
[
i
]
==
&
xenXMDriver
&&
priv
->
xendConfigVersion
>
2
)
continue
;
/* Ignore proxy for root */
if
(
i
==
XEN_UNIFIED_PROXY_OFFSET
&&
getuid
()
==
0
)
continue
;
if
(
drivers
[
i
]
->
open
)
{
DEBUG
(
"trying Xen sub-driver %d"
,
i
);
if
(
drivers
[
i
]
->
open
(
conn
,
uri
,
auth
,
flags
)
==
VIR_DRV_OPEN_SUCCESS
)
priv
->
opened
[
i
]
=
1
;
DEBUG
(
"Xen sub-driver %d open %s
\n
"
,
i
,
priv
->
opened
[
i
]
?
"ok"
:
"failed"
);
/* Hypervisor is only run as root & required to succeed */
if
(
getuid
()
==
0
)
{
DEBUG0
(
"Trying hypervisor sub-driver"
);
if
(
drivers
[
XEN_UNIFIED_HYPERVISOR_OFFSET
]
->
open
(
conn
,
uri
,
auth
,
flags
)
==
VIR_DRV_OPEN_SUCCESS
)
{
DEBUG0
(
"Activated hypervisor sub-driver"
);
priv
->
opened
[
XEN_UNIFIED_HYPERVISOR_OFFSET
]
=
1
;
}
}
/* If as root, then all drivers must succeed.
If non-root, then only proxy must succeed */
if
(
!
priv
->
opened
[
i
]
&&
(
getuid
()
==
0
||
i
==
XEN_UNIFIED_PROXY_OFFSET
))
{
for
(
j
=
0
;
j
<
i
;
++
j
)
if
(
priv
->
opened
[
j
])
drivers
[
j
]
->
close
(
conn
);
free
(
priv
);
/* The assumption is that one of the underlying drivers
* has set virterror already.
/* XenD is required to suceed if root.
* If it fails as non-root, then the proxy driver may take over
*/
return
VIR_DRV_OPEN_ERROR
;
DEBUG0
(
"Trying XenD sub-driver"
);
if
(
drivers
[
XEN_UNIFIED_XEND_OFFSET
]
->
open
(
conn
,
uri
,
auth
,
flags
)
==
VIR_DRV_OPEN_SUCCESS
)
{
DEBUG0
(
"Activated XenD sub-driver"
);
priv
->
opened
[
XEN_UNIFIED_XEND_OFFSET
]
=
1
;
/* XenD is active, so try the xm & xs drivers too, both requird to
* succeed if root, optional otherwise */
if
(
priv
->
xendConfigVersion
<=
2
)
{
DEBUG0
(
"Trying XM sub-driver"
);
if
(
drivers
[
XEN_UNIFIED_XM_OFFSET
]
->
open
(
conn
,
uri
,
auth
,
flags
)
==
VIR_DRV_OPEN_SUCCESS
)
{
DEBUG0
(
"Activated XM sub-driver"
);
priv
->
opened
[
XEN_UNIFIED_XM_OFFSET
]
=
1
;
}
}
DEBUG0
(
"Trying XS sub-driver"
);
if
(
drivers
[
XEN_UNIFIED_XS_OFFSET
]
->
open
(
conn
,
uri
,
auth
,
flags
)
==
VIR_DRV_OPEN_SUCCESS
)
{
DEBUG0
(
"Activated XS sub-driver"
);
priv
->
opened
[
XEN_UNIFIED_XS_OFFSET
]
=
1
;
}
else
{
if
(
getuid
()
==
0
)
goto
fail
;
/* XS is mandatory as root */
}
}
else
{
if
(
getuid
()
==
0
)
{
goto
fail
;
/* XenD is mandatory as root */
}
else
{
#if WITH_PROXY
DEBUG0
(
"Trying proxy sub-driver"
);
if
(
drivers
[
XEN_UNIFIED_PROXY_OFFSET
]
->
open
(
conn
,
uri
,
auth
,
flags
)
==
VIR_DRV_OPEN_SUCCESS
)
{
DEBUG0
(
"Activated proxy sub-driver"
);
priv
->
opened
[
XEN_UNIFIED_PROXY_OFFSET
]
=
1
;
}
else
{
goto
fail
;
/* Proxy is mandatory if XenD failed */
}
#else
DEBUG0
(
"Handing off for remote driver"
);
return
VIR_DRV_OPEN_DECLINED
;
/* Let remote_driver try instead */
#endif
}
}
return
VIR_DRV_OPEN_SUCCESS
;
fail:
DEBUG0
(
"Failed to activate a mandatory sub-driver"
);
for
(
i
=
0
;
i
<
XEN_UNIFIED_NR_DRIVERS
;
i
++
)
if
(
priv
->
opened
[
i
])
drivers
[
i
]
->
close
(
conn
);
free
(
priv
);
return
VIR_DRV_OPEN_ERROR
;
}
#define GET_PRIVATE(conn) \
...
...
src/xend_internal.c
浏览文件 @
ea1c08e7
...
...
@@ -234,12 +234,11 @@ do_connect(virConnectPtr xend)
close
(
s
);
errno
=
serrno
;
s
=
-
1
;
/*
* not being able to connect via the socket as a normal user
* is rather normal, this should fallback to the proxy (or
* remote) mechanism.
* Connecting to XenD as root is mandatory, so log this error
*/
if
((
getuid
()
==
0
)
||
(
xend
->
flags
&
VIR_CONNECT_RO
)
)
{
if
(
getuid
()
==
0
)
{
virXendError
(
xend
,
VIR_ERR_INTERNAL_ERROR
,
_
(
"failed to connect to xend"
));
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录