Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
libvirt
提交
ec3fa12e
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,发现更多精彩内容 >>
提交
ec3fa12e
编写于
11月 06, 2009
作者:
M
Matthias Bolte
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
phyp: Use actual error code instead of 0
上级
6f5e6332
变更
1
显示空白变更内容
内联
并排
Showing
1 changed file
with
28 addition
and
43 deletion
+28
-43
src/phyp/phyp_driver.c
src/phyp/phyp_driver.c
+28
-43
未找到文件。
src/phyp/phyp_driver.c
浏览文件 @
ec3fa12e
...
...
@@ -61,6 +61,10 @@
#define VIR_FROM_THIS VIR_FROM_PHYP
#define PHYP_ERROR(conn, code, fmt...) \
virReportErrorHelper(conn, VIR_FROM_PHYP, code, __FILE__, __FUNCTION__, \
__LINE__, fmt)
/*
* URI: phyp://user@[hmc|ivm]/managed_system
* */
...
...
@@ -86,26 +90,17 @@ phypOpen(virConnectPtr conn,
return
VIR_DRV_OPEN_DECLINED
;
if
(
conn
->
uri
->
server
==
NULL
)
{
virRaiseError
(
conn
,
NULL
,
NULL
,
0
,
VIR_FROM_PHYP
,
VIR_ERR_ERROR
,
NULL
,
NULL
,
NULL
,
0
,
0
,
"%s"
,
PHYP_ERROR
(
conn
,
VIR_ERR_INTERNAL_ERROR
,
_
(
"Missing server name in phyp:// URI"
));
return
VIR_DRV_OPEN_ERROR
;
}
if
(
conn
->
uri
->
path
==
NULL
)
{
virRaiseError
(
conn
,
NULL
,
NULL
,
0
,
VIR_FROM_PHYP
,
VIR_ERR_ERROR
,
NULL
,
NULL
,
NULL
,
0
,
0
,
"%s"
,
PHYP_ERROR
(
conn
,
VIR_ERR_INTERNAL_ERROR
,
_
(
"Missing managed system name in phyp:// URI"
));
return
VIR_DRV_OPEN_ERROR
;
}
if
(
conn
->
uri
->
path
==
NULL
)
{
virRaiseError
(
conn
,
NULL
,
NULL
,
0
,
VIR_FROM_PHYP
,
VIR_ERR_ERROR
,
NULL
,
NULL
,
NULL
,
0
,
0
,
"%s"
,
_
(
"Missing path name in phyp:// URI"
));
return
VIR_DRV_OPEN_ERROR
;
}
if
(
VIR_ALLOC
(
phyp_driver
)
<
0
)
{
virReportOOMError
(
conn
);
goto
failure
;
...
...
@@ -148,15 +143,13 @@ phypOpen(virConnectPtr conn,
*
char_ptr
=
'\0'
;
if
(
escape_specialcharacters
(
conn
->
uri
->
path
,
string
,
len
)
==
-
1
)
{
virRaiseError
(
conn
,
NULL
,
NULL
,
0
,
VIR_FROM_PHYP
,
VIR_ERR_ERROR
,
NULL
,
NULL
,
NULL
,
0
,
0
,
"%s"
,
PHYP_ERROR
(
conn
,
VIR_ERR_INTERNAL_ERROR
,
_
(
"Error parsing 'path'. Invalid characters."
));
goto
failure
;
}
if
((
session
=
openSSHSession
(
conn
,
auth
,
&
internal_socket
))
==
NULL
)
{
virRaiseError
(
conn
,
NULL
,
NULL
,
0
,
VIR_FROM_PHYP
,
VIR_ERR_ERROR
,
NULL
,
NULL
,
NULL
,
0
,
0
,
"%s"
,
PHYP_ERROR
(
conn
,
VIR_ERR_INTERNAL_ERROR
,
_
(
"Error while opening SSH session."
));
goto
failure
;
}
...
...
@@ -244,8 +237,7 @@ openSSHSession(virConnectPtr conn, virConnectAuthPtr auth,
ret
=
getaddrinfo
(
hostname
,
"22"
,
&
hints
,
&
ai
);
if
(
ret
!=
0
)
{
virRaiseError
(
conn
,
NULL
,
NULL
,
0
,
VIR_FROM_PHYP
,
VIR_ERR_ERROR
,
NULL
,
NULL
,
NULL
,
0
,
0
,
PHYP_ERROR
(
conn
,
VIR_ERR_INTERNAL_ERROR
,
_
(
"Error while getting %s address info"
),
hostname
);
goto
err
;
}
...
...
@@ -262,8 +254,7 @@ openSSHSession(virConnectPtr conn, virConnectAuthPtr auth,
cur
=
cur
->
ai_next
;
}
virRaiseError
(
conn
,
NULL
,
NULL
,
0
,
VIR_FROM_PHYP
,
VIR_ERR_ERROR
,
NULL
,
NULL
,
NULL
,
0
,
0
,
PHYP_ERROR
(
conn
,
VIR_ERR_INTERNAL_ERROR
,
_
(
"Failed to connect to %s"
),
hostname
);
freeaddrinfo
(
ai
);
goto
err
;
...
...
@@ -283,8 +274,7 @@ openSSHSession(virConnectPtr conn, virConnectAuthPtr auth,
while
((
rc
=
libssh2_session_startup
(
session
,
sock
))
==
LIBSSH2_ERROR_EAGAIN
)
;
if
(
rc
)
{
virRaiseError
(
conn
,
NULL
,
NULL
,
0
,
VIR_FROM_PHYP
,
VIR_ERR_ERROR
,
NULL
,
NULL
,
NULL
,
0
,
0
,
"%s"
,
PHYP_ERROR
(
conn
,
VIR_ERR_INTERNAL_ERROR
,
_
(
"Failure establishing SSH session."
));
goto
disconnect
;
}
...
...
@@ -307,8 +297,7 @@ openSSHSession(virConnectPtr conn, virConnectAuthPtr auth,
};
if
(
!
auth
||
!
auth
->
cb
)
{
virRaiseError
(
conn
,
NULL
,
NULL
,
0
,
VIR_FROM_PHYP
,
VIR_ERR_ERROR
,
NULL
,
NULL
,
NULL
,
0
,
0
,
"%s"
,
PHYP_ERROR
(
conn
,
VIR_ERR_AUTH_FAILED
,
_
(
"No authentication callback provided."
));
goto
disconnect
;
}
...
...
@@ -319,8 +308,7 @@ openSSHSession(virConnectPtr conn, virConnectAuthPtr auth,
}
if
(
!
hasPassphrase
)
{
virRaiseError
(
conn
,
NULL
,
NULL
,
0
,
VIR_FROM_PHYP
,
VIR_ERR_ERROR
,
NULL
,
NULL
,
NULL
,
0
,
0
,
"%s"
,
PHYP_ERROR
(
conn
,
VIR_ERR_AUTH_FAILED
,
_
(
"Required credentials are not supported."
));
goto
disconnect
;
}
...
...
@@ -329,8 +317,7 @@ openSSHSession(virConnectPtr conn, virConnectAuthPtr auth,
(
auth
->
cb
)
(
creds
,
ARRAY_CARDINALITY
(
creds
),
auth
->
cbdata
);
if
(
res
<
0
)
{
virRaiseError
(
conn
,
NULL
,
NULL
,
0
,
VIR_FROM_PHYP
,
VIR_ERR_ERROR
,
NULL
,
NULL
,
NULL
,
0
,
0
,
"%s"
,
PHYP_ERROR
(
conn
,
VIR_ERR_AUTH_FAILED
,
_
(
"Unable to fetch credentials."
));
goto
disconnect
;
}
...
...
@@ -338,8 +325,7 @@ openSSHSession(virConnectPtr conn, virConnectAuthPtr auth,
if
(
creds
[
0
].
result
)
{
password
=
creds
[
0
].
result
;
}
else
{
virRaiseError
(
conn
,
NULL
,
NULL
,
0
,
VIR_FROM_PHYP
,
VIR_ERR_ERROR
,
NULL
,
NULL
,
NULL
,
0
,
0
,
"%s"
,
PHYP_ERROR
(
conn
,
VIR_ERR_AUTH_FAILED
,
_
(
"Unable to get password certificates"
));
goto
disconnect
;
}
...
...
@@ -350,8 +336,7 @@ openSSHSession(virConnectPtr conn, virConnectAuthPtr auth,
LIBSSH2_ERROR_EAGAIN
)
;
if
(
rc
)
{
virRaiseError
(
conn
,
NULL
,
NULL
,
0
,
VIR_FROM_PHYP
,
VIR_ERR_ERROR
,
NULL
,
NULL
,
NULL
,
0
,
0
,
"%s"
,
PHYP_ERROR
(
conn
,
VIR_ERR_AUTH_FAILED
,
_
(
"Authentication failed"
));
goto
disconnect
;
}
else
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录