Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
libvirt
提交
dd1f59a9
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看板
提交
dd1f59a9
编写于
12月 30, 2010
作者:
M
Matthias Bolte
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
esx: Move occurrence check into esxVI_LookupObjectContentByType
This simplifies the callers of esxVI_LookupObjectContentByType.
上级
3d4f6eee
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
69 addition
and
81 deletion
+69
-81
src/esx/esx_driver.c
src/esx/esx_driver.c
+2
-1
src/esx/esx_vi.c
src/esx/esx_vi.c
+65
-79
src/esx/esx_vi.h
src/esx/esx_vi.h
+2
-1
未找到文件。
src/esx/esx_driver.c
浏览文件 @
dd1f59a9
...
@@ -3886,7 +3886,8 @@ esxNodeGetFreeMemory(virConnectPtr conn)
...
@@ -3886,7 +3886,8 @@ esxNodeGetFreeMemory(virConnectPtr conn)
esxVI_LookupObjectContentByType
(
priv
->
primary
,
esxVI_LookupObjectContentByType
(
priv
->
primary
,
priv
->
primary
->
computeResource
->
resourcePool
,
priv
->
primary
->
computeResource
->
resourcePool
,
"ResourcePool"
,
propertyNameList
,
"ResourcePool"
,
propertyNameList
,
&
resourcePool
)
<
0
)
{
&
resourcePool
,
esxVI_Occurrence_RequiredItem
)
<
0
)
{
goto
cleanup
;
goto
cleanup
;
}
}
...
...
src/esx/esx_vi.c
浏览文件 @
dd1f59a9
...
@@ -499,13 +499,8 @@ esxVI_Context_LookupObjectsByPath(esxVI_Context *ctx,
...
@@ -499,13 +499,8 @@ esxVI_Context_LookupObjectsByPath(esxVI_Context *ctx,
"hostFolder
\0
"
)
<
0
||
"hostFolder
\0
"
)
<
0
||
esxVI_LookupObjectContentByType
(
ctx
,
ctx
->
service
->
rootFolder
,
esxVI_LookupObjectContentByType
(
ctx
,
ctx
->
service
->
rootFolder
,
"Datacenter"
,
propertyNameList
,
"Datacenter"
,
propertyNameList
,
&
datacenterList
)
<
0
)
{
&
datacenterList
,
goto
cleanup
;
esxVI_Occurrence_RequiredList
)
<
0
)
{
}
if
(
datacenterList
==
NULL
)
{
ESX_VI_ERROR
(
VIR_ERR_INTERNAL_ERROR
,
"%s"
,
_
(
"Could not retrieve datacenter list"
));
goto
cleanup
;
goto
cleanup
;
}
}
...
@@ -548,13 +543,8 @@ esxVI_Context_LookupObjectsByPath(esxVI_Context *ctx,
...
@@ -548,13 +543,8 @@ esxVI_Context_LookupObjectsByPath(esxVI_Context *ctx,
"resourcePool
\0
"
)
<
0
||
"resourcePool
\0
"
)
<
0
||
esxVI_LookupObjectContentByType
(
ctx
,
ctx
->
datacenter
->
hostFolder
,
esxVI_LookupObjectContentByType
(
ctx
,
ctx
->
datacenter
->
hostFolder
,
"ComputeResource"
,
propertyNameList
,
"ComputeResource"
,
propertyNameList
,
&
computeResourceList
)
<
0
)
{
&
computeResourceList
,
goto
cleanup
;
esxVI_Occurrence_RequiredList
)
<
0
)
{
}
if
(
computeResourceList
==
NULL
)
{
ESX_VI_ERROR
(
VIR_ERR_INTERNAL_ERROR
,
"%s"
,
_
(
"Could not retrieve compute resource list"
));
goto
cleanup
;
goto
cleanup
;
}
}
...
@@ -610,13 +600,8 @@ esxVI_Context_LookupObjectsByPath(esxVI_Context *ctx,
...
@@ -610,13 +600,8 @@ esxVI_Context_LookupObjectsByPath(esxVI_Context *ctx,
"configManager
\0
"
)
<
0
||
"configManager
\0
"
)
<
0
||
esxVI_LookupObjectContentByType
(
ctx
,
ctx
->
computeResource
->
_reference
,
esxVI_LookupObjectContentByType
(
ctx
,
ctx
->
computeResource
->
_reference
,
"HostSystem"
,
propertyNameList
,
"HostSystem"
,
propertyNameList
,
&
hostSystemList
)
<
0
)
{
&
hostSystemList
,
goto
cleanup
;
esxVI_Occurrence_RequiredList
)
<
0
)
{
}
if
(
hostSystemList
==
NULL
)
{
ESX_VI_ERROR
(
VIR_ERR_INTERNAL_ERROR
,
"%s"
,
_
(
"Could not retrieve host system list"
));
goto
cleanup
;
goto
cleanup
;
}
}
...
@@ -687,17 +672,9 @@ esxVI_Context_LookupObjectsByHostSystemIp(esxVI_Context *ctx,
...
@@ -687,17 +672,9 @@ esxVI_Context_LookupObjectsByHostSystemIp(esxVI_Context *ctx,
&
managedObjectReference
)
<
0
||
&
managedObjectReference
)
<
0
||
esxVI_LookupObjectContentByType
(
ctx
,
managedObjectReference
,
esxVI_LookupObjectContentByType
(
ctx
,
managedObjectReference
,
"HostSystem"
,
propertyNameList
,
"HostSystem"
,
propertyNameList
,
&
hostSystem
)
<
0
)
{
&
hostSystem
,
goto
cleanup
;
esxVI_Occurrence_RequiredItem
)
<
0
||
}
esxVI_HostSystem_CastFromObjectContent
(
hostSystem
,
if
(
hostSystem
==
NULL
)
{
ESX_VI_ERROR
(
VIR_ERR_INTERNAL_ERROR
,
"%s"
,
_
(
"Could not retrieve host system"
));
goto
cleanup
;
}
if
(
esxVI_HostSystem_CastFromObjectContent
(
hostSystem
,
&
ctx
->
hostSystem
)
<
0
)
{
&
ctx
->
hostSystem
)
<
0
)
{
goto
cleanup
;
goto
cleanup
;
}
}
...
@@ -711,17 +688,9 @@ esxVI_Context_LookupObjectsByHostSystemIp(esxVI_Context *ctx,
...
@@ -711,17 +688,9 @@ esxVI_Context_LookupObjectsByHostSystemIp(esxVI_Context *ctx,
"resourcePool
\0
"
)
<
0
||
"resourcePool
\0
"
)
<
0
||
esxVI_LookupObjectContentByType
(
ctx
,
hostSystem
->
obj
,
esxVI_LookupObjectContentByType
(
ctx
,
hostSystem
->
obj
,
"ComputeResource"
,
propertyNameList
,
"ComputeResource"
,
propertyNameList
,
&
computeResource
)
<
0
)
{
&
computeResource
,
goto
cleanup
;
esxVI_Occurrence_RequiredItem
)
<
0
||
}
esxVI_ComputeResource_CastFromObjectContent
(
computeResource
,
if
(
computeResource
==
NULL
)
{
ESX_VI_ERROR
(
VIR_ERR_INTERNAL_ERROR
,
"%s"
,
_
(
"Could not retrieve compute resource of host system"
));
goto
cleanup
;
}
if
(
esxVI_ComputeResource_CastFromObjectContent
(
computeResource
,
&
ctx
->
computeResource
)
<
0
)
{
&
ctx
->
computeResource
)
<
0
)
{
goto
cleanup
;
goto
cleanup
;
}
}
...
@@ -735,17 +704,9 @@ esxVI_Context_LookupObjectsByHostSystemIp(esxVI_Context *ctx,
...
@@ -735,17 +704,9 @@ esxVI_Context_LookupObjectsByHostSystemIp(esxVI_Context *ctx,
"hostFolder
\0
"
)
<
0
||
"hostFolder
\0
"
)
<
0
||
esxVI_LookupObjectContentByType
(
ctx
,
computeResource
->
obj
,
esxVI_LookupObjectContentByType
(
ctx
,
computeResource
->
obj
,
"Datacenter"
,
propertyNameList
,
"Datacenter"
,
propertyNameList
,
&
datacenter
)
<
0
)
{
&
datacenter
,
goto
cleanup
;
esxVI_Occurrence_RequiredItem
)
<
0
||
}
esxVI_Datacenter_CastFromObjectContent
(
datacenter
,
if
(
datacenter
==
NULL
)
{
ESX_VI_ERROR
(
VIR_ERR_INTERNAL_ERROR
,
"%s"
,
_
(
"Could not retrieve datacenter of compute resource"
));
goto
cleanup
;
}
if
(
esxVI_Datacenter_CastFromObjectContent
(
datacenter
,
&
ctx
->
datacenter
)
<
0
)
{
&
ctx
->
datacenter
)
<
0
)
{
goto
cleanup
;
goto
cleanup
;
}
}
...
@@ -1586,7 +1547,8 @@ esxVI_EnsureSession(esxVI_Context *ctx)
...
@@ -1586,7 +1547,8 @@ esxVI_EnsureSession(esxVI_Context *ctx)
"currentSession"
)
<
0
||
"currentSession"
)
<
0
||
esxVI_LookupObjectContentByType
(
ctx
,
ctx
->
service
->
sessionManager
,
esxVI_LookupObjectContentByType
(
ctx
,
ctx
->
service
->
sessionManager
,
"SessionManager"
,
propertyNameList
,
"SessionManager"
,
propertyNameList
,
&
sessionManager
)
<
0
)
{
&
sessionManager
,
esxVI_Occurrence_RequiredItem
)
<
0
)
{
goto
cleanup
;
goto
cleanup
;
}
}
...
@@ -1636,7 +1598,8 @@ esxVI_LookupObjectContentByType(esxVI_Context *ctx,
...
@@ -1636,7 +1598,8 @@ esxVI_LookupObjectContentByType(esxVI_Context *ctx,
esxVI_ManagedObjectReference
*
root
,
esxVI_ManagedObjectReference
*
root
,
const
char
*
type
,
const
char
*
type
,
esxVI_String
*
propertyNameList
,
esxVI_String
*
propertyNameList
,
esxVI_ObjectContent
**
objectContentList
)
esxVI_ObjectContent
**
objectContentList
,
esxVI_Occurrence
occurrence
)
{
{
int
result
=
-
1
;
int
result
=
-
1
;
esxVI_ObjectSpec
*
objectSpec
=
NULL
;
esxVI_ObjectSpec
*
objectSpec
=
NULL
;
...
@@ -1710,12 +1673,41 @@ esxVI_LookupObjectContentByType(esxVI_Context *ctx,
...
@@ -1710,12 +1673,41 @@ esxVI_LookupObjectContentByType(esxVI_Context *ctx,
esxVI_PropertySpec_AppendToList
(
&
propertyFilterSpec
->
propSet
,
esxVI_PropertySpec_AppendToList
(
&
propertyFilterSpec
->
propSet
,
propertySpec
)
<
0
||
propertySpec
)
<
0
||
esxVI_ObjectSpec_AppendToList
(
&
propertyFilterSpec
->
objectSet
,
esxVI_ObjectSpec_AppendToList
(
&
propertyFilterSpec
->
objectSet
,
objectSpec
)
<
0
)
{
objectSpec
)
<
0
||
esxVI_RetrieveProperties
(
ctx
,
propertyFilterSpec
,
objectContentList
)
<
0
)
{
goto
cleanup
;
goto
cleanup
;
}
}
result
=
esxVI_RetrieveProperties
(
ctx
,
propertyFilterSpec
,
if
(
objectContentList
==
NULL
)
{
objectContentList
);
switch
(
occurrence
)
{
case
esxVI_Occurrence_OptionalItem
:
case
esxVI_Occurrence_OptionalList
:
result
=
0
;
break
;
case
esxVI_Occurrence_RequiredItem
:
ESX_VI_ERROR
(
VIR_ERR_INTERNAL_ERROR
,
_
(
"Could not lookup '%s' from '%s'"
),
type
,
root
->
type
);
break
;
case
esxVI_Occurrence_RequiredList
:
ESX_VI_ERROR
(
VIR_ERR_INTERNAL_ERROR
,
_
(
"Could not lookup '%s' list from '%s'"
),
type
,
root
->
type
);
break
;
default:
ESX_VI_ERROR
(
VIR_ERR_INTERNAL_ERROR
,
"%s"
,
_
(
"Invalid occurrence value"
));
break
;
}
goto
cleanup
;
}
result
=
0
;
cleanup:
cleanup:
/*
/*
...
@@ -2276,7 +2268,8 @@ esxVI_LookupHostSystemProperties(esxVI_Context *ctx,
...
@@ -2276,7 +2268,8 @@ esxVI_LookupHostSystemProperties(esxVI_Context *ctx,
{
{
return
esxVI_LookupObjectContentByType
(
ctx
,
ctx
->
hostSystem
->
_reference
,
return
esxVI_LookupObjectContentByType
(
ctx
,
ctx
->
hostSystem
->
_reference
,
"HostSystem"
,
propertyNameList
,
"HostSystem"
,
propertyNameList
,
hostSystem
);
hostSystem
,
esxVI_Occurrence_RequiredItem
);
}
}
...
@@ -2290,7 +2283,8 @@ esxVI_LookupVirtualMachineList(esxVI_Context *ctx,
...
@@ -2290,7 +2283,8 @@ esxVI_LookupVirtualMachineList(esxVI_Context *ctx,
* for cluster support */
* for cluster support */
return
esxVI_LookupObjectContentByType
(
ctx
,
ctx
->
hostSystem
->
_reference
,
return
esxVI_LookupObjectContentByType
(
ctx
,
ctx
->
hostSystem
->
_reference
,
"VirtualMachine"
,
propertyNameList
,
"VirtualMachine"
,
propertyNameList
,
virtualMachineList
);
virtualMachineList
,
esxVI_Occurrence_OptionalList
);
}
}
...
@@ -2332,7 +2326,8 @@ esxVI_LookupVirtualMachineByUuid(esxVI_Context *ctx, const unsigned char *uuid,
...
@@ -2332,7 +2326,8 @@ esxVI_LookupVirtualMachineByUuid(esxVI_Context *ctx, const unsigned char *uuid,
if
(
esxVI_LookupObjectContentByType
(
ctx
,
managedObjectReference
,
if
(
esxVI_LookupObjectContentByType
(
ctx
,
managedObjectReference
,
"VirtualMachine"
,
propertyNameList
,
"VirtualMachine"
,
propertyNameList
,
virtualMachine
)
<
0
)
{
virtualMachine
,
esxVI_Occurrence_RequiredItem
)
<
0
)
{
goto
cleanup
;
goto
cleanup
;
}
}
...
@@ -2475,7 +2470,8 @@ esxVI_LookupDatastoreList(esxVI_Context *ctx, esxVI_String *propertyNameList,
...
@@ -2475,7 +2470,8 @@ esxVI_LookupDatastoreList(esxVI_Context *ctx, esxVI_String *propertyNameList,
* support */
* support */
return
esxVI_LookupObjectContentByType
(
ctx
,
ctx
->
hostSystem
->
_reference
,
return
esxVI_LookupObjectContentByType
(
ctx
,
ctx
->
hostSystem
->
_reference
,
"Datastore"
,
propertyNameList
,
"Datastore"
,
propertyNameList
,
datastoreList
);
datastoreList
,
esxVI_Occurrence_OptionalList
);
}
}
...
@@ -2654,7 +2650,8 @@ esxVI_LookupDatastoreHostMount(esxVI_Context *ctx,
...
@@ -2654,7 +2650,8 @@ esxVI_LookupDatastoreHostMount(esxVI_Context *ctx,
if
(
esxVI_String_AppendValueToList
(
&
propertyNameList
,
"host"
)
<
0
||
if
(
esxVI_String_AppendValueToList
(
&
propertyNameList
,
"host"
)
<
0
||
esxVI_LookupObjectContentByType
(
ctx
,
datastore
,
"Datastore"
,
esxVI_LookupObjectContentByType
(
ctx
,
datastore
,
"Datastore"
,
propertyNameList
,
&
objectContent
)
<
0
)
{
propertyNameList
,
&
objectContent
,
esxVI_Occurrence_RequiredItem
)
<
0
)
{
goto
cleanup
;
goto
cleanup
;
}
}
...
@@ -2719,7 +2716,8 @@ esxVI_LookupTaskInfoByTask(esxVI_Context *ctx,
...
@@ -2719,7 +2716,8 @@ esxVI_LookupTaskInfoByTask(esxVI_Context *ctx,
if
(
esxVI_String_AppendValueToList
(
&
propertyNameList
,
"info"
)
<
0
||
if
(
esxVI_String_AppendValueToList
(
&
propertyNameList
,
"info"
)
<
0
||
esxVI_LookupObjectContentByType
(
ctx
,
task
,
"Task"
,
propertyNameList
,
esxVI_LookupObjectContentByType
(
ctx
,
task
,
"Task"
,
propertyNameList
,
&
objectContent
)
<
0
)
{
&
objectContent
,
esxVI_Occurrence_RequiredItem
)
<
0
)
{
goto
cleanup
;
goto
cleanup
;
}
}
...
@@ -3400,13 +3398,7 @@ esxVI_LookupAutoStartDefaults(esxVI_Context *ctx,
...
@@ -3400,13 +3398,7 @@ esxVI_LookupAutoStartDefaults(esxVI_Context *ctx,
esxVI_LookupObjectContentByType
esxVI_LookupObjectContentByType
(
ctx
,
ctx
->
hostSystem
->
configManager
->
autoStartManager
,
(
ctx
,
ctx
->
hostSystem
->
configManager
->
autoStartManager
,
"HostAutoStartManager"
,
propertyNameList
,
"HostAutoStartManager"
,
propertyNameList
,
&
hostAutoStartManager
)
<
0
)
{
&
hostAutoStartManager
,
esxVI_Occurrence_RequiredItem
)
<
0
)
{
goto
cleanup
;
}
if
(
hostAutoStartManager
==
NULL
)
{
ESX_VI_ERROR
(
VIR_ERR_INTERNAL_ERROR
,
"%s"
,
_
(
"Could not retrieve the HostAutoStartManager object"
));
goto
cleanup
;
goto
cleanup
;
}
}
...
@@ -3463,13 +3455,7 @@ esxVI_LookupAutoStartPowerInfoList(esxVI_Context *ctx,
...
@@ -3463,13 +3455,7 @@ esxVI_LookupAutoStartPowerInfoList(esxVI_Context *ctx,
esxVI_LookupObjectContentByType
esxVI_LookupObjectContentByType
(
ctx
,
ctx
->
hostSystem
->
configManager
->
autoStartManager
,
(
ctx
,
ctx
->
hostSystem
->
configManager
->
autoStartManager
,
"HostAutoStartManager"
,
propertyNameList
,
"HostAutoStartManager"
,
propertyNameList
,
&
hostAutoStartManager
)
<
0
)
{
&
hostAutoStartManager
,
esxVI_Occurrence_RequiredItem
)
<
0
)
{
goto
cleanup
;
}
if
(
hostAutoStartManager
==
NULL
)
{
ESX_VI_ERROR
(
VIR_ERR_INTERNAL_ERROR
,
"%s"
,
_
(
"Could not retrieve the HostAutoStartManager object"
));
goto
cleanup
;
goto
cleanup
;
}
}
...
...
src/esx/esx_vi.h
浏览文件 @
dd1f59a9
...
@@ -284,7 +284,8 @@ int esxVI_LookupObjectContentByType(esxVI_Context *ctx,
...
@@ -284,7 +284,8 @@ int esxVI_LookupObjectContentByType(esxVI_Context *ctx,
esxVI_ManagedObjectReference
*
root
,
esxVI_ManagedObjectReference
*
root
,
const
char
*
type
,
const
char
*
type
,
esxVI_String
*
propertyNameList
,
esxVI_String
*
propertyNameList
,
esxVI_ObjectContent
**
objectContentList
);
esxVI_ObjectContent
**
objectContentList
,
esxVI_Occurrence
occurrence
);
int
esxVI_GetManagedEntityStatus
int
esxVI_GetManagedEntityStatus
(
esxVI_ObjectContent
*
objectContent
,
const
char
*
propertyName
,
(
esxVI_ObjectContent
*
objectContent
,
const
char
*
propertyName
,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录