Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
libvirt
提交
3804161e
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看板
提交
3804161e
编写于
5月 12, 2009
作者:
C
Cole Robinson
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Test driver implementation of virStorageVolCreateXMLFrom
上级
885de7f8
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
100 addition
and
0 deletion
+100
-0
ChangeLog
ChangeLog
+5
-0
src/test.c
src/test.c
+95
-0
未找到文件。
ChangeLog
浏览文件 @
3804161e
Tue May 12 16:14:43 EDT 2009 Cole Robinson <crobinso@redhat.com>
* src/test.c: Test driver implementation of
virStorageVolCreateXMLFrom
Tue May 12 16:11:14 EDT 2009 Cole Robinson <crobinso@redhat.com>
* qemud/remote.c qemud/remote_dispatch_args.h
...
...
src/test.c
浏览文件 @
3804161e
...
...
@@ -3140,6 +3140,100 @@ cleanup:
return
ret
;
}
static
virStorageVolPtr
testStorageVolumeCreateXMLFrom
(
virStoragePoolPtr
pool
,
const
char
*
xmldesc
,
virStorageVolPtr
clonevol
,
unsigned
int
flags
ATTRIBUTE_UNUSED
)
{
testConnPtr
privconn
=
pool
->
conn
->
privateData
;
virStoragePoolObjPtr
privpool
;
virStorageVolDefPtr
privvol
=
NULL
,
origvol
=
NULL
;
virStorageVolPtr
ret
=
NULL
;
testDriverLock
(
privconn
);
privpool
=
virStoragePoolObjFindByName
(
&
privconn
->
pools
,
pool
->
name
);
testDriverUnlock
(
privconn
);
if
(
privpool
==
NULL
)
{
testError
(
pool
->
conn
,
VIR_ERR_INVALID_ARG
,
__FUNCTION__
);
goto
cleanup
;
}
if
(
!
virStoragePoolObjIsActive
(
privpool
))
{
testError
(
pool
->
conn
,
VIR_ERR_INTERNAL_ERROR
,
_
(
"storage pool '%s' is not active"
),
pool
->
name
);
goto
cleanup
;
}
privvol
=
virStorageVolDefParse
(
pool
->
conn
,
privpool
->
def
,
xmldesc
,
NULL
);
if
(
privvol
==
NULL
)
goto
cleanup
;
if
(
virStorageVolDefFindByName
(
privpool
,
privvol
->
name
))
{
testError
(
pool
->
conn
,
VIR_ERR_INVALID_STORAGE_VOL
,
"%s"
,
_
(
"storage vol already exists"
));
goto
cleanup
;
}
origvol
=
virStorageVolDefFindByName
(
privpool
,
clonevol
->
name
);
if
(
!
origvol
)
{
testError
(
pool
->
conn
,
VIR_ERR_INVALID_STORAGE_VOL
,
_
(
"no storage vol with matching name '%s'"
),
clonevol
->
name
);
goto
cleanup
;
}
/* Make sure enough space */
if
((
privpool
->
def
->
allocation
+
privvol
->
allocation
)
>
privpool
->
def
->
capacity
)
{
testError
(
pool
->
conn
,
VIR_ERR_INTERNAL_ERROR
,
_
(
"Not enough free space in pool for volume '%s'"
),
privvol
->
name
);
goto
cleanup
;
}
privpool
->
def
->
available
=
(
privpool
->
def
->
capacity
-
privpool
->
def
->
allocation
);
if
(
VIR_REALLOC_N
(
privpool
->
volumes
.
objs
,
privpool
->
volumes
.
count
+
1
)
<
0
)
{
virReportOOMError
(
pool
->
conn
);
goto
cleanup
;
}
if
(
VIR_ALLOC_N
(
privvol
->
target
.
path
,
strlen
(
privpool
->
def
->
target
.
path
)
+
1
+
strlen
(
privvol
->
name
)
+
1
)
<
0
)
{
virReportOOMError
(
pool
->
conn
);
goto
cleanup
;
}
strcpy
(
privvol
->
target
.
path
,
privpool
->
def
->
target
.
path
);
strcat
(
privvol
->
target
.
path
,
"/"
);
strcat
(
privvol
->
target
.
path
,
privvol
->
name
);
privvol
->
key
=
strdup
(
privvol
->
target
.
path
);
if
(
privvol
->
key
==
NULL
)
{
virReportOOMError
(
pool
->
conn
);
goto
cleanup
;
}
privpool
->
def
->
allocation
+=
privvol
->
allocation
;
privpool
->
def
->
available
=
(
privpool
->
def
->
capacity
-
privpool
->
def
->
allocation
);
privpool
->
volumes
.
objs
[
privpool
->
volumes
.
count
++
]
=
privvol
;
ret
=
virGetStorageVol
(
pool
->
conn
,
privpool
->
def
->
name
,
privvol
->
name
,
privvol
->
key
);
privvol
=
NULL
;
cleanup:
virStorageVolDefFree
(
privvol
);
if
(
privpool
)
virStoragePoolObjUnlock
(
privpool
);
return
ret
;
}
static
int
testStorageVolumeDelete
(
virStorageVolPtr
vol
,
unsigned
int
flags
ATTRIBUTE_UNUSED
)
{
...
...
@@ -3583,6 +3677,7 @@ static virStorageDriver testStorageDriver = {
.
volLookupByKey
=
testStorageVolumeLookupByKey
,
.
volLookupByPath
=
testStorageVolumeLookupByPath
,
.
volCreateXML
=
testStorageVolumeCreateXML
,
.
volCreateXMLFrom
=
testStorageVolumeCreateXMLFrom
,
.
volDelete
=
testStorageVolumeDelete
,
.
volGetInfo
=
testStorageVolumeGetInfo
,
.
volGetXMLDesc
=
testStorageVolumeGetXMLDesc
,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录