Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
libvirt
提交
a9e96b1e
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看板
提交
a9e96b1e
编写于
8月 06, 2009
作者:
M
Matthias Bolte
提交者:
Daniel Veillard
8月 06, 2009
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Cleanup structure name naming
* src/esx/esx_driver.c src/esx/esx_util.[ch] src/esx/esx_vi.[ch]: just a name change
上级
5f48643e
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
135 addition
and
135 deletion
+135
-135
src/esx/esx_driver.c
src/esx/esx_driver.c
+91
-91
src/esx/esx_util.c
src/esx/esx_util.c
+14
-14
src/esx/esx_util.h
src/esx/esx_util.h
+3
-3
src/esx/esx_vi.c
src/esx/esx_vi.c
+26
-26
src/esx/esx_vi.h
src/esx/esx_vi.h
+1
-1
未找到文件。
src/esx/esx_driver.c
浏览文件 @
a9e96b1e
...
...
@@ -56,11 +56,11 @@ static int esxDomainGetMaxVcpus(virDomainPtr domain);
typedef
struct
_esxPrivate
{
esxVI_Context
*
host
;
esxVI_Context
*
v
c
enter
;
esxVI_Context
*
v
C
enter
;
int
phantom
;
// boolean
char
*
transport
;
int32_t
nvcpus_max
;
esxVI_Boolean
supports
_vm
otion
;
int32_t
maxVcpus
;
esxVI_Boolean
supports
VM
otion
;
int32_t
usedCpuTimeCounterId
;
}
esxPrivate
;
...
...
@@ -94,9 +94,9 @@ static virDrvOpenStatus
esxOpen
(
virConnectPtr
conn
,
virConnectAuthPtr
auth
,
int
flags
ATTRIBUTE_UNUSED
)
{
esxPrivate
*
priv
=
NULL
;
char
dummy_string
[
NI_MAXHOST
]
=
""
;
char
ipAddress
[
NI_MAXHOST
]
=
""
;
char
*
url
=
NULL
;
char
*
v
c
enter
=
NULL
;
char
*
v
C
enter
=
NULL
;
int
noVerify
=
0
;
// boolean
char
*
username
=
NULL
;
char
*
password
=
NULL
;
...
...
@@ -133,24 +133,24 @@ esxOpen(virConnectPtr conn, virConnectAuthPtr auth, int flags ATTRIBUTE_UNUSED)
}
priv
->
phantom
=
phantom
;
priv
->
nvcpus_max
=
-
1
;
priv
->
supports
_vm
otion
=
esxVI_Boolean_Undefined
;
priv
->
maxVcpus
=
-
1
;
priv
->
supports
VM
otion
=
esxVI_Boolean_Undefined
;
priv
->
usedCpuTimeCounterId
=
-
1
;
/* Request credentials and login to non-phantom host/vCenter */
if
(
!
phantom
)
{
if
(
esxUtil_ParseQuery
(
conn
,
&
priv
->
transport
,
&
v
c
enter
,
if
(
esxUtil_ParseQuery
(
conn
,
&
priv
->
transport
,
&
v
C
enter
,
&
noVerify
)
<
0
)
{
goto
failure
;
}
if
(
esxUtil_ResolveHostname
(
conn
,
conn
->
uri
->
server
,
dummy_string
,
if
(
esxUtil_ResolveHostname
(
conn
,
conn
->
uri
->
server
,
ipAddress
,
NI_MAXHOST
)
<
0
)
{
goto
failure
;
}
if
(
v
c
enter
!=
NULL
&&
esxUtil_ResolveHostname
(
conn
,
v
center
,
dummy_string
,
if
(
v
C
enter
!=
NULL
&&
esxUtil_ResolveHostname
(
conn
,
v
Center
,
ipAddress
,
NI_MAXHOST
)
<
0
)
{
goto
failure
;
}
...
...
@@ -235,18 +235,18 @@ esxOpen(virConnectPtr conn, virConnectAuthPtr auth, int flags ATTRIBUTE_UNUSED)
VIR_FREE
(
password
);
VIR_FREE
(
username
);
if
(
v
c
enter
!=
NULL
)
{
if
(
v
C
enter
!=
NULL
)
{
if
(
virAsprintf
(
&
url
,
"%s://%s/sdk"
,
priv
->
transport
,
v
c
enter
)
<
0
)
{
v
C
enter
)
<
0
)
{
virReportOOMError
(
conn
);
goto
failure
;
}
if
(
esxVI_Context_Alloc
(
conn
,
&
priv
->
v
c
enter
)
<
0
)
{
if
(
esxVI_Context_Alloc
(
conn
,
&
priv
->
v
C
enter
)
<
0
)
{
goto
failure
;
}
username
=
esxUtil_RequestUsername
(
auth
,
"administrator"
,
v
c
enter
);
username
=
esxUtil_RequestUsername
(
auth
,
"administrator"
,
v
C
enter
);
if
(
username
==
NULL
)
{
ESX_ERROR
(
conn
,
VIR_ERR_AUTH_FAILED
,
...
...
@@ -254,7 +254,7 @@ esxOpen(virConnectPtr conn, virConnectAuthPtr auth, int flags ATTRIBUTE_UNUSED)
goto
failure
;
}
password
=
esxUtil_RequestPassword
(
auth
,
username
,
v
c
enter
);
password
=
esxUtil_RequestPassword
(
auth
,
username
,
v
C
enter
);
if
(
password
==
NULL
)
{
ESX_ERROR
(
conn
,
VIR_ERR_AUTH_FAILED
,
...
...
@@ -262,13 +262,13 @@ esxOpen(virConnectPtr conn, virConnectAuthPtr auth, int flags ATTRIBUTE_UNUSED)
goto
failure
;
}
if
(
esxVI_Context_Connect
(
conn
,
priv
->
v
c
enter
,
url
,
username
,
if
(
esxVI_Context_Connect
(
conn
,
priv
->
v
C
enter
,
url
,
username
,
password
,
noVerify
)
<
0
)
{
goto
failure
;
}
if
(
priv
->
v
c
enter
->
productVersion
!=
esxVI_ProductVersion_VPX25
&&
priv
->
v
c
enter
->
productVersion
!=
esxVI_ProductVersion_VPX40
)
{
if
(
priv
->
v
C
enter
->
productVersion
!=
esxVI_ProductVersion_VPX25
&&
priv
->
v
C
enter
->
productVersion
!=
esxVI_ProductVersion_VPX40
)
{
ESX_ERROR
(
conn
,
VIR_ERR_INTERNAL_ERROR
,
"%s is neither a vCenter 2.5 server nor a vCenter "
"4.0 server"
,
...
...
@@ -281,7 +281,7 @@ esxOpen(virConnectPtr conn, virConnectAuthPtr auth, int flags ATTRIBUTE_UNUSED)
VIR_FREE
(
username
);
}
VIR_FREE
(
v
c
enter
);
VIR_FREE
(
v
C
enter
);
}
conn
->
privateData
=
priv
;
...
...
@@ -290,13 +290,13 @@ esxOpen(virConnectPtr conn, virConnectAuthPtr auth, int flags ATTRIBUTE_UNUSED)
failure:
VIR_FREE
(
url
);
VIR_FREE
(
v
c
enter
);
VIR_FREE
(
v
C
enter
);
VIR_FREE
(
password
);
VIR_FREE
(
username
);
if
(
priv
!=
NULL
)
{
esxVI_Context_Free
(
&
priv
->
host
);
esxVI_Context_Free
(
&
priv
->
v
c
enter
);
esxVI_Context_Free
(
&
priv
->
v
C
enter
);
VIR_FREE
(
priv
->
transport
);
VIR_FREE
(
priv
);
...
...
@@ -318,11 +318,11 @@ esxClose(virConnectPtr conn)
esxVI_Logout
(
conn
,
priv
->
host
);
esxVI_Context_Free
(
&
priv
->
host
);
if
(
priv
->
v
c
enter
!=
NULL
)
{
esxVI_EnsureSession
(
conn
,
priv
->
v
c
enter
);
if
(
priv
->
v
C
enter
!=
NULL
)
{
esxVI_EnsureSession
(
conn
,
priv
->
v
C
enter
);
esxVI_Logout
(
conn
,
priv
->
v
c
enter
);
esxVI_Context_Free
(
&
priv
->
v
c
enter
);
esxVI_Logout
(
conn
,
priv
->
v
C
enter
);
esxVI_Context_Free
(
&
priv
->
v
C
enter
);
}
}
...
...
@@ -350,8 +350,8 @@ esxSupportsVMotion(virConnectPtr conn)
goto
failure
;
}
if
(
priv
->
supports
_vm
otion
!=
esxVI_Boolean_Undefined
)
{
return
priv
->
supports
_vm
otion
;
if
(
priv
->
supports
VM
otion
!=
esxVI_Boolean_Undefined
)
{
return
priv
->
supports
VM
otion
;
}
if
(
esxVI_EnsureSession
(
conn
,
priv
->
host
)
<
0
)
{
...
...
@@ -380,7 +380,7 @@ esxSupportsVMotion(virConnectPtr conn)
goto
failure
;
}
priv
->
supports
_vm
otion
=
dynamicProperty
->
val
->
boolean
;
priv
->
supports
VM
otion
=
dynamicProperty
->
val
->
boolean
;
break
;
}
else
{
VIR_WARN
(
"Unexpected '%s' property"
,
dynamicProperty
->
name
);
...
...
@@ -391,10 +391,10 @@ esxSupportsVMotion(virConnectPtr conn)
esxVI_String_Free
(
&
propertyNameList
);
esxVI_ObjectContent_Free
(
&
hostSystem
);
return
priv
->
supports
_vm
otion
;
return
priv
->
supports
VM
otion
;
failure:
priv
->
supports
_vm
otion
=
esxVI_Boolean_Undefined
;
priv
->
supports
VM
otion
=
esxVI_Boolean_Undefined
;
goto
cleanup
;
}
...
...
@@ -405,7 +405,7 @@ static int
esxSupportsFeature
(
virConnectPtr
conn
,
int
feature
)
{
esxPrivate
*
priv
=
(
esxPrivate
*
)
conn
->
privateData
;
esxVI_Boolean
supports
_vm
otion
=
esxVI_Boolean_Undefined
;
esxVI_Boolean
supports
VM
otion
=
esxVI_Boolean_Undefined
;
if
(
priv
->
phantom
)
{
ESX_ERROR
(
conn
,
VIR_ERR_OPERATION_INVALID
,
...
...
@@ -415,18 +415,15 @@ esxSupportsFeature(virConnectPtr conn, int feature)
switch
(
feature
)
{
case
VIR_DRV_FEATURE_MIGRATION_V1
:
supports
_vm
otion
=
esxSupportsVMotion
(
conn
);
supports
VM
otion
=
esxSupportsVMotion
(
conn
);
if
(
supports
_vm
otion
==
esxVI_Boolean_Undefined
)
{
if
(
supports
VM
otion
==
esxVI_Boolean_Undefined
)
{
return
-
1
;
}
/*
* Migration is only possible via a Virtual Center and if VMotion is
* enabled
*/
return
priv
->
vcenter
!=
NULL
&&
supports_vmotion
==
esxVI_Boolean_True
?
1
:
0
;
/* Migration is only possible via a vCenter and if VMotion is enabled */
return
priv
->
vCenter
!=
NULL
&&
supportsVMotion
==
esxVI_Boolean_True
?
1
:
0
;
default:
return
0
;
...
...
@@ -838,9 +835,9 @@ esxDomainLookupByID(virConnectPtr conn, int id)
esxVI_ObjectContent
*
virtualMachineList
=
NULL
;
esxVI_ObjectContent
*
virtualMachine
=
NULL
;
esxVI_VirtualMachinePowerState
powerState
;
int
id_
=
-
1
;
char
*
name_
=
NULL
;
unsigned
char
uuid_
[
VIR_UUID_BUFLEN
];
int
id_
candidate
=
-
1
;
char
*
name_
candidate
=
NULL
;
unsigned
char
uuid_
candidate
[
VIR_UUID_BUFLEN
];
virDomainPtr
domain
=
NULL
;
if
(
priv
->
phantom
)
{
...
...
@@ -875,18 +872,19 @@ esxDomainLookupByID(virConnectPtr conn, int id)
continue
;
}
VIR_FREE
(
name_
);
VIR_FREE
(
name_
candidate
);
if
(
esxVI_GetVirtualMachineIdentity
(
conn
,
virtualMachine
,
&
id_
,
&
name_
,
uuid_
)
<
0
)
{
if
(
esxVI_GetVirtualMachineIdentity
(
conn
,
virtualMachine
,
&
id_candidate
,
&
name_candidate
,
uuid_candidate
)
<
0
)
{
goto
failure
;
}
if
(
id
_
!=
id
)
{
if
(
id
!=
id_candidate
)
{
continue
;
}
domain
=
virGetDomain
(
conn
,
name_
,
uuid_
);
domain
=
virGetDomain
(
conn
,
name_
candidate
,
uuid_candidate
);
if
(
domain
==
NULL
)
{
goto
failure
;
...
...
@@ -904,7 +902,7 @@ esxDomainLookupByID(virConnectPtr conn, int id)
cleanup:
esxVI_String_Free
(
&
propertyNameList
);
esxVI_ObjectContent_Free
(
&
virtualMachineList
);
VIR_FREE
(
name_
);
VIR_FREE
(
name_
candidate
);
return
domain
;
...
...
@@ -924,9 +922,9 @@ esxDomainLookupByUUID(virConnectPtr conn, const unsigned char *uuid)
esxVI_ObjectContent
*
virtualMachineList
=
NULL
;
esxVI_ObjectContent
*
virtualMachine
=
NULL
;
esxVI_VirtualMachinePowerState
powerState
;
int
id_
=
-
1
;
char
*
name_
=
NULL
;
unsigned
char
uuid_
[
VIR_UUID_BUFLEN
];
int
id_
candidate
=
-
1
;
char
*
name_
candidate
=
NULL
;
unsigned
char
uuid_
candidate
[
VIR_UUID_BUFLEN
];
char
uuid_string
[
VIR_UUID_STRING_BUFLEN
];
virDomainPtr
domain
=
NULL
;
...
...
@@ -952,19 +950,20 @@ esxDomainLookupByUUID(virConnectPtr conn, const unsigned char *uuid)
for
(
virtualMachine
=
virtualMachineList
;
virtualMachine
!=
NULL
;
virtualMachine
=
virtualMachine
->
_next
)
{
VIR_FREE
(
name_
);
VIR_FREE
(
name_
candidate
);
if
(
esxVI_GetVirtualMachineIdentity
(
conn
,
virtualMachine
,
&
id_
,
&
name_
,
uuid_
)
<
0
)
{
if
(
esxVI_GetVirtualMachineIdentity
(
conn
,
virtualMachine
,
&
id_candidate
,
&
name_candidate
,
uuid_candidate
)
<
0
)
{
goto
failure
;
}
if
(
memcmp
(
uuid
,
uuid_
,
if
(
memcmp
(
uuid
,
uuid_
candidate
,
VIR_UUID_BUFLEN
*
sizeof
(
unsigned
char
))
!=
0
)
{
continue
;
}
domain
=
virGetDomain
(
conn
,
name_
,
uuid
);
domain
=
virGetDomain
(
conn
,
name_
candidate
,
uuid_candidate
);
if
(
domain
==
NULL
)
{
goto
failure
;
...
...
@@ -977,7 +976,7 @@ esxDomainLookupByUUID(virConnectPtr conn, const unsigned char *uuid)
/* Only running/suspended virtual machines have an ID != -1 */
if
(
powerState
!=
esxVI_VirtualMachinePowerState_PoweredOff
)
{
domain
->
id
=
id_
;
domain
->
id
=
id_
candidate
;
}
else
{
domain
->
id
=
-
1
;
}
...
...
@@ -995,7 +994,7 @@ esxDomainLookupByUUID(virConnectPtr conn, const unsigned char *uuid)
cleanup:
esxVI_String_Free
(
&
propertyNameList
);
esxVI_ObjectContent_Free
(
&
virtualMachineList
);
VIR_FREE
(
name_
);
VIR_FREE
(
name_
candidate
);
return
domain
;
...
...
@@ -1015,9 +1014,9 @@ esxDomainLookupByName(virConnectPtr conn, const char *name)
esxVI_ObjectContent
*
virtualMachineList
=
NULL
;
esxVI_ObjectContent
*
virtualMachine
=
NULL
;
esxVI_VirtualMachinePowerState
powerState
;
int
id_
=
-
1
;
char
*
name_
=
NULL
;
unsigned
char
uuid_
[
VIR_UUID_BUFLEN
];
int
id_
candidate
=
-
1
;
char
*
name_
candidate
=
NULL
;
unsigned
char
uuid_
candidate
[
VIR_UUID_BUFLEN
];
virDomainPtr
domain
=
NULL
;
if
(
priv
->
phantom
)
{
...
...
@@ -1042,18 +1041,19 @@ esxDomainLookupByName(virConnectPtr conn, const char *name)
for
(
virtualMachine
=
virtualMachineList
;
virtualMachine
!=
NULL
;
virtualMachine
=
virtualMachine
->
_next
)
{
VIR_FREE
(
name_
);
VIR_FREE
(
name_
candidate
);
if
(
esxVI_GetVirtualMachineIdentity
(
conn
,
virtualMachine
,
&
id_
,
&
name_
,
uuid_
)
<
0
)
{
if
(
esxVI_GetVirtualMachineIdentity
(
conn
,
virtualMachine
,
&
id_candidate
,
&
name_candidate
,
uuid_candidate
)
<
0
)
{
goto
failure
;
}
if
(
STRNEQ
(
name
_
,
nam
e
))
{
if
(
STRNEQ
(
name
,
name_candidat
e
))
{
continue
;
}
domain
=
virGetDomain
(
conn
,
name
,
uuid_
);
domain
=
virGetDomain
(
conn
,
name
_candidate
,
uuid_candidate
);
if
(
domain
==
NULL
)
{
goto
failure
;
...
...
@@ -1066,7 +1066,7 @@ esxDomainLookupByName(virConnectPtr conn, const char *name)
/* Only running/suspended virtual machines have an ID != -1 */
if
(
powerState
!=
esxVI_VirtualMachinePowerState_PoweredOff
)
{
domain
->
id
=
id_
;
domain
->
id
=
id_
candidate
;
}
else
{
domain
->
id
=
-
1
;
}
...
...
@@ -1081,7 +1081,7 @@ esxDomainLookupByName(virConnectPtr conn, const char *name)
cleanup:
esxVI_String_Free
(
&
propertyNameList
);
esxVI_ObjectContent_Free
(
&
virtualMachineList
);
VIR_FREE
(
name_
);
VIR_FREE
(
name_
candidate
);
return
domain
;
...
...
@@ -1865,7 +1865,7 @@ esxDomainSetVcpus(virDomainPtr domain, unsigned int nvcpus)
{
int
result
=
0
;
esxPrivate
*
priv
=
(
esxPrivate
*
)
domain
->
conn
->
privateData
;
int
nvcpus_max
;
int
maxVcpus
;
esxVI_ObjectContent
*
virtualMachine
=
NULL
;
esxVI_VirtualMachineConfigSpec
*
spec
=
NULL
;
esxVI_ManagedObjectReference
*
task
=
NULL
;
...
...
@@ -1887,17 +1887,17 @@ esxDomainSetVcpus(virDomainPtr domain, unsigned int nvcpus)
goto
failure
;
}
nvcpus_max
=
esxDomainGetMaxVcpus
(
domain
);
maxVcpus
=
esxDomainGetMaxVcpus
(
domain
);
if
(
nvcpus_max
<
0
)
{
if
(
maxVcpus
<
0
)
{
goto
failure
;
}
if
(
nvcpus
>
nvcpus_max
)
{
if
(
nvcpus
>
maxVcpus
)
{
ESX_ERROR
(
domain
->
conn
,
VIR_ERR_INVALID_ARG
,
"Requested number of virtual CPUs is greater than max "
"allowable number of virtual CPUs for the domain: %d > %d"
,
nvcpus
,
nvcpus_max
);
nvcpus
,
maxVcpus
);
goto
failure
;
}
...
...
@@ -1953,8 +1953,8 @@ esxDomainGetMaxVcpus(virDomainPtr domain)
goto
failure
;
}
if
(
priv
->
nvcpus_max
>
0
)
{
return
priv
->
nvcpus_max
;
if
(
priv
->
maxVcpus
>
0
)
{
return
priv
->
maxVcpus
;
}
if
(
esxVI_EnsureSession
(
domain
->
conn
,
priv
->
host
)
<
0
)
{
...
...
@@ -1984,7 +1984,7 @@ esxDomainGetMaxVcpus(virDomainPtr domain)
goto
failure
;
}
priv
->
nvcpus_max
=
dynamicProperty
->
val
->
int32
;
priv
->
maxVcpus
=
dynamicProperty
->
val
->
int32
;
break
;
}
else
{
VIR_WARN
(
"Unexpected '%s' property"
,
dynamicProperty
->
name
);
...
...
@@ -1995,10 +1995,10 @@ esxDomainGetMaxVcpus(virDomainPtr domain)
esxVI_String_Free
(
&
propertyNameList
);
esxVI_ObjectContent_Free
(
&
hostSystem
);
return
priv
->
nvcpus_max
;
return
priv
->
maxVcpus
;
failure:
priv
->
nvcpus_max
=
-
1
;
priv
->
maxVcpus
=
-
1
;
goto
cleanup
;
}
...
...
@@ -2676,7 +2676,7 @@ esxDomainMigratePerform(virDomainPtr domain,
int
result
=
0
;
esxPrivate
*
priv
=
(
esxPrivate
*
)
domain
->
conn
->
privateData
;
xmlURIPtr
xmlUri
=
NULL
;
char
host
_ip_string
[
NI_MAXHOST
]
=
""
;
char
host
IpAddress
[
NI_MAXHOST
]
=
""
;
esxVI_ObjectContent
*
virtualMachine
=
NULL
;
esxVI_String
*
propertyNameList
=
NULL
;
esxVI_ObjectContent
*
hostSystem
=
NULL
;
...
...
@@ -2694,9 +2694,9 @@ esxDomainMigratePerform(virDomainPtr domain,
goto
failure
;
}
if
(
priv
->
v
c
enter
==
NULL
)
{
if
(
priv
->
v
C
enter
==
NULL
)
{
ESX_ERROR
(
domain
->
conn
,
VIR_ERR_INVALID_ARG
,
"Migration not possible without a
Virtual
Center"
);
"Migration not possible without a
v
Center"
);
goto
failure
;
}
...
...
@@ -2706,7 +2706,7 @@ esxDomainMigratePerform(virDomainPtr domain,
goto
failure
;
}
if
(
esxVI_EnsureSession
(
domain
->
conn
,
priv
->
v
c
enter
)
<
0
)
{
if
(
esxVI_EnsureSession
(
domain
->
conn
,
priv
->
v
C
enter
)
<
0
)
{
goto
failure
;
}
...
...
@@ -2718,13 +2718,13 @@ esxDomainMigratePerform(virDomainPtr domain,
goto
failure
;
}
if
(
esxUtil_ResolveHostname
(
domain
->
conn
,
xmlUri
->
server
,
host
_ip_string
,
if
(
esxUtil_ResolveHostname
(
domain
->
conn
,
xmlUri
->
server
,
host
IpAddress
,
NI_MAXHOST
)
<
0
)
{
goto
failure
;
}
/* Lookup VirtualMachine, HostSystem and ResourcePool */
if
(
esxVI_LookupVirtualMachineByUuid
(
domain
->
conn
,
priv
->
v
c
enter
,
if
(
esxVI_LookupVirtualMachineByUuid
(
domain
->
conn
,
priv
->
v
C
enter
,
domain
->
uuid
,
NULL
,
&
virtualMachine
)
<
0
)
{
goto
failure
;
...
...
@@ -2732,8 +2732,8 @@ esxDomainMigratePerform(virDomainPtr domain,
if
(
esxVI_String_AppendValueToList
(
domain
->
conn
,
&
propertyNameList
,
"parent"
)
<
0
||
esxVI_LookupHostSystemByIp
(
domain
->
conn
,
priv
->
v
c
enter
,
host
_ip_string
,
propertyNameList
,
esxVI_LookupHostSystemByIp
(
domain
->
conn
,
priv
->
v
C
enter
,
host
IpAddress
,
propertyNameList
,
&
hostSystem
)
<
0
)
{
goto
failure
;
}
...
...
@@ -2763,7 +2763,7 @@ esxDomainMigratePerform(virDomainPtr domain,
if
(
esxVI_String_AppendValueToList
(
domain
->
conn
,
&
propertyNameList
,
"resourcePool"
)
<
0
||
esxVI_GetObjectContent
(
domain
->
conn
,
priv
->
v
c
enter
,
esxVI_GetObjectContent
(
domain
->
conn
,
priv
->
v
C
enter
,
managedObjectReference
,
"ComputeResource"
,
propertyNameList
,
esxVI_Boolean_False
,
&
computeResource
)
<
0
)
{
...
...
@@ -2799,7 +2799,7 @@ esxDomainMigratePerform(virDomainPtr domain,
}
/* Validate the purposed migration */
if
(
esxVI_ValidateMigration
(
domain
->
conn
,
priv
->
v
c
enter
,
if
(
esxVI_ValidateMigration
(
domain
->
conn
,
priv
->
v
C
enter
,
virtualMachine
->
obj
,
esxVI_VirtualMachinePowerState_Undefined
,
NULL
,
resourcePool
,
hostSystem
->
obj
,
...
...
@@ -2826,9 +2826,9 @@ esxDomainMigratePerform(virDomainPtr domain,
}
/* Perform the purposed migration */
if
(
esxVI_MigrateVM_Task
(
domain
->
conn
,
priv
->
v
c
enter
,
virtualMachine
->
obj
,
if
(
esxVI_MigrateVM_Task
(
domain
->
conn
,
priv
->
v
C
enter
,
virtualMachine
->
obj
,
resourcePool
,
hostSystem
->
obj
,
&
task
)
<
0
||
esxVI_WaitForTaskCompletion
(
domain
->
conn
,
priv
->
v
c
enter
,
task
,
esxVI_WaitForTaskCompletion
(
domain
->
conn
,
priv
->
v
C
enter
,
task
,
&
taskInfoState
)
<
0
)
{
goto
failure
;
}
...
...
src/esx/esx_util.c
浏览文件 @
a9e96b1e
...
...
@@ -48,7 +48,7 @@
char
*
esxUtil_RequestUsername
(
virConnectAuthPtr
auth
,
const
char
*
default
_u
sername
,
esxUtil_RequestUsername
(
virConnectAuthPtr
auth
,
const
char
*
default
U
sername
,
const
char
*
server
)
{
unsigned
int
ncred
;
...
...
@@ -58,7 +58,7 @@ esxUtil_RequestUsername(virConnectAuthPtr auth, const char *default_username,
memset
(
&
cred
,
0
,
sizeof
(
virConnectCredential
));
if
(
virAsprintf
(
&
prompt
,
"Enter username for %s [%s]"
,
server
,
default
_u
sername
)
<
0
)
{
default
U
sername
)
<
0
)
{
return
NULL
;
}
...
...
@@ -70,7 +70,7 @@ esxUtil_RequestUsername(virConnectAuthPtr auth, const char *default_username,
cred
.
type
=
VIR_CRED_AUTHNAME
;
cred
.
prompt
=
prompt
;
cred
.
challenge
=
NULL
;
cred
.
defresult
=
default
_u
sername
;
cred
.
defresult
=
default
U
sername
;
cred
.
result
=
NULL
;
cred
.
resultlen
=
0
;
...
...
@@ -131,7 +131,7 @@ esxUtil_RequestPassword(virConnectAuthPtr auth, const char *username,
int
esxUtil_ParseQuery
(
virConnectPtr
conn
,
char
**
transport
,
char
**
v
c
enter
,
esxUtil_ParseQuery
(
virConnectPtr
conn
,
char
**
transport
,
char
**
v
C
enter
,
int
*
noVerify
)
{
int
result
=
0
;
...
...
@@ -143,8 +143,8 @@ esxUtil_ParseQuery(virConnectPtr conn, char **transport, char **vcenter,
*
transport
=
NULL
;
}
if
(
v
c
enter
!=
NULL
)
{
*
v
c
enter
=
NULL
;
if
(
v
C
enter
!=
NULL
)
{
*
v
C
enter
=
NULL
;
}
#ifdef HAVE_XMLURI_QUERY_RAW
...
...
@@ -174,10 +174,10 @@ esxUtil_ParseQuery(virConnectPtr conn, char **transport, char **vcenter,
"'%s' (should be http|https)"
,
*
transport
);
goto
failure
;
}
}
else
if
(
STRCASEEQ
(
queryParam
->
name
,
"vcenter"
)
&&
v
c
enter
!=
NULL
)
{
*
v
c
enter
=
strdup
(
queryParam
->
value
);
}
else
if
(
STRCASEEQ
(
queryParam
->
name
,
"vcenter"
)
&&
v
C
enter
!=
NULL
)
{
*
v
C
enter
=
strdup
(
queryParam
->
value
);
if
(
*
v
c
enter
==
NULL
)
{
if
(
*
v
C
enter
==
NULL
)
{
virReportOOMError
(
conn
);
goto
failure
;
}
...
...
@@ -217,8 +217,8 @@ esxUtil_ParseQuery(virConnectPtr conn, char **transport, char **vcenter,
VIR_FREE
(
*
transport
);
}
if
(
v
c
enter
!=
NULL
)
{
VIR_FREE
(
*
v
c
enter
);
if
(
v
C
enter
!=
NULL
)
{
VIR_FREE
(
*
v
C
enter
);
}
result
=
-
1
;
...
...
@@ -253,7 +253,7 @@ esxUtil_ParseVirtualMachineIDString(const char *id_string, int *id)
int
esxUtil_ResolveHostname
(
virConnectPtr
conn
,
const
char
*
hostname
,
char
*
ip
_address
,
size_t
ip_a
ddress_length
)
char
*
ip
Address
,
size_t
ipA
ddress_length
)
{
struct
addrinfo
hints
;
struct
addrinfo
*
result
=
NULL
;
...
...
@@ -282,8 +282,8 @@ esxUtil_ResolveHostname(virConnectPtr conn, const char *hostname,
return
-
1
;
}
errcode
=
getnameinfo
(
result
->
ai_addr
,
result
->
ai_addrlen
,
ip
_a
ddress
,
ip
_a
ddress_length
,
NULL
,
0
,
NI_NUMERICHOST
);
errcode
=
getnameinfo
(
result
->
ai_addr
,
result
->
ai_addrlen
,
ip
A
ddress
,
ip
A
ddress_length
,
NULL
,
0
,
NI_NUMERICHOST
);
if
(
errcode
!=
0
)
{
ESX_ERROR
(
conn
,
VIR_ERR_INTERNAL_ERROR
,
...
...
src/esx/esx_util.h
浏览文件 @
a9e96b1e
...
...
@@ -29,19 +29,19 @@
#include "conf.h"
char
*
esxUtil_RequestUsername
(
virConnectAuthPtr
auth
,
const
char
*
default
_u
sername
,
const
char
*
default
U
sername
,
const
char
*
server
);
char
*
esxUtil_RequestPassword
(
virConnectAuthPtr
auth
,
const
char
*
username
,
const
char
*
server
);
int
esxUtil_ParseQuery
(
virConnectPtr
conn
,
char
**
transport
,
char
**
v
c
enter
,
int
esxUtil_ParseQuery
(
virConnectPtr
conn
,
char
**
transport
,
char
**
v
C
enter
,
int
*
noVerify
);
int
esxUtil_ParseVirtualMachineIDString
(
const
char
*
id_string
,
int
*
id
);
int
esxUtil_ResolveHostname
(
virConnectPtr
conn
,
const
char
*
hostname
,
char
*
ip
_address
,
size_t
ip_a
ddress_length
);
char
*
ip
Address
,
size_t
ipA
ddress_length
);
int
esxUtil_GetConfigString
(
virConnectPtr
conn
,
virConfPtr
conf
,
const
char
*
name
,
char
**
string
,
int
optional
);
...
...
src/esx/esx_vi.c
浏览文件 @
a9e96b1e
...
...
@@ -377,7 +377,7 @@ esxVI_Context_Connect(virConnectPtr conn, esxVI_Context *ctx, const char *url,
if
(
ctx
->
vmFolder
==
NULL
||
ctx
->
hostFolder
==
NULL
)
{
ESX_VI_ERROR
(
conn
,
VIR_ERR_INTERNAL_ERROR
,
"The 'datacenter' object is missing the "
"'vmFolder'/'hostFolder' prop
o
erty"
);
"'vmFolder'/'hostFolder' property"
);
goto
failure
;
}
...
...
@@ -398,8 +398,8 @@ esxVI_Context_Download(virConnectPtr conn, esxVI_Context *ctx, const char *url,
char
**
content
)
{
virBuffer
buffer
=
VIR_BUFFER_INITIALIZER
;
CURLcode
error
_c
ode
;
long
response
_c
ode
;
CURLcode
error
C
ode
;
long
response
C
ode
;
if
(
content
==
NULL
||
*
content
!=
NULL
)
{
ESX_VI_ERROR
(
conn
,
VIR_ERR_INTERNAL_ERROR
,
"Invalid argument"
);
...
...
@@ -412,22 +412,22 @@ esxVI_Context_Download(virConnectPtr conn, esxVI_Context *ctx, const char *url,
curl_easy_setopt
(
ctx
->
curl_handle
,
CURLOPT_WRITEDATA
,
&
buffer
);
curl_easy_setopt
(
ctx
->
curl_handle
,
CURLOPT_HTTPGET
,
1
);
error
_c
ode
=
curl_easy_perform
(
ctx
->
curl_handle
);
error
C
ode
=
curl_easy_perform
(
ctx
->
curl_handle
);
if
(
error
_c
ode
!=
CURLE_OK
)
{
if
(
error
C
ode
!=
CURLE_OK
)
{
ESX_VI_ERROR
(
conn
,
VIR_ERR_INTERNAL_ERROR
,
"curl_easy_perform() returned an error: %s (%d)"
,
curl_easy_strerror
(
error
_code
),
error_c
ode
);
curl_easy_strerror
(
error
Code
),
errorC
ode
);
goto
unlock
;
}
error
_c
ode
=
curl_easy_getinfo
(
ctx
->
curl_handle
,
CURLINFO_RESPONSE_CODE
,
&
response_c
ode
);
error
C
ode
=
curl_easy_getinfo
(
ctx
->
curl_handle
,
CURLINFO_RESPONSE_CODE
,
&
responseC
ode
);
if
(
error
_c
ode
!=
CURLE_OK
)
{
if
(
error
C
ode
!=
CURLE_OK
)
{
ESX_VI_ERROR
(
conn
,
VIR_ERR_INTERNAL_ERROR
,
"curl_easy_getinfo() returned an error: %s (%d)"
,
curl_easy_strerror
(
error
_code
),
error_c
ode
);
curl_easy_strerror
(
error
Code
),
errorC
ode
);
goto
unlock
;
}
...
...
@@ -440,9 +440,9 @@ esxVI_Context_Download(virConnectPtr conn, esxVI_Context *ctx, const char *url,
*
content
=
virBufferContentAndReset
(
&
buffer
);
if
(
response
_c
ode
!=
200
)
{
if
(
response
C
ode
!=
200
)
{
ESX_VI_ERROR
(
conn
,
VIR_ERR_INTERNAL_ERROR
,
"HTTP response code %d"
,
(
int
)
response
_c
ode
);
"HTTP response code %d"
,
(
int
)
response
C
ode
);
goto
failure
;
}
...
...
@@ -482,7 +482,7 @@ esxVI_RemoteRequest_Execute(virConnectPtr conn, esxVI_Context *ctx,
{
virBuffer
buffer
=
VIR_BUFFER_INITIALIZER
;
esxVI_Fault
*
fault
=
NULL
;
CURLcode
error
_c
ode
;
CURLcode
error
C
ode
;
if
(
remoteRequest
==
NULL
||
remoteRequest
->
request
==
NULL
||
remoteResponse
==
NULL
||
*
remoteResponse
!=
NULL
)
{
...
...
@@ -503,22 +503,22 @@ esxVI_RemoteRequest_Execute(virConnectPtr conn, esxVI_Context *ctx,
curl_easy_setopt
(
ctx
->
curl_handle
,
CURLOPT_POSTFIELDSIZE
,
strlen
(
remoteRequest
->
request
));
error
_c
ode
=
curl_easy_perform
(
ctx
->
curl_handle
);
error
C
ode
=
curl_easy_perform
(
ctx
->
curl_handle
);
if
(
error
_c
ode
!=
CURLE_OK
)
{
if
(
error
C
ode
!=
CURLE_OK
)
{
ESX_VI_ERROR
(
conn
,
VIR_ERR_INTERNAL_ERROR
,
"curl_easy_perform() returned an error: %s (%d)"
,
curl_easy_strerror
(
error
_code
),
error_c
ode
);
curl_easy_strerror
(
error
Code
),
errorC
ode
);
goto
unlock
;
}
error
_c
ode
=
curl_easy_getinfo
(
ctx
->
curl_handle
,
CURLINFO_RESPONSE_CODE
,
&
(
*
remoteResponse
)
->
response_c
ode
);
error
C
ode
=
curl_easy_getinfo
(
ctx
->
curl_handle
,
CURLINFO_RESPONSE_CODE
,
&
(
*
remoteResponse
)
->
responseC
ode
);
if
(
error
_c
ode
!=
CURLE_OK
)
{
if
(
error
C
ode
!=
CURLE_OK
)
{
ESX_VI_ERROR
(
conn
,
VIR_ERR_INTERNAL_ERROR
,
"curl_easy_getinfo() returned an error: %s (%d)"
,
curl_easy_strerror
(
error
_code
),
error_c
ode
);
curl_easy_strerror
(
error
Code
),
errorC
ode
);
goto
unlock
;
}
...
...
@@ -531,9 +531,9 @@ esxVI_RemoteRequest_Execute(virConnectPtr conn, esxVI_Context *ctx,
(
*
remoteResponse
)
->
response
=
virBufferContentAndReset
(
&
buffer
);
if
((
*
remoteResponse
)
->
response
_c
ode
==
500
||
if
((
*
remoteResponse
)
->
response
C
ode
==
500
||
(
remoteRequest
->
xpathExpression
!=
NULL
&&
(
*
remoteResponse
)
->
response
_c
ode
==
200
))
{
(
*
remoteResponse
)
->
response
C
ode
==
200
))
{
(
*
remoteResponse
)
->
document
=
xmlReadDoc
(
BAD_CAST
(
*
remoteResponse
)
->
response
,
""
,
NULL
,
XML_PARSE_NONET
);
...
...
@@ -564,7 +564,7 @@ esxVI_RemoteRequest_Execute(virConnectPtr conn, esxVI_Context *ctx,
xmlXPathRegisterNs
((
*
remoteResponse
)
->
xpathContext
,
BAD_CAST
"vim"
,
BAD_CAST
"urn:vim25"
);
if
((
*
remoteResponse
)
->
response
_c
ode
==
500
)
{
if
((
*
remoteResponse
)
->
response
C
ode
==
500
)
{
(
*
remoteResponse
)
->
xpathObject
=
xmlXPathEval
(
BAD_CAST
"/soapenv:Envelope/soapenv:Body/soapenv:Fault"
,
...
...
@@ -580,7 +580,7 @@ esxVI_RemoteRequest_Execute(virConnectPtr conn, esxVI_Context *ctx,
ESX_VI_ERROR
(
conn
,
VIR_ERR_INTERNAL_ERROR
,
"HTTP response code %d. VI Fault: %s - %s"
,
(
int
)(
*
remoteResponse
)
->
response
_c
ode
,
(
int
)(
*
remoteResponse
)
->
response
C
ode
,
fault
->
faultcode
,
fault
->
faultstring
);
goto
failure
;
...
...
@@ -589,10 +589,10 @@ esxVI_RemoteRequest_Execute(virConnectPtr conn, esxVI_Context *ctx,
xmlXPathEval
(
BAD_CAST
remoteRequest
->
xpathExpression
,
(
*
remoteResponse
)
->
xpathContext
);
}
}
else
if
((
*
remoteResponse
)
->
response
_c
ode
!=
200
)
{
}
else
if
((
*
remoteResponse
)
->
response
C
ode
!=
200
)
{
ESX_VI_ERROR
(
conn
,
VIR_ERR_INTERNAL_ERROR
,
"HTTP response code %d"
,
(
int
)(
*
remoteResponse
)
->
response
_c
ode
);
(
int
)(
*
remoteResponse
)
->
response
C
ode
);
goto
failure
;
}
...
...
src/esx/esx_vi.h
浏览文件 @
a9e96b1e
...
...
@@ -114,7 +114,7 @@ int esxVI_RemoteRequest_Execute(virConnectPtr conn, esxVI_Context *ctx,
*/
struct
_esxVI_RemoteResponse
{
long
response
_code
;
/* required */
long
response
Code
;
/* required */
char
*
response
;
/* required */
xmlDocPtr
document
;
/* optional */
xmlXPathContextPtr
xpathContext
;
/* optional */
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录