Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
libvirt
提交
14954fb8
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,发现更多精彩内容 >>
提交
14954fb8
编写于
8月 01, 2010
作者:
M
Matthias Bolte
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
esx: Set storage pool target path to host.mountInfo.path
Now all storage pool types expose the target path.
上级
5254546b
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
123 addition
and
65 deletion
+123
-65
src/esx/esx_storage_driver.c
src/esx/esx_storage_driver.c
+50
-64
src/esx/esx_vi.c
src/esx/esx_vi.c
+68
-0
src/esx/esx_vi.h
src/esx/esx_vi.h
+4
-0
src/esx/esx_vi_generator.py
src/esx/esx_vi_generator.py
+1
-1
未找到文件。
src/esx/esx_storage_driver.c
浏览文件 @
14954fb8
...
...
@@ -194,11 +194,8 @@ static virStoragePoolPtr
esxStoragePoolLookupByName
(
virConnectPtr
conn
,
const
char
*
name
)
{
esxPrivate
*
priv
=
conn
->
storagePrivateData
;
esxVI_String
*
propertyNameList
=
NULL
;
esxVI_ObjectContent
*
datastore
=
NULL
;
esxVI_DynamicProperty
*
dynamicProperty
=
NULL
;
esxVI_DatastoreHostMount
*
datastoreHostMountList
=
NULL
;
esxVI_DatastoreHostMount
*
datastoreHostMount
=
NULL
;
esxVI_DatastoreHostMount
*
hostMount
=
NULL
;
char
*
suffix
=
NULL
;
int
suffixLength
;
char
uuid_string
[
VIR_UUID_STRING_BUFLEN
]
=
"00000000-00000000-0000-000000000000"
;
...
...
@@ -209,9 +206,7 @@ esxStoragePoolLookupByName(virConnectPtr conn, const char *name)
return
NULL
;
}
if
(
esxVI_String_AppendValueToList
(
&
propertyNameList
,
"host"
)
<
0
||
esxVI_LookupDatastoreByName
(
priv
->
primary
,
name
,
propertyNameList
,
&
datastore
,
if
(
esxVI_LookupDatastoreByName
(
priv
->
primary
,
name
,
NULL
,
&
datastore
,
esxVI_Occurrence_RequiredItem
)
<
0
)
{
goto
cleanup
;
}
...
...
@@ -232,30 +227,12 @@ esxStoragePoolLookupByName(virConnectPtr conn, const char *name)
* The object name of virtual machine contains an integer, we use that as
* domain ID.
*/
for
(
dynamicProperty
=
datastore
->
propSet
;
dynamicProperty
!=
NULL
;
dynamicProperty
=
dynamicProperty
->
_next
)
{
if
(
STREQ
(
dynamicProperty
->
name
,
"host"
))
{
if
(
esxVI_DatastoreHostMount_CastListFromAnyType
(
dynamicProperty
->
val
,
&
datastoreHostMountList
)
<
0
)
{
goto
cleanup
;
}
break
;
}
if
(
esxVI_LookupDatastoreHostMount
(
priv
->
primary
,
datastore
->
obj
,
&
hostMount
)
<
0
)
{
goto
cleanup
;
}
for
(
datastoreHostMount
=
datastoreHostMountList
;
datastoreHostMount
!=
NULL
;
datastoreHostMount
=
datastoreHostMount
->
_next
)
{
if
(
STRNEQ
(
priv
->
primary
->
hostSystem
->
_reference
->
value
,
datastoreHostMount
->
key
->
value
))
{
continue
;
}
if
((
suffix
=
STRSKIP
(
datastoreHostMount
->
mountInfo
->
path
,
"/vmfs/volumes/"
))
==
NULL
)
{
break
;
}
if
((
suffix
=
STRSKIP
(
hostMount
->
mountInfo
->
path
,
"/vmfs/volumes/"
))
!=
NULL
)
{
suffixLength
=
strlen
(
suffix
);
if
((
suffixLength
==
35
&&
/* = strlen("4b0beca7-7fd401f3-1d7f-000ae484a6a3") */
...
...
@@ -284,9 +261,8 @@ esxStoragePoolLookupByName(virConnectPtr conn, const char *name)
pool
=
virGetStoragePool
(
conn
,
name
,
uuid
);
cleanup:
esxVI_String_Free
(
&
propertyNameList
);
esxVI_ObjectContent_Free
(
&
datastore
);
esxVI_DatastoreHostMount_Free
(
&
datastoreHostMountLis
t
);
esxVI_DatastoreHostMount_Free
(
&
hostMoun
t
);
return
pool
;
}
...
...
@@ -481,13 +457,12 @@ esxStoragePoolGetXMLDesc(virStoragePoolPtr pool, unsigned int flags)
esxPrivate
*
priv
=
pool
->
conn
->
storagePrivateData
;
esxVI_String
*
propertyNameList
=
NULL
;
esxVI_ObjectContent
*
datastore
=
NULL
;
esxVI_DatastoreHostMount
*
hostMount
=
NULL
;
esxVI_DynamicProperty
*
dynamicProperty
=
NULL
;
esxVI_Boolean
accessible
=
esxVI_Boolean_Undefined
;
virStoragePoolDef
def
;
esxVI_DatastoreInfo
*
info
=
NULL
;
esxVI_LocalDatastoreInfo
*
localInfo
=
NULL
;
esxVI_NasDatastoreInfo
*
nasInfo
=
NULL
;
esxVI_VmfsDatastoreInfo
*
vmfsInfo
=
NULL
;
char
*
xml
=
NULL
;
virCheckFlags
(
0
,
NULL
);
...
...
@@ -507,13 +482,17 @@ esxStoragePoolGetXMLDesc(virStoragePoolPtr pool, unsigned int flags)
propertyNameList
,
&
datastore
,
esxVI_Occurrence_RequiredItem
)
<
0
||
esxVI_GetBoolean
(
datastore
,
"summary.accessible"
,
&
accessible
,
esxVI_Occurrence_RequiredItem
)
<
0
)
{
&
accessible
,
esxVI_Occurrence_RequiredItem
)
<
0
||
esxVI_LookupDatastoreHostMount
(
priv
->
primary
,
datastore
->
obj
,
&
hostMount
)
<
0
)
{
goto
cleanup
;
}
def
.
name
=
pool
->
name
;
memcpy
(
def
.
uuid
,
pool
->
uuid
,
VIR_UUID_BUFLEN
);
def
.
target
.
path
=
hostMount
->
mountInfo
->
path
;
if
(
accessible
==
esxVI_Boolean_True
)
{
for
(
dynamicProperty
=
datastore
->
propSet
;
dynamicProperty
!=
NULL
;
dynamicProperty
=
dynamicProperty
->
_next
)
{
...
...
@@ -531,46 +510,52 @@ esxStoragePoolGetXMLDesc(virStoragePoolPtr pool, unsigned int flags)
}
def
.
available
=
dynamicProperty
->
val
->
int64
;
}
else
if
(
STREQ
(
dynamicProperty
->
name
,
"info"
))
{
if
(
esxVI_DatastoreInfo_CastFromAnyType
(
dynamicProperty
->
val
,
&
info
)
<
0
)
{
goto
cleanup
;
}
}
}
def
.
allocation
=
def
.
capacity
-
def
.
available
;
}
/* See vSphere API documentation about HostDatastoreSystem for details */
if
((
localInfo
=
esxVI_LocalDatastoreInfo_DynamicCast
(
info
))
!=
NULL
)
{
def
.
type
=
VIR_STORAGE_POOL_DIR
;
def
.
target
.
path
=
localInfo
->
path
;
}
else
if
((
nasInfo
=
esxVI_NasDatastoreInfo_DynamicCast
(
info
))
!=
NULL
)
{
def
.
type
=
VIR_STORAGE_POOL_NETFS
;
def
.
source
.
host
.
name
=
nasInfo
->
nas
->
remoteHost
;
def
.
source
.
dir
=
nasInfo
->
nas
->
remotePath
;
if
(
STRCASEEQ
(
nasInfo
->
nas
->
type
,
"NFS"
))
{
def
.
source
.
format
=
VIR_STORAGE_POOL_NETFS_NFS
;
}
else
if
(
STRCASEEQ
(
nasInfo
->
nas
->
type
,
"CIFS"
))
{
def
.
source
.
format
=
VIR_STORAGE_POOL_NETFS_CIFS
;
}
else
{
ESX_ERROR
(
VIR_ERR_INTERNAL_ERROR
,
_
(
"Datastore has unexpected type '%s'"
),
nasInfo
->
nas
->
type
);
for
(
dynamicProperty
=
datastore
->
propSet
;
dynamicProperty
!=
NULL
;
dynamicProperty
=
dynamicProperty
->
_next
)
{
if
(
STREQ
(
dynamicProperty
->
name
,
"info"
))
{
if
(
esxVI_DatastoreInfo_CastFromAnyType
(
dynamicProperty
->
val
,
&
info
)
<
0
)
{
goto
cleanup
;
}
}
else
if
((
vmfsInfo
=
esxVI_VmfsDatastoreInfo_DynamicCast
(
info
))
!=
NULL
)
{
def
.
type
=
VIR_STORAGE_POOL_FS
;
/*
* FIXME: I'm not sure how to represent the source and target of a
* VMFS based datastore in libvirt terms
*/
break
;
}
}
/* See vSphere API documentation about HostDatastoreSystem for details */
if
(
esxVI_LocalDatastoreInfo_DynamicCast
(
info
)
!=
NULL
)
{
def
.
type
=
VIR_STORAGE_POOL_DIR
;
}
else
if
((
nasInfo
=
esxVI_NasDatastoreInfo_DynamicCast
(
info
))
!=
NULL
)
{
def
.
type
=
VIR_STORAGE_POOL_NETFS
;
def
.
source
.
host
.
name
=
nasInfo
->
nas
->
remoteHost
;
def
.
source
.
dir
=
nasInfo
->
nas
->
remotePath
;
if
(
STRCASEEQ
(
nasInfo
->
nas
->
type
,
"NFS"
))
{
def
.
source
.
format
=
VIR_STORAGE_POOL_NETFS_NFS
;
}
else
if
(
STRCASEEQ
(
nasInfo
->
nas
->
type
,
"CIFS"
))
{
def
.
source
.
format
=
VIR_STORAGE_POOL_NETFS_CIFS
;
}
else
{
ESX_ERROR
(
VIR_ERR_INTERNAL_ERROR
,
"%s"
,
_
(
"DatastoreInfo has unexpected type"
));
ESX_ERROR
(
VIR_ERR_INTERNAL_ERROR
,
_
(
"Datastore has unexpected type '%s'"
),
nasInfo
->
nas
->
type
);
goto
cleanup
;
}
}
else
if
(
esxVI_VmfsDatastoreInfo_DynamicCast
(
info
)
!=
NULL
)
{
def
.
type
=
VIR_STORAGE_POOL_FS
;
/*
* FIXME: I'm not sure how to represent the source and target of a
* VMFS based datastore in libvirt terms
*/
}
else
{
ESX_ERROR
(
VIR_ERR_INTERNAL_ERROR
,
"%s"
,
_
(
"DatastoreInfo has unexpected type"
));
goto
cleanup
;
}
xml
=
virStoragePoolDefFormat
(
&
def
);
...
...
@@ -578,6 +563,7 @@ esxStoragePoolGetXMLDesc(virStoragePoolPtr pool, unsigned int flags)
cleanup:
esxVI_String_Free
(
&
propertyNameList
);
esxVI_ObjectContent_Free
(
&
datastore
);
esxVI_DatastoreHostMount_Free
(
&
hostMount
);
esxVI_DatastoreInfo_Free
(
&
info
);
return
xml
;
...
...
src/esx/esx_vi.c
浏览文件 @
14954fb8
...
...
@@ -2565,6 +2565,74 @@ esxVI_LookupDatastoreByAbsolutePath(esxVI_Context *ctx,
int
esxVI_LookupDatastoreHostMount
(
esxVI_Context
*
ctx
,
esxVI_ManagedObjectReference
*
datastore
,
esxVI_DatastoreHostMount
**
hostMount
)
{
int
result
=
-
1
;
esxVI_String
*
propertyNameList
=
NULL
;
esxVI_ObjectContent
*
objectContent
=
NULL
;
esxVI_DynamicProperty
*
dynamicProperty
=
NULL
;
esxVI_DatastoreHostMount
*
hostMountList
=
NULL
;
esxVI_DatastoreHostMount
*
candidate
=
NULL
;
if
(
hostMount
==
NULL
||
*
hostMount
!=
NULL
)
{
ESX_VI_ERROR
(
VIR_ERR_INTERNAL_ERROR
,
"%s"
,
_
(
"Invalid argument"
));
return
-
1
;
}
if
(
esxVI_String_AppendValueToList
(
&
propertyNameList
,
"host"
)
<
0
||
esxVI_LookupObjectContentByType
(
ctx
,
datastore
,
"Datastore"
,
propertyNameList
,
esxVI_Boolean_False
,
&
objectContent
)
<
0
)
{
goto
cleanup
;
}
for
(
dynamicProperty
=
objectContent
->
propSet
;
dynamicProperty
!=
NULL
;
dynamicProperty
=
dynamicProperty
->
_next
)
{
if
(
STREQ
(
dynamicProperty
->
name
,
"host"
))
{
if
(
esxVI_DatastoreHostMount_CastListFromAnyType
(
dynamicProperty
->
val
,
&
hostMountList
)
<
0
)
{
goto
cleanup
;
}
break
;
}
else
{
VIR_WARN
(
"Unexpected '%s' property"
,
dynamicProperty
->
name
);
}
}
for
(
candidate
=
hostMountList
;
candidate
!=
NULL
;
candidate
=
candidate
->
_next
)
{
if
(
STRNEQ
(
ctx
->
hostSystem
->
_reference
->
value
,
candidate
->
key
->
value
))
{
continue
;
}
if
(
esxVI_DatastoreHostMount_DeepCopy
(
hostMount
,
candidate
)
<
0
)
{
goto
cleanup
;
}
break
;
}
if
(
*
hostMount
==
NULL
)
{
ESX_VI_ERROR
(
VIR_ERR_INTERNAL_ERROR
,
"%s"
,
_
(
"Could not lookup datastore host mount"
));
goto
cleanup
;
}
result
=
0
;
cleanup:
esxVI_String_Free
(
&
propertyNameList
);
esxVI_ObjectContent_Free
(
&
objectContent
);
esxVI_DatastoreHostMount_Free
(
&
hostMountList
);
return
result
;
}
int
esxVI_LookupTaskInfoByTask
(
esxVI_Context
*
ctx
,
esxVI_ManagedObjectReference
*
task
,
...
...
src/esx/esx_vi.h
浏览文件 @
14954fb8
...
...
@@ -370,6 +370,10 @@ int esxVI_LookupDatastoreByAbsolutePath(esxVI_Context *ctx,
esxVI_ObjectContent
**
datastore
,
esxVI_Occurrence
occurrence
);
int
esxVI_LookupDatastoreHostMount
(
esxVI_Context
*
ctx
,
esxVI_ManagedObjectReference
*
datastore
,
esxVI_DatastoreHostMount
**
hostMount
);
int
esxVI_LookupTaskInfoByTask
(
esxVI_Context
*
ctx
,
esxVI_ManagedObjectReference
*
task
,
esxVI_TaskInfo
**
taskInfo
);
...
...
src/esx/esx_vi_generator.py
浏览文件 @
14954fb8
...
...
@@ -1127,7 +1127,7 @@ additional_enum_features = { "ManagedEntityStatus" : Enum.FEATURE__ANY_TYPE
"VirtualMachinePowerState"
:
Enum
.
FEATURE__ANY_TYPE
}
additional_object_features
=
{
"DatastoreHostMount"
:
Object
.
FEATURE__LIST
|
Object
.
FEATURE__ANY_TYPE
,
additional_object_features
=
{
"DatastoreHostMount"
:
Object
.
FEATURE__
DEEP_COPY
|
Object
.
FEATURE__
LIST
|
Object
.
FEATURE__ANY_TYPE
,
"DatastoreInfo"
:
Object
.
FEATURE__ANY_TYPE
|
Object
.
FEATURE__DYNAMIC_CAST
,
"Event"
:
Object
.
FEATURE__LIST
,
"FileInfo"
:
Object
.
FEATURE__DYNAMIC_CAST
,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录