Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
libvirt
提交
f84c1660
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,发现更多精彩内容 >>
提交
f84c1660
编写于
2月 09, 2009
作者:
J
John Levon
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Improve error reporting in virsh
上级
fa7f51b8
变更
2
显示空白变更内容
内联
并排
Showing
2 changed file
with
48 addition
and
16 deletion
+48
-16
ChangeLog
ChangeLog
+5
-0
src/virsh.c
src/virsh.c
+43
-16
未找到文件。
ChangeLog
浏览文件 @
f84c1660
Mon Feb 9 14:19:02 GMT 2009 John Levon <john.levon@sun.com>
* src/virsh.c: rather than verbosely printing every error, save
the last error and report that only if the entire command fails.
Mon Feb 9 14:07:51 GMT 2009 John Levon <john.levon@sun.com>
* include/libvirt/virterror.h:
...
...
src/virsh.c
浏览文件 @
f84c1660
...
...
@@ -92,22 +92,6 @@ typedef enum {
VSH_ERR_ERROR
}
vshErrorLevel
;
/*
* The error handler for virsh
*/
static
void
virshErrorHandler
(
void
*
unused
,
virErrorPtr
error
)
{
if
((
unused
!=
NULL
)
||
(
error
==
NULL
))
return
;
/* Suppress the VIR_ERR_NO_XEN error which fails as non-root */
if
((
error
->
code
==
VIR_ERR_NO_XEN
)
||
(
error
->
code
==
VIR_ERR_OK
))
return
;
virDefaultErrorFunc
(
error
);
}
/*
* virsh command line grammar:
*
...
...
@@ -321,6 +305,46 @@ static int namesorter(const void *a, const void *b) {
return
strcasecmp
(
*
sa
,
*
sb
);
}
static
virErrorPtr
last_error
;
/*
* Quieten libvirt until we're done with the command.
*/
static
void
virshErrorHandler
(
void
*
unused
ATTRIBUTE_UNUSED
,
virErrorPtr
error
)
{
virFreeError
(
last_error
);
last_error
=
virSaveLastError
();
if
(
getenv
(
"VIRSH_DEBUG"
)
!=
NULL
)
virDefaultErrorFunc
(
error
);
}
/*
* Report an error when a command finishes. This is better than before
* (when correct operation would report errors), but it has some
* problems: we lose the smarter formatting of virDefaultErrorFunc(),
* and it can become harder to debug problems, if errors get reported
* twice during one command. This case shouldn't really happen anyway,
* and it's IMHO a bug that libvirt does that sometimes.
*/
static
void
virshReportError
(
vshControl
*
ctl
)
{
if
(
last_error
==
NULL
)
return
;
if
(
last_error
->
code
==
VIR_ERR_OK
)
{
vshError
(
ctl
,
FALSE
,
"%s"
,
_
(
"unknown error"
));
goto
out
;
}
vshError
(
ctl
,
FALSE
,
"%s"
,
last_error
->
message
);
out:
virFreeError
(
last_error
);
last_error
=
NULL
;
}
/* ---------------
* Commands
...
...
@@ -6103,6 +6127,9 @@ vshCommandRun(vshControl *ctl, const vshCmd *cmd)
if
(
ctl
->
timing
)
GETTIMEOFDAY
(
&
after
);
if
(
ret
==
FALSE
)
virshReportError
(
ctl
);
if
(
STREQ
(
cmd
->
def
->
name
,
"quit"
))
/* hack ... */
return
ret
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录