Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
libvirt
提交
20745748
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看板
提交
20745748
编写于
7月 18, 2013
作者:
J
Jiri Denemark
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
qemuhotplugtest: Add tests for virtio disk hotplug
上级
2618dc2a
变更
5
显示空白变更内容
内联
并排
Showing
5 changed file
with
98 addition
and
8 deletion
+98
-8
tests/qemuhotplugtest.c
tests/qemuhotplugtest.c
+43
-6
tests/qemuhotplugtestdata/qemuhotplug-console-compat-2+console-virtio.xml
...gtestdata/qemuhotplug-console-compat-2+console-virtio.xml
+1
-1
tests/qemuhotplugtestdata/qemuhotplug-disk-virtio.xml
tests/qemuhotplugtestdata/qemuhotplug-disk-virtio.xml
+7
-0
tests/qemuhotplugtestdata/qemuhotplug-hotplug-base+disk-virtio.xml
...uhotplugtestdata/qemuhotplug-hotplug-base+disk-virtio.xml
+46
-0
tests/qemuxml2argvdata/qemuxml2argv-console-compat-2.xml
tests/qemuxml2argvdata/qemuxml2argv-console-compat-2.xml
+1
-1
未找到文件。
tests/qemuhotplugtest.c
浏览文件 @
20745748
...
...
@@ -73,7 +73,15 @@ qemuHotplugCreateObjects(virDomainXMLOptionPtr xmlopt,
goto
cleanup
;
/* for attach & detach qemu must support -device */
virQEMUCapsSet
(
priv
->
qemuCaps
,
QEMU_CAPS_DRIVE
);
virQEMUCapsSet
(
priv
->
qemuCaps
,
QEMU_CAPS_DEVICE
);
virQEMUCapsSet
(
priv
->
qemuCaps
,
QEMU_CAPS_NET_NAME
);
if
(
qemuDomainAssignPCIAddresses
((
*
vm
)
->
def
,
priv
->
qemuCaps
,
*
vm
)
<
0
)
goto
cleanup
;
if
(
qemuAssignDeviceAliases
((
*
vm
)
->
def
,
priv
->
qemuCaps
)
<
0
)
goto
cleanup
;
ret
=
0
;
cleanup:
...
...
@@ -87,12 +95,14 @@ testQemuHotplugAttach(virDomainObjPtr vm,
int
ret
=
-
1
;
switch
(
dev
->
type
)
{
case
VIR_DOMAIN_DEVICE_DISK
:
/* conn in only used for storage pool and secrets lookup so as long
* as we don't use any of them, passing NULL should be safe
*/
ret
=
qemuDomainAttachDeviceDiskLive
(
NULL
,
&
driver
,
vm
,
dev
);
break
;
case
VIR_DOMAIN_DEVICE_CHR
:
ret
=
qemuDomainAttachChrDevice
(
&
driver
,
vm
,
dev
->
data
.
chr
);
if
(
!
ret
)
{
/* vm->def stolen dev->data.chr so we ought to avoid freeing it */
dev
->
data
.
chr
=
NULL
;
}
break
;
default:
if
(
virTestGetVerbose
())
...
...
@@ -111,6 +121,9 @@ testQemuHotplugDetach(virDomainObjPtr vm,
int
ret
=
-
1
;
switch
(
dev
->
type
)
{
case
VIR_DOMAIN_DEVICE_DISK
:
ret
=
qemuDomainDetachDeviceDiskLive
(
&
driver
,
vm
,
dev
);
break
;
case
VIR_DOMAIN_DEVICE_CHR
:
ret
=
qemuDomainDetachChrDevice
(
&
driver
,
vm
,
dev
->
data
.
chr
);
break
;
...
...
@@ -256,6 +269,11 @@ testQemuHotplug(const void *data)
switch
(
test
->
action
)
{
case
ATTACH
:
ret
=
testQemuHotplugAttach
(
vm
,
dev
);
if
(
ret
==
0
)
{
/* vm->def stolen dev->data.* so we just need to free the dev
* envelope */
VIR_FREE
(
dev
);
}
if
(
ret
==
0
||
fail
)
ret
=
testQemuHotplugCheckResult
(
vm
,
result_xml
,
fail
);
break
;
...
...
@@ -297,6 +315,7 @@ mymain(void)
{
int
ret
=
0
;
struct
qemuHotplugTestData
data
=
{
0
};
virSecurityManagerPtr
mgr
;
#if !WITH_YAJL
fputs
(
"libvirt not compiled with yajl, skipping this test
\n
"
,
stderr
);
...
...
@@ -313,12 +332,22 @@ mymain(void)
driver
.
config
=
virQEMUDriverConfigNew
(
false
);
VIR_FREE
(
driver
.
config
->
spiceListen
);
VIR_FREE
(
driver
.
config
->
vncListen
);
/* some dummy values from 'config file' */
if
(
VIR_STRDUP_QUIET
(
driver
.
config
->
spicePassword
,
"123456"
)
<
0
)
return
EXIT_FAILURE
;
if
(
!
(
driver
.
domainEventState
=
virDomainEventStateNew
()))
return
EXIT_FAILURE
;
/* some dummy values from 'config file' */
if
(
VIR_STRDUP_QUIET
(
driver
.
config
->
spicePassword
,
"123456"
)
<
0
)
driver
.
lockManager
=
virLockManagerPluginNew
(
"nop"
,
"qemu"
,
driver
.
config
->
configBaseDir
,
0
);
if
(
!
driver
.
lockManager
)
return
EXIT_FAILURE
;
if
(
!
(
mgr
=
virSecurityManagerNew
(
"none"
,
"qemu"
,
false
,
false
,
false
)))
return
EXIT_FAILURE
;
if
(
!
(
driver
.
securityManager
=
virSecurityManagerNewStack
(
mgr
)))
return
EXIT_FAILURE
;
#define DO_TEST(file, ACTION, dev, fial, kep, ...) \
...
...
@@ -346,6 +375,7 @@ mymain(void)
#define QMP_OK "{\"return\": {}}"
#define HMP(msg) "{\"return\": \"" msg "\"}"
DO_TEST_UPDATE
(
"graphics-spice"
,
"graphics-spice-nochange"
,
false
,
false
,
NULL
);
DO_TEST_UPDATE
(
"graphics-spice-timeout"
,
"graphics-spice-timeout-nochange"
,
false
,
false
,
...
...
@@ -366,6 +396,13 @@ mymain(void)
"device_del"
,
QMP_OK
,
"chardev-remove"
,
QMP_OK
);
DO_TEST_ATTACH
(
"hotplug-base"
,
"disk-virtio"
,
false
,
true
,
"human-monitor-command"
,
HMP
(
"OK
\\
r
\\
n"
),
"device_add"
,
QMP_OK
);
DO_TEST_DETACH
(
"hotplug-base"
,
"disk-virtio"
,
false
,
false
,
"device_del"
,
QMP_OK
,
"human-monitor-command"
,
HMP
(
""
));
virObjectUnref
(
driver
.
caps
);
virObjectUnref
(
driver
.
xmlopt
);
virObjectUnref
(
driver
.
config
);
...
...
tests/qemuhotplugtestdata/qemuhotplug-console-compat-2+console-virtio.xml
浏览文件 @
20745748
...
...
@@ -50,7 +50,7 @@
<address
type=
'pci'
domain=
'0x0000'
bus=
'0x00'
slot=
'0x01'
function=
'0x2'
/>
</controller>
<controller
type=
'pci'
index=
'0'
model=
'pci-root'
>
<alias
name=
'pci0'
/>
<alias
name=
'pci
.
0'
/>
</controller>
<controller
type=
'virtio-serial'
index=
'0'
>
<alias
name=
'virtio-serial0'
/>
...
...
tests/qemuhotplugtestdata/qemuhotplug-disk-virtio.xml
0 → 100644
浏览文件 @
20745748
<disk
type=
'file'
device=
'disk'
>
<driver
name=
'qemu'
type=
'raw'
cache=
'none'
/>
<source
file=
'/dev/null'
/>
<target
dev=
'vde'
bus=
'virtio'
/>
<readonly/>
<shareable/>
</disk>
tests/qemuhotplugtestdata/qemuhotplug-hotplug-base+disk-virtio.xml
0 → 100644
浏览文件 @
20745748
<domain
type=
'kvm'
>
<name>
hotplug
</name>
<uuid>
d091ea82-29e6-2e34-3005-f02617b36e87
</uuid>
<memory
unit=
'KiB'
>
4194304
</memory>
<currentMemory
unit=
'KiB'
>
4194304
</currentMemory>
<vcpu
placement=
'static'
>
4
</vcpu>
<os>
<type
arch=
'x86_64'
machine=
'pc'
>
hvm
</type>
<boot
dev=
'hd'
/>
</os>
<features>
<acpi/>
<apic/>
<pae/>
</features>
<clock
offset=
'utc'
/>
<on_poweroff>
destroy
</on_poweroff>
<on_reboot>
restart
</on_reboot>
<on_crash>
restart
</on_crash>
<devices>
<emulator>
/usr/libexec/qemu-kvm
</emulator>
<disk
type=
'file'
device=
'disk'
>
<driver
name=
'qemu'
type=
'raw'
cache=
'none'
/>
<source
file=
'/dev/null'
/>
<target
dev=
'vde'
bus=
'virtio'
/>
<readonly/>
<shareable/>
<address
type=
'pci'
domain=
'0x0000'
bus=
'0x00'
slot=
'0x05'
function=
'0x0'
/>
</disk>
<controller
type=
'usb'
index=
'0'
>
<address
type=
'pci'
domain=
'0x0000'
bus=
'0x00'
slot=
'0x01'
function=
'0x2'
/>
</controller>
<controller
type=
'ide'
index=
'0'
>
<address
type=
'pci'
domain=
'0x0000'
bus=
'0x00'
slot=
'0x01'
function=
'0x1'
/>
</controller>
<controller
type=
'scsi'
index=
'0'
model=
'virtio-scsi'
>
<address
type=
'pci'
domain=
'0x0000'
bus=
'0x00'
slot=
'0x03'
function=
'0x0'
/>
</controller>
<controller
type=
'pci'
index=
'0'
model=
'pci-root'
/>
<controller
type=
'virtio-serial'
index=
'0'
>
<address
type=
'pci'
domain=
'0x0000'
bus=
'0x00'
slot=
'0x04'
function=
'0x0'
/>
</controller>
<memballoon
model=
'none'
/>
</devices>
<seclabel
type=
'none'
/>
</domain>
tests/qemuxml2argvdata/qemuxml2argv-console-compat-2.xml
浏览文件 @
20745748
...
...
@@ -50,7 +50,7 @@
<address
type=
'pci'
domain=
'0x0000'
bus=
'0x00'
slot=
'0x01'
function=
'0x2'
/>
</controller>
<controller
type=
'pci'
index=
'0'
model=
'pci-root'
>
<alias
name=
'pci0'
/>
<alias
name=
'pci
.
0'
/>
</controller>
<controller
type=
'virtio-serial'
index=
'0'
>
<alias
name=
'virtio-serial0'
/>
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录