Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
libvirt
提交
9bfa132c
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,发现更多精彩内容 >>
提交
9bfa132c
编写于
12月 05, 2011
作者:
J
Jiri Denemark
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
examples: Update event tests for shutdown event
上级
b265beda
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
20 addition
and
8 deletion
+20
-8
examples/domain-events/events-c/event-test.c
examples/domain-events/events-c/event-test.c
+16
-6
examples/domain-events/events-python/event-test.py
examples/domain-events/events-python/event-test.py
+4
-2
未找到文件。
examples/domain-events/events-c/event-test.c
浏览文件 @
9bfa132c
...
@@ -40,7 +40,7 @@ void usage(const char *pname);
...
@@ -40,7 +40,7 @@ void usage(const char *pname);
const
char
*
eventToString
(
int
event
)
{
const
char
*
eventToString
(
int
event
)
{
const
char
*
ret
=
""
;
const
char
*
ret
=
""
;
switch
(
event
)
{
switch
((
virDomainEventType
)
event
)
{
case
VIR_DOMAIN_EVENT_DEFINED
:
case
VIR_DOMAIN_EVENT_DEFINED
:
ret
=
"Defined"
;
ret
=
"Defined"
;
break
;
break
;
...
@@ -59,13 +59,16 @@ const char *eventToString(int event) {
...
@@ -59,13 +59,16 @@ const char *eventToString(int event) {
case
VIR_DOMAIN_EVENT_STOPPED
:
case
VIR_DOMAIN_EVENT_STOPPED
:
ret
=
"Stopped"
;
ret
=
"Stopped"
;
break
;
break
;
case
VIR_DOMAIN_EVENT_SHUTDOWN
:
ret
=
"Shutdown"
;
break
;
}
}
return
ret
;
return
ret
;
}
}
static
const
char
*
eventDetailToString
(
int
event
,
int
detail
)
{
static
const
char
*
eventDetailToString
(
int
event
,
int
detail
)
{
const
char
*
ret
=
""
;
const
char
*
ret
=
""
;
switch
(
event
)
{
switch
((
virDomainEventType
)
event
)
{
case
VIR_DOMAIN_EVENT_DEFINED
:
case
VIR_DOMAIN_EVENT_DEFINED
:
if
(
detail
==
VIR_DOMAIN_EVENT_DEFINED_ADDED
)
if
(
detail
==
VIR_DOMAIN_EVENT_DEFINED_ADDED
)
ret
=
"Added"
;
ret
=
"Added"
;
...
@@ -77,7 +80,7 @@ static const char *eventDetailToString(int event, int detail) {
...
@@ -77,7 +80,7 @@ static const char *eventDetailToString(int event, int detail) {
ret
=
"Removed"
;
ret
=
"Removed"
;
break
;
break
;
case
VIR_DOMAIN_EVENT_STARTED
:
case
VIR_DOMAIN_EVENT_STARTED
:
switch
(
detail
)
{
switch
(
(
virDomainEventStartedDetailType
)
detail
)
{
case
VIR_DOMAIN_EVENT_STARTED_BOOTED
:
case
VIR_DOMAIN_EVENT_STARTED_BOOTED
:
ret
=
"Booted"
;
ret
=
"Booted"
;
break
;
break
;
...
@@ -93,7 +96,7 @@ static const char *eventDetailToString(int event, int detail) {
...
@@ -93,7 +96,7 @@ static const char *eventDetailToString(int event, int detail) {
}
}
break
;
break
;
case
VIR_DOMAIN_EVENT_SUSPENDED
:
case
VIR_DOMAIN_EVENT_SUSPENDED
:
switch
(
detail
)
{
switch
(
(
virDomainEventSuspendedDetailType
)
detail
)
{
case
VIR_DOMAIN_EVENT_SUSPENDED_PAUSED
:
case
VIR_DOMAIN_EVENT_SUSPENDED_PAUSED
:
ret
=
"Paused"
;
ret
=
"Paused"
;
break
;
break
;
...
@@ -115,7 +118,7 @@ static const char *eventDetailToString(int event, int detail) {
...
@@ -115,7 +118,7 @@ static const char *eventDetailToString(int event, int detail) {
}
}
break
;
break
;
case
VIR_DOMAIN_EVENT_RESUMED
:
case
VIR_DOMAIN_EVENT_RESUMED
:
switch
(
detail
)
{
switch
(
(
virDomainEventResumedDetailType
)
detail
)
{
case
VIR_DOMAIN_EVENT_RESUMED_UNPAUSED
:
case
VIR_DOMAIN_EVENT_RESUMED_UNPAUSED
:
ret
=
"Unpaused"
;
ret
=
"Unpaused"
;
break
;
break
;
...
@@ -128,7 +131,7 @@ static const char *eventDetailToString(int event, int detail) {
...
@@ -128,7 +131,7 @@ static const char *eventDetailToString(int event, int detail) {
}
}
break
;
break
;
case
VIR_DOMAIN_EVENT_STOPPED
:
case
VIR_DOMAIN_EVENT_STOPPED
:
switch
(
detail
)
{
switch
(
(
virDomainEventStoppedDetailType
)
detail
)
{
case
VIR_DOMAIN_EVENT_STOPPED_SHUTDOWN
:
case
VIR_DOMAIN_EVENT_STOPPED_SHUTDOWN
:
ret
=
"Shutdown"
;
ret
=
"Shutdown"
;
break
;
break
;
...
@@ -152,6 +155,13 @@ static const char *eventDetailToString(int event, int detail) {
...
@@ -152,6 +155,13 @@ static const char *eventDetailToString(int event, int detail) {
break
;
break
;
}
}
break
;
break
;
case
VIR_DOMAIN_EVENT_SHUTDOWN
:
switch
((
virDomainEventShutdownDetailType
)
detail
)
{
case
VIR_DOMAIN_EVENT_SHUTDOWN_FINISHED
:
ret
=
"Finished"
;
break
;
}
break
;
}
}
return
ret
;
return
ret
;
}
}
...
...
examples/domain-events/events-python/event-test.py
浏览文件 @
9bfa132c
...
@@ -430,7 +430,8 @@ def eventToString(event):
...
@@ -430,7 +430,8 @@ def eventToString(event):
"Started"
,
"Started"
,
"Suspended"
,
"Suspended"
,
"Resumed"
,
"Resumed"
,
"Stopped"
);
"Stopped"
,
"Shutdown"
);
return
eventStrings
[
event
];
return
eventStrings
[
event
];
def
detailToString
(
event
,
detail
):
def
detailToString
(
event
,
detail
):
...
@@ -440,7 +441,8 @@ def detailToString(event, detail):
...
@@ -440,7 +441,8 @@ def detailToString(event, detail):
(
"Booted"
,
"Migrated"
,
"Restored"
,
"Snapshot"
),
(
"Booted"
,
"Migrated"
,
"Restored"
,
"Snapshot"
),
(
"Paused"
,
"Migrated"
,
"IOError"
,
"Watchdog"
),
(
"Paused"
,
"Migrated"
,
"IOError"
,
"Watchdog"
),
(
"Unpaused"
,
"Migrated"
),
(
"Unpaused"
,
"Migrated"
),
(
"Shutdown"
,
"Destroyed"
,
"Crashed"
,
"Migrated"
,
"Saved"
,
"Failed"
,
"Snapshot"
)
(
"Shutdown"
,
"Destroyed"
,
"Crashed"
,
"Migrated"
,
"Saved"
,
"Failed"
,
"Snapshot"
),
(
"Finished"
)
)
)
return
eventStrings
[
event
][
detail
]
return
eventStrings
[
event
][
detail
]
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录