Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
libvirt
提交
68d6f66e
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看板
提交
68d6f66e
编写于
7月 26, 2013
作者:
J
Jiri Denemark
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
qemuhotplugtest: Add support for DEVICE_DELETED event
上级
419489e6
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
24 addition
and
6 deletion
+24
-6
tests/qemuhotplugtest.c
tests/qemuhotplugtest.c
+22
-6
tests/qemumonitortestutils.c
tests/qemumonitortestutils.c
+2
-0
未找到文件。
tests/qemuhotplugtest.c
浏览文件 @
68d6f66e
...
@@ -21,6 +21,7 @@
...
@@ -21,6 +21,7 @@
#include "qemu/qemu_conf.h"
#include "qemu/qemu_conf.h"
#include "qemu/qemu_hotplug.h"
#include "qemu/qemu_hotplug.h"
#include "qemu/qemu_hotplugpriv.h"
#include "qemumonitortestutils.h"
#include "qemumonitortestutils.h"
#include "testutils.h"
#include "testutils.h"
#include "testutilsqemu.h"
#include "testutilsqemu.h"
...
@@ -47,12 +48,14 @@ struct qemuHotplugTestData {
...
@@ -47,12 +48,14 @@ struct qemuHotplugTestData {
int
action
;
int
action
;
bool
keep
;
bool
keep
;
virDomainObjPtr
vm
;
virDomainObjPtr
vm
;
bool
deviceDeletedEvent
;
};
};
static
int
static
int
qemuHotplugCreateObjects
(
virDomainXMLOptionPtr
xmlopt
,
qemuHotplugCreateObjects
(
virDomainXMLOptionPtr
xmlopt
,
virDomainObjPtr
*
vm
,
virDomainObjPtr
*
vm
,
const
char
*
domxml
)
const
char
*
domxml
,
bool
event
)
{
{
int
ret
=
-
1
;
int
ret
=
-
1
;
qemuDomainObjPrivatePtr
priv
=
NULL
;
qemuDomainObjPrivatePtr
priv
=
NULL
;
...
@@ -76,6 +79,8 @@ qemuHotplugCreateObjects(virDomainXMLOptionPtr xmlopt,
...
@@ -76,6 +79,8 @@ qemuHotplugCreateObjects(virDomainXMLOptionPtr xmlopt,
virQEMUCapsSet
(
priv
->
qemuCaps
,
QEMU_CAPS_DRIVE
);
virQEMUCapsSet
(
priv
->
qemuCaps
,
QEMU_CAPS_DRIVE
);
virQEMUCapsSet
(
priv
->
qemuCaps
,
QEMU_CAPS_DEVICE
);
virQEMUCapsSet
(
priv
->
qemuCaps
,
QEMU_CAPS_DEVICE
);
virQEMUCapsSet
(
priv
->
qemuCaps
,
QEMU_CAPS_NET_NAME
);
virQEMUCapsSet
(
priv
->
qemuCaps
,
QEMU_CAPS_NET_NAME
);
if
(
event
)
virQEMUCapsSet
(
priv
->
qemuCaps
,
QEMU_CAPS_DEVICE_DEL_EVENT
);
if
(
qemuDomainAssignPCIAddresses
((
*
vm
)
->
def
,
priv
->
qemuCaps
,
*
vm
)
<
0
)
if
(
qemuDomainAssignPCIAddresses
((
*
vm
)
->
def
,
priv
->
qemuCaps
,
*
vm
)
<
0
)
goto
cleanup
;
goto
cleanup
;
...
@@ -232,7 +237,8 @@ testQemuHotplug(const void *data)
...
@@ -232,7 +237,8 @@ testQemuHotplug(const void *data)
if
(
test
->
vm
)
{
if
(
test
->
vm
)
{
vm
=
test
->
vm
;
vm
=
test
->
vm
;
}
else
{
}
else
{
if
(
qemuHotplugCreateObjects
(
driver
.
xmlopt
,
&
vm
,
domain_xml
)
<
0
)
if
(
qemuHotplugCreateObjects
(
driver
.
xmlopt
,
&
vm
,
domain_xml
,
test
->
deviceDeletedEvent
)
<
0
)
goto
cleanup
;
goto
cleanup
;
}
}
...
@@ -350,7 +356,10 @@ mymain(void)
...
@@ -350,7 +356,10 @@ mymain(void)
if
(
!
(
driver
.
securityManager
=
virSecurityManagerNewStack
(
mgr
)))
if
(
!
(
driver
.
securityManager
=
virSecurityManagerNewStack
(
mgr
)))
return
EXIT_FAILURE
;
return
EXIT_FAILURE
;
#define DO_TEST(file, ACTION, dev, fial, kep, ...) \
/* wait only 100ms for DEVICE_DELETED event */
qemuDomainRemoveDeviceWaitTime
=
100
;
#define DO_TEST(file, ACTION, dev, event, fial, kep, ...) \
do { \
do { \
const char *my_mon[] = { __VA_ARGS__, NULL}; \
const char *my_mon[] = { __VA_ARGS__, NULL}; \
const char *name = file " " #ACTION " " dev; \
const char *name = file " " #ACTION " " dev; \
...
@@ -360,18 +369,25 @@ mymain(void)
...
@@ -360,18 +369,25 @@ mymain(void)
data.fail = fial; \
data.fail = fial; \
data.mon = my_mon; \
data.mon = my_mon; \
data.keep = kep; \
data.keep = kep; \
data.deviceDeletedEvent = event; \
if (virtTestRun(name, 1, testQemuHotplug, &data) < 0) \
if (virtTestRun(name, 1, testQemuHotplug, &data) < 0) \
ret = -1; \
ret = -1; \
} while (0)
} while (0)
#define DO_TEST_ATTACH(file, dev, fial, kep, ...) \
#define DO_TEST_ATTACH(file, dev, fial, kep, ...) \
DO_TEST(file, ATTACH, dev, fial, kep, __VA_ARGS__)
DO_TEST(file, ATTACH, dev, f
alse, f
ial, kep, __VA_ARGS__)
#define DO_TEST_DETACH(file, dev, fial, kep, ...) \
#define DO_TEST_DETACH(file, dev, fial, kep, ...) \
DO_TEST(file, DETACH, dev, fial, kep, __VA_ARGS__)
DO_TEST(file, DETACH, dev, false, fial, kep, __VA_ARGS__)
#define DO_TEST_ATTACH_EVENT(file, dev, fial, kep, ...) \
DO_TEST(file, ATTACH, dev, true, fial, kep, __VA_ARGS__)
#define DO_TEST_DETACH_EVENT(file, dev, fial, kep, ...) \
DO_TEST(file, DETACH, dev, true, fial, kep, __VA_ARGS__)
#define DO_TEST_UPDATE(file, dev, fial, kep, ...) \
#define DO_TEST_UPDATE(file, dev, fial, kep, ...) \
DO_TEST(file, UPDATE, dev, fial, kep, __VA_ARGS__)
DO_TEST(file, UPDATE, dev, f
alse, f
ial, kep, __VA_ARGS__)
#define QMP_OK "{\"return\": {}}"
#define QMP_OK "{\"return\": {}}"
...
...
tests/qemumonitortestutils.c
浏览文件 @
68d6f66e
...
@@ -27,6 +27,7 @@
...
@@ -27,6 +27,7 @@
#include "qemumonitortestutils.h"
#include "qemumonitortestutils.h"
#include "virthread.h"
#include "virthread.h"
#include "qemu/qemu_processpriv.h"
#include "qemu/qemu_monitor.h"
#include "qemu/qemu_monitor.h"
#include "qemu/qemu_agent.h"
#include "qemu/qemu_agent.h"
#include "rpc/virnetsocket.h"
#include "rpc/virnetsocket.h"
...
@@ -725,6 +726,7 @@ qemuMonitorTestErrorNotify(qemuMonitorPtr mon ATTRIBUTE_UNUSED,
...
@@ -725,6 +726,7 @@ qemuMonitorTestErrorNotify(qemuMonitorPtr mon ATTRIBUTE_UNUSED,
static
qemuMonitorCallbacks
qemuMonitorTestCallbacks
=
{
static
qemuMonitorCallbacks
qemuMonitorTestCallbacks
=
{
.
eofNotify
=
qemuMonitorTestEOFNotify
,
.
eofNotify
=
qemuMonitorTestEOFNotify
,
.
errorNotify
=
qemuMonitorTestErrorNotify
,
.
errorNotify
=
qemuMonitorTestErrorNotify
,
.
domainDeviceDeleted
=
qemuProcessHandleDeviceDeleted
,
};
};
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录