Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
libvirt
提交
4ebe4c10
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,发现更多精彩内容 >>
提交
4ebe4c10
编写于
3月 04, 2009
作者:
D
Daniel P. Berrange
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fix misc failures in test suite & make test cases more robust to future changes
上级
b9739b47
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
68 addition
and
127 deletion
+68
-127
ChangeLog
ChangeLog
+20
-0
src/virsh.c
src/virsh.c
+31
-20
tests/Makefile.am
tests/Makefile.am
+1
-2
tests/daemon-conf
tests/daemon-conf
+4
-9
tests/libvirtd-fail
tests/libvirtd-fail
+3
-6
tests/libvirtd-net-persist
tests/libvirtd-net-persist
+0
-58
tests/libvirtd-pool
tests/libvirtd-pool
+9
-32
未找到文件。
ChangeLog
浏览文件 @
4ebe4c10
Wed Mar 4 12:37:13 GMT 2009 Daniel P. Berrange <berrange@redhat.com>
Fix misc failures in test suite & make test cases more robust
to future changes
* src/virsh.c: Add a new --print-xml option to pool-define-as
and pool-create-as, to allow printing of generated XML doc.
* tests/Makefile.am: Fix setting of CONFIG_HEADER variable
* tests/daemon-conf: Don't diff entire of libvirtd stdout,
just grep for the diagnostic we care about, to avoid breaking
everytime libvirtd prints new unrelated diagnostics
* tests/libvirtd-fail: Check status of libvirtd when run with
bogus config file to detect failure, rather than relying on
diff of unpredictable stdout logs
* tests/libvirtd-net-persist: Remove test which breaks if
QEMU driver can't be started, and conflicts with running
session daemon
* tests/libvirtd-pool: Use new --print-xml option to virsh
to directly test XML generation, rather than indirectly
checking via the QEMU driver
Tue Mar 3 19:31:13 GMT 2009 Daniel P. Berrange <berrange@redhat.com>
* src/libvirt.c: Fix return status s/-2/-1/ for virNodeGetSecurityModel
...
...
src/virsh.c
浏览文件 @
4ebe4c10
...
...
@@ -2923,6 +2923,7 @@ cmdPoolCreate(vshControl *ctl, const vshCmd *cmd)
*/
static
const
vshCmdOptDef
opts_pool_X_as
[]
=
{
{
"name"
,
VSH_OT_DATA
,
VSH_OFLAG_REQ
,
gettext_noop
(
"name of the pool"
)},
{
"print-xml"
,
VSH_OT_BOOL
,
0
,
gettext_noop
(
"print XML document, but don't define/create"
)},
{
"type"
,
VSH_OT_DATA
,
VSH_OFLAG_REQ
,
gettext_noop
(
"type of the pool"
)},
{
"source-host"
,
VSH_OT_DATA
,
0
,
gettext_noop
(
"source-host for underlying storage"
)},
{
"source-path"
,
VSH_OT_DATA
,
0
,
gettext_noop
(
"source path for underlying storage"
)},
...
...
@@ -3002,6 +3003,7 @@ cmdPoolCreateAs(vshControl *ctl, const vshCmd *cmd)
{
virStoragePoolPtr
pool
;
char
*
xml
,
*
name
;
int
printXML
=
vshCommandOptBool
(
cmd
,
"print-xml"
);
if
(
!
vshConnectionUsability
(
ctl
,
ctl
->
conn
,
TRUE
))
return
FALSE
;
...
...
@@ -3009,18 +3011,22 @@ cmdPoolCreateAs(vshControl *ctl, const vshCmd *cmd)
if
(
!
buildPoolXML
(
cmd
,
&
name
,
&
xml
))
return
FALSE
;
pool
=
virStoragePoolCreateXML
(
ctl
->
conn
,
xml
,
0
);
free
(
xml
);
if
(
pool
!=
NULL
)
{
vshPrint
(
ctl
,
_
(
"Pool %s created
\n
"
),
name
);
virStoragePoolFree
(
pool
);
return
TRUE
;
if
(
printXML
)
{
printf
(
"%s"
,
xml
);
free
(
xml
);
}
else
{
vshError
(
ctl
,
FALSE
,
_
(
"Failed to create pool %s"
),
name
);
}
pool
=
virStoragePoolCreateXML
(
ctl
->
conn
,
xml
,
0
);
free
(
xml
);
return
FALSE
;
if
(
pool
!=
NULL
)
{
vshPrint
(
ctl
,
_
(
"Pool %s created
\n
"
),
name
);
virStoragePoolFree
(
pool
);
}
else
{
vshError
(
ctl
,
FALSE
,
_
(
"Failed to create pool %s"
),
name
);
return
FALSE
;
}
}
return
TRUE
;
}
...
...
@@ -3085,6 +3091,7 @@ cmdPoolDefineAs(vshControl *ctl, const vshCmd *cmd)
{
virStoragePoolPtr
pool
;
char
*
xml
,
*
name
;
int
printXML
=
vshCommandOptBool
(
cmd
,
"print-xml"
);
if
(
!
vshConnectionUsability
(
ctl
,
ctl
->
conn
,
TRUE
))
return
FALSE
;
...
...
@@ -3092,18 +3099,22 @@ cmdPoolDefineAs(vshControl *ctl, const vshCmd *cmd)
if
(
!
buildPoolXML
(
cmd
,
&
name
,
&
xml
))
return
FALSE
;
pool
=
virStoragePoolDefineXML
(
ctl
->
conn
,
xml
,
0
);
free
(
xml
);
if
(
pool
!=
NULL
)
{
vshPrint
(
ctl
,
_
(
"Pool %s defined
\n
"
),
name
);
virStoragePoolFree
(
pool
);
return
TRUE
;
if
(
printXML
)
{
printf
(
"%s"
,
xml
);
free
(
xml
);
}
else
{
vshError
(
ctl
,
FALSE
,
_
(
"Failed to define pool %s"
),
name
);
}
pool
=
virStoragePoolDefineXML
(
ctl
->
conn
,
xml
,
0
);
free
(
xml
);
return
FALSE
;
if
(
pool
!=
NULL
)
{
vshPrint
(
ctl
,
_
(
"Pool %s defined
\n
"
),
name
);
virStoragePoolFree
(
pool
);
}
else
{
vshError
(
ctl
,
FALSE
,
_
(
"Failed to define pool %s"
),
name
);
return
FALSE
;
}
}
return
TRUE
;
}
...
...
tests/Makefile.am
浏览文件 @
4ebe4c10
...
...
@@ -82,7 +82,6 @@ test_scripts += \
define-dev-segfault
\
int-overflow
\
libvirtd-fail
\
libvirtd-net-persist
\
libvirtd-pool
\
read-bufsiz
\
read-non-seekable
\
...
...
@@ -127,7 +126,7 @@ TESTS_ENVIRONMENT = \
abs_top_srcdir
=
`
cd
'
$(top_srcdir)
'
;
pwd
`
\
abs_builddir
=
`
cd
'
$(builddir)
'
;
pwd
`
\
abs_srcdir
=
`
cd
'
$(srcdir)
'
;
pwd
`
\
CONFIG_HEADER
=
'
$(abs_top_builddir)
/config.h'
\
CONFIG_HEADER
=
"
`
cd
'
$(top_builddir)
'
;
pwd
`
/config.h"
\
PATH
=
"
$(path_add)$(PATH_SEPARATOR)$$
PATH"
\
SHELL
=
"
$(SHELL)
"
\
LIBVIRT_DRIVER_DIR
=
"
$(abs_top_builddir)
/src/.libs"
\
...
...
tests/daemon-conf
浏览文件 @
4ebe4c10
...
...
@@ -52,15 +52,10 @@ while :; do
test
$i
=
$n
&&
break
# Filter out some ignorable diagnostics and drop timestamps
sed
\
-e
's/.*: error : //'
\
-e
'/^Cannot set group when not running as root$/d'
\
-e
'/^libnuma: Warning: .sys not mounted or no numa system/d'
\
err
>
k
&&
mv
k err
printf
'%s\n\n'
"remoteReadConfigFile:
$f
:
$param_name
:
$msg
"
>
expected-err
diff
-u
expected-err err
||
fail
=
1
# Check that the diagnostic we want appears
grep
"
$msg
"
err 1>/dev/null 2>&1
RET
=
$?
test
"
$RET
"
=
"0"
||
fail
=
1
i
=
$(
expr
$i
+ 1
)
done
...
...
tests/libvirtd-fail
浏览文件 @
4ebe4c10
...
...
@@ -12,10 +12,7 @@ test -z "$abs_top_srcdir" && abs_top_srcdir=$(pwd)/..
fail
=
0
libvirtd
--config
=
no-such-file
>
log 2>&1
&&
fail
=
1
cat
<<
\
EOF
> exp
Failed to open file 'no-such-file': No such file or directory
EOF
libvirtd
--config
=
no-such-conf
--timeout
=
5 2> log
RET
=
$?
compare exp log
||
fail
=
1
exit
$fail
test
"
$RET
"
!=
"0"
&&
exit
0
||
exit
1
tests/libvirtd-net-persist
已删除
100755 → 0
浏览文件 @
b9739b47
#!/bin/sh
# ensure that net-destroy doesn't make network disappear (persistence-related)
if
test
"
$VERBOSE
"
=
yes
;
then
set
-x
libvirtd
--version
virsh
--version
fi
test
-z
"
$srcdir
"
&&
srcdir
=
$(
pwd
)
test
-z
"
$abs_top_srcdir
"
&&
abs_top_srcdir
=
$(
pwd
)
/..
.
"
$srcdir
/test-lib.sh"
fail
=
0
pwd
=
$(
pwd
)
||
fail
=
1
sock_dir
=
"
$pwd
"
cat
>
conf
<<
EOF
|| fail=1
unix_sock_dir = "
$sock_dir
"
log_outputs = "3:file:
$pwd
/log"
EOF
cat
>
net.xml
<<
EOF
|| fail=1
<network>
<name>N</name>
<ip address="192.168.199.1" netmask="255.255.255.0"></ip>
</network>
EOF
cat
>
exp
<<
EOF
|| fail=1
Network N defined from net.xml
Network N destroyed
Name State Autostart
-----------------------------------------
N inactive no
EOF
libvirtd
--config
=
conf
>
libvirtd-log 2>&1 &
pid
=
$!
sleep
1
url
=
"qemu:///session?socket=@
$sock_dir
/libvirt-sock"
virsh
-c
"
$url
"
\
'net-define net.xml; net-destroy N; net-list --all'
>
out 2>&1
\
||
fail
=
1
# if libvird's log is empty, sleep for a second before killing it
test
-s
libvirtd-log
||
sleep
1
kill
$pid
compare exp out
||
fail
=
1
printf
"Shutting down network 'N'
\n
"
>
log-exp
compare log-exp libvirtd-log
||
fail
=
1
exit
$fail
tests/libvirtd-pool
浏览文件 @
4ebe4c10
#!/bin/sh
# Get coverage of
libvirtd's config-parsing code.
# Get coverage of
virsh pool-define-as XML formatting
if
test
"
$VERBOSE
"
=
yes
;
then
set
-x
libvirtd
--version
virsh
--version
fi
...
...
@@ -14,50 +13,28 @@ test -z "$abs_top_srcdir" && abs_top_srcdir=$(pwd)/..
fail
=
0
pwd
=
$(
pwd
)
||
fail
=
1
sock_dir
=
"
$pwd
"
cat
>
conf
<<
EOF
|| fail=1
unix_sock_dir = "
$sock_dir
"
log_outputs = "3:file:
$pwd
/log"
EOF
libvirtd
--config
=
conf
>
libvirtd-log 2>&1 &
pid
=
$!
sleep
1
url
=
"qemu:///session?socket=@
$sock_dir
/libvirt-sock"
virsh
--connect
"
$url
"
\
pool-define-as P
dir
src-host /src/path /src/dev S /target-path
>
out 2>&1
\
||
fail
=
1
virsh
--connect
"
$url
"
pool-dumpxml P
>>
out 2>&1
||
fail
=
1
# remove random uuid
sed
's/<uuid>.*/-/'
out
>
k
&&
mv
k out
||
fail
=
1
kill
$pid
virsh
--connect
test
:///default
\
pool-define-as
--print-xml
\
P
dir
src-host /src/path /src/dev S /target-path
\
1>out 2>&1
cat
<<
EOF
> pool-list-exp
Pool P defined
<pool type='dir'>
<name>P</name>
-
<capacity>0</capacity>
<allocation>0</allocation>
<available>0</available>
<source>
<host name='src-host'/>
<dir path='/src/path'/>
<device path='/src/dev'/>
<name>S</name>
</source>
<target>
<path>/target-path</path>
<permissions>
<mode>0700</mode>
<owner>500</owner>
<group>500</group>
</permissions>
</target>
</pool>
EOF
compare pool-list-exp out
||
fail
=
1
compare /dev/null libvirtd-log
||
fail
=
1
exit
$fail
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录