Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
libvirt
提交
cbd788eb
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,发现更多精彩内容 >>
提交
cbd788eb
编写于
2月 05, 2015
作者:
J
Ján Tomko
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add flags argument to virStorageVolDefParse*
Allow the callers to pass down libvirt-internal flags.
上级
c7b9f206
变更
11
隐藏空白更改
内联
并排
Showing
11 changed file
with
45 addition
and
32 deletion
+45
-32
src/conf/storage_conf.c
src/conf/storage_conf.c
+16
-9
src/conf/storage_conf.h
src/conf/storage_conf.h
+6
-3
src/esx/esx_storage_backend_vmfs.c
src/esx/esx_storage_backend_vmfs.c
+2
-2
src/parallels/parallels_storage.c
src/parallels/parallels_storage.c
+3
-3
src/phyp/phyp_driver.c
src/phyp/phyp_driver.c
+1
-1
src/storage/storage_driver.c
src/storage/storage_driver.c
+2
-2
src/test/test_driver.c
src/test/test_driver.c
+3
-3
src/vbox/vbox_storage.c
src/vbox/vbox_storage.c
+1
-1
tests/storagebackendsheepdogtest.c
tests/storagebackendsheepdogtest.c
+1
-1
tests/storagevolxml2argvtest.c
tests/storagevolxml2argvtest.c
+2
-2
tests/storagevolxml2xmltest.c
tests/storagevolxml2xmltest.c
+8
-5
未找到文件。
src/conf/storage_conf.c
浏览文件 @
cbd788eb
...
...
@@ -1245,7 +1245,8 @@ virStorageSize(const char *unit,
static
virStorageVolDefPtr
virStorageVolDefParseXML
(
virStoragePoolDefPtr
pool
,
xmlXPathContextPtr
ctxt
)
xmlXPathContextPtr
ctxt
,
unsigned
int
flags
)
{
virStorageVolDefPtr
ret
;
virStorageVolOptionsPtr
options
;
...
...
@@ -1259,6 +1260,8 @@ virStorageVolDefParseXML(virStoragePoolDefPtr pool,
size_t
i
;
int
n
;
virCheckFlags
(
0
,
NULL
);
options
=
virStorageVolOptionsForPoolType
(
pool
->
type
);
if
(
options
==
NULL
)
return
NULL
;
...
...
@@ -1429,7 +1432,8 @@ virStorageVolDefParseXML(virStoragePoolDefPtr pool,
virStorageVolDefPtr
virStorageVolDefParseNode
(
virStoragePoolDefPtr
pool
,
xmlDocPtr
xml
,
xmlNodePtr
root
)
xmlNodePtr
root
,
unsigned
int
flags
)
{
xmlXPathContextPtr
ctxt
=
NULL
;
virStorageVolDefPtr
def
=
NULL
;
...
...
@@ -1449,7 +1453,7 @@ virStorageVolDefParseNode(virStoragePoolDefPtr pool,
}
ctxt
->
node
=
root
;
def
=
virStorageVolDefParseXML
(
pool
,
ctxt
);
def
=
virStorageVolDefParseXML
(
pool
,
ctxt
,
flags
);
cleanup:
xmlXPathFreeContext
(
ctxt
);
return
def
;
...
...
@@ -1458,13 +1462,14 @@ virStorageVolDefParseNode(virStoragePoolDefPtr pool,
static
virStorageVolDefPtr
virStorageVolDefParse
(
virStoragePoolDefPtr
pool
,
const
char
*
xmlStr
,
const
char
*
filename
)
const
char
*
filename
,
unsigned
int
flags
)
{
virStorageVolDefPtr
ret
=
NULL
;
xmlDocPtr
xml
;
if
((
xml
=
virXMLParse
(
filename
,
xmlStr
,
_
(
"(storage_volume_definition)"
))))
{
ret
=
virStorageVolDefParseNode
(
pool
,
xml
,
xmlDocGetRootElement
(
xml
));
ret
=
virStorageVolDefParseNode
(
pool
,
xml
,
xmlDocGetRootElement
(
xml
)
,
flags
);
xmlFreeDoc
(
xml
);
}
...
...
@@ -1473,16 +1478,18 @@ virStorageVolDefParse(virStoragePoolDefPtr pool,
virStorageVolDefPtr
virStorageVolDefParseString
(
virStoragePoolDefPtr
pool
,
const
char
*
xmlStr
)
const
char
*
xmlStr
,
unsigned
int
flags
)
{
return
virStorageVolDefParse
(
pool
,
xmlStr
,
NULL
);
return
virStorageVolDefParse
(
pool
,
xmlStr
,
NULL
,
flags
);
}
virStorageVolDefPtr
virStorageVolDefParseFile
(
virStoragePoolDefPtr
pool
,
const
char
*
filename
)
const
char
*
filename
,
unsigned
int
flags
)
{
return
virStorageVolDefParse
(
pool
,
NULL
,
filename
);
return
virStorageVolDefParse
(
pool
,
NULL
,
filename
,
flags
);
}
static
void
...
...
src/conf/storage_conf.h
浏览文件 @
cbd788eb
...
...
@@ -347,14 +347,17 @@ char *virStoragePoolDefFormat(virStoragePoolDefPtr def);
virStorageVolDefPtr
virStorageVolDefParseString
(
virStoragePoolDefPtr
pool
,
const
char
*
xml
);
const
char
*
xml
,
unsigned
int
flags
);
virStorageVolDefPtr
virStorageVolDefParseFile
(
virStoragePoolDefPtr
pool
,
const
char
*
filename
);
const
char
*
filename
,
unsigned
int
flags
);
virStorageVolDefPtr
virStorageVolDefParseNode
(
virStoragePoolDefPtr
pool
,
xmlDocPtr
xml
,
xmlNodePtr
root
);
xmlNodePtr
root
,
unsigned
int
flags
);
char
*
virStorageVolDefFormat
(
virStoragePoolDefPtr
pool
,
virStorageVolDefPtr
def
);
...
...
src/esx/esx_storage_backend_vmfs.c
浏览文件 @
cbd788eb
...
...
@@ -864,7 +864,7 @@ esxStorageVolCreateXML(virStoragePoolPtr pool,
}
/* Parse config */
def
=
virStorageVolDefParseString
(
&
poolDef
,
xmldesc
);
def
=
virStorageVolDefParseString
(
&
poolDef
,
xmldesc
,
0
);
if
(
!
def
)
goto
cleanup
;
...
...
@@ -1085,7 +1085,7 @@ esxStorageVolCreateXMLFrom(virStoragePoolPtr pool,
goto
cleanup
;
/* Parse config */
def
=
virStorageVolDefParseString
(
&
poolDef
,
xmldesc
);
def
=
virStorageVolDefParseString
(
&
poolDef
,
xmldesc
,
0
);
if
(
!
def
)
goto
cleanup
;
...
...
src/parallels/parallels_storage.c
浏览文件 @
cbd788eb
...
...
@@ -1208,9 +1208,9 @@ parallelsStorageVolDefineXML(virStoragePoolObjPtr pool,
char
*
xml_path
=
NULL
;
if
(
xmlfile
)
privvol
=
virStorageVolDefParseFile
(
pool
->
def
,
xmlfile
);
privvol
=
virStorageVolDefParseFile
(
pool
->
def
,
xmlfile
,
0
);
else
privvol
=
virStorageVolDefParseString
(
pool
->
def
,
xmldesc
);
privvol
=
virStorageVolDefParseString
(
pool
->
def
,
xmldesc
,
0
);
if
(
privvol
==
NULL
)
goto
cleanup
;
...
...
@@ -1335,7 +1335,7 @@ parallelsStorageVolCreateXMLFrom(virStoragePoolPtr pool,
goto
cleanup
;
}
privvol
=
virStorageVolDefParseString
(
privpool
->
def
,
xmldesc
);
privvol
=
virStorageVolDefParseString
(
privpool
->
def
,
xmldesc
,
0
);
if
(
privvol
==
NULL
)
goto
cleanup
;
...
...
src/phyp/phyp_driver.c
浏览文件 @
cbd788eb
...
...
@@ -2026,7 +2026,7 @@ phypStorageVolCreateXML(virStoragePoolPtr pool,
goto
err
;
}
if
((
voldef
=
virStorageVolDefParseString
(
spdef
,
xml
))
==
NULL
)
{
if
((
voldef
=
virStorageVolDefParseString
(
spdef
,
xml
,
0
))
==
NULL
)
{
VIR_ERROR
(
_
(
"Error parsing volume XML."
));
goto
err
;
}
...
...
src/storage/storage_driver.c
浏览文件 @
cbd788eb
...
...
@@ -1649,7 +1649,7 @@ storageVolCreateXML(virStoragePoolPtr obj,
if
((
backend
=
virStorageBackendForType
(
pool
->
def
->
type
))
==
NULL
)
goto
cleanup
;
voldef
=
virStorageVolDefParseString
(
pool
->
def
,
xmldesc
);
voldef
=
virStorageVolDefParseString
(
pool
->
def
,
xmldesc
,
0
);
if
(
voldef
==
NULL
)
goto
cleanup
;
...
...
@@ -1810,7 +1810,7 @@ storageVolCreateXMLFrom(virStoragePoolPtr obj,
goto
cleanup
;
}
newvol
=
virStorageVolDefParseString
(
pool
->
def
,
xmldesc
);
newvol
=
virStorageVolDefParseString
(
pool
->
def
,
xmldesc
,
0
);
if
(
newvol
==
NULL
)
goto
cleanup
;
...
...
src/test/test_driver.c
浏览文件 @
cbd788eb
...
...
@@ -1230,7 +1230,7 @@ testOpenVolumesForPool(const char *file,
if
(
!
node
)
goto
error
;
def
=
virStorageVolDefParseNode
(
pool
->
def
,
ctxt
->
doc
,
node
);
def
=
virStorageVolDefParseNode
(
pool
->
def
,
ctxt
->
doc
,
node
,
0
);
if
(
!
def
)
goto
error
;
...
...
@@ -5430,7 +5430,7 @@ testStorageVolCreateXML(virStoragePoolPtr pool,
goto
cleanup
;
}
privvol
=
virStorageVolDefParseString
(
privpool
->
def
,
xmldesc
);
privvol
=
virStorageVolDefParseString
(
privpool
->
def
,
xmldesc
,
0
);
if
(
privvol
==
NULL
)
goto
cleanup
;
...
...
@@ -5504,7 +5504,7 @@ testStorageVolCreateXMLFrom(virStoragePoolPtr pool,
goto
cleanup
;
}
privvol
=
virStorageVolDefParseString
(
privpool
->
def
,
xmldesc
);
privvol
=
virStorageVolDefParseString
(
privpool
->
def
,
xmldesc
,
0
);
if
(
privvol
==
NULL
)
goto
cleanup
;
...
...
src/vbox/vbox_storage.c
浏览文件 @
cbd788eb
...
...
@@ -430,7 +430,7 @@ vboxStorageVolCreateXML(virStoragePoolPtr pool,
memset
(
&
poolDef
,
0
,
sizeof
(
poolDef
));
poolDef
.
type
=
VIR_STORAGE_POOL_DIR
;
if
((
def
=
virStorageVolDefParseString
(
&
poolDef
,
xml
))
==
NULL
)
if
((
def
=
virStorageVolDefParseString
(
&
poolDef
,
xml
,
0
))
==
NULL
)
goto
cleanup
;
if
(
!
def
->
name
||
...
...
tests/storagebackendsheepdogtest.c
浏览文件 @
cbd788eb
...
...
@@ -100,7 +100,7 @@ test_vdi_list_parser(collie_test test, char *poolxml, char *volxml)
if
(
!
(
pool
=
virStoragePoolDefParseString
(
poolXmlData
)))
goto
cleanup
;
if
(
!
(
vol
=
virStorageVolDefParseString
(
pool
,
volXmlData
)))
if
(
!
(
vol
=
virStorageVolDefParseString
(
pool
,
volXmlData
,
0
)))
goto
cleanup
;
if
(
VIR_STRDUP
(
output
,
test
.
output
)
<
0
)
...
...
tests/storagevolxml2argvtest.c
浏览文件 @
cbd788eb
...
...
@@ -84,11 +84,11 @@ testCompareXMLToArgvFiles(bool shouldFail,
goto
cleanup
;
}
if
(
!
(
vol
=
virStorageVolDefParseString
(
pool
,
volXmlData
)))
if
(
!
(
vol
=
virStorageVolDefParseString
(
pool
,
volXmlData
,
0
)))
goto
cleanup
;
if
(
inputvolxml
&&
!
(
inputvol
=
virStorageVolDefParseString
(
inputpool
,
inputvolXmlData
)))
!
(
inputvol
=
virStorageVolDefParseString
(
inputpool
,
inputvolXmlData
,
0
)))
goto
cleanup
;
testSetVolumeType
(
vol
,
pool
);
...
...
tests/storagevolxml2xmltest.c
浏览文件 @
cbd788eb
...
...
@@ -18,7 +18,7 @@
static
int
testCompareXMLToXMLFiles
(
const
char
*
poolxml
,
const
char
*
inxml
,
const
char
*
outxml
)
const
char
*
outxml
,
unsigned
int
flags
)
{
char
*
poolXmlData
=
NULL
;
char
*
inXmlData
=
NULL
;
...
...
@@ -38,7 +38,7 @@ testCompareXMLToXMLFiles(const char *poolxml, const char *inxml,
if
(
!
(
pool
=
virStoragePoolDefParseString
(
poolXmlData
)))
goto
fail
;
if
(
!
(
dev
=
virStorageVolDefParseString
(
pool
,
inXmlData
)))
if
(
!
(
dev
=
virStorageVolDefParseString
(
pool
,
inXmlData
,
flags
)))
goto
fail
;
if
(
!
(
actual
=
virStorageVolDefFormat
(
pool
,
dev
)))
...
...
@@ -64,6 +64,7 @@ testCompareXMLToXMLFiles(const char *poolxml, const char *inxml,
struct
testInfo
{
const
char
*
pool
;
const
char
*
name
;
unsigned
int
flags
;
};
static
int
...
...
@@ -84,7 +85,7 @@ testCompareXMLToXMLHelper(const void *data)
goto
cleanup
;
}
result
=
testCompareXMLToXMLFiles
(
poolxml
,
inxml
,
outxml
);
result
=
testCompareXMLToXMLFiles
(
poolxml
,
inxml
,
outxml
,
info
->
flags
);
cleanup:
VIR_FREE
(
poolxml
);
...
...
@@ -100,15 +101,17 @@ mymain(void)
{
int
ret
=
0
;
#define DO_TEST
(pool, name)
\
#define DO_TEST
_FULL(pool, name, flags)
\
do { \
struct testInfo info = { pool, name
};
\
struct testInfo info = { pool, name
, flags };
\
if (virtTestRun("Storage Vol XML-2-XML " name, \
testCompareXMLToXMLHelper, &info) < 0) \
ret = -1; \
} \
while (0);
#define DO_TEST(pool, name) DO_TEST_FULL(pool, name, 0)
DO_TEST
(
"pool-dir"
,
"vol-file"
);
DO_TEST
(
"pool-dir"
,
"vol-file-naming"
);
DO_TEST
(
"pool-dir"
,
"vol-file-backing"
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录