Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
libvirt
提交
e60e8da4
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看板
提交
e60e8da4
编写于
8月 11, 2014
作者:
T
Taowei
提交者:
Michal Privoznik
8月 15, 2014
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
vbox: Rewrite vboxDomainUndefineFlags
上级
e89a93c0
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
258 addition
and
176 deletion
+258
-176
src/vbox/vbox_common.c
src/vbox/vbox_common.c
+70
-0
src/vbox/vbox_tmpl.c
src/vbox/vbox_tmpl.c
+180
-176
src/vbox/vbox_uniformed_api.h
src/vbox/vbox_uniformed_api.h
+8
-0
未找到文件。
src/vbox/vbox_common.c
浏览文件 @
e60e8da4
...
...
@@ -27,6 +27,7 @@
#include "virlog.h"
#include "viralloc.h"
#include "nodeinfo.h"
#include "virstring.h"
#include "vbox_common.h"
#include "vbox_uniformed_api.h"
...
...
@@ -697,3 +698,72 @@ virDomainPtr vboxDomainLookupByUUID(virConnectPtr conn,
return
ret
;
}
static
void
detachDevices_common
(
vboxGlobalData
*
data
,
vboxIIDUnion
*
iidu
)
{
/* Block for checking if HDD's are attched to VM.
* considering just IDE bus for now. Also skipped
* chanel=1 and device=0 (Secondary Master) as currenlty
* it is allocated to CD/DVD Drive by default.
*
* Only do this for VirtualBox 3.x and before. Since
* VirtualBox 4.0 the Unregister method can do this for use.
*/
IMachine
*
machine
=
NULL
;
PRUnichar
*
hddcnameUtf16
=
NULL
;
nsresult
rc
;
char
*
hddcname
;
if
(
!
gVBoxAPI
.
detachDevicesExplicitly
)
VIR_WARN
(
"This function may not work in current vbox version"
);
ignore_value
(
VIR_STRDUP
(
hddcname
,
"IDE"
));
VBOX_UTF8_TO_UTF16
(
hddcname
,
&
hddcnameUtf16
);
VIR_FREE
(
hddcname
);
/* Open a Session for the machine */
rc
=
gVBoxAPI
.
UISession
.
Open
(
data
,
iidu
,
machine
);
if
(
NS_SUCCEEDED
(
rc
))
{
rc
=
gVBoxAPI
.
UISession
.
GetMachine
(
data
->
vboxSession
,
&
machine
);
if
(
NS_SUCCEEDED
(
rc
)
&&
machine
)
{
gVBoxAPI
.
detachDevices
(
data
,
machine
,
hddcnameUtf16
);
gVBoxAPI
.
UIMachine
.
SaveSettings
(
machine
);
}
gVBoxAPI
.
UISession
.
Close
(
data
->
vboxSession
);
}
VBOX_UTF16_FREE
(
hddcnameUtf16
);
}
int
vboxDomainUndefineFlags
(
virDomainPtr
dom
,
unsigned
int
flags
)
{
VBOX_OBJECT_CHECK
(
dom
->
conn
,
int
,
-
1
);
IMachine
*
machine
=
NULL
;
vboxIIDUnion
iid
;
nsresult
rc
;
gVBoxAPI
.
UIID
.
vboxIIDInitialize
(
&
iid
);
/* No managed save, so we explicitly reject
* VIR_DOMAIN_UNDEFINE_MANAGED_SAVE. No snapshot metadata for
* VBox, so we can trivially ignore that flag. */
virCheckFlags
(
VIR_DOMAIN_UNDEFINE_SNAPSHOTS_METADATA
,
-
1
);
vboxIIDFromUUID
(
&
iid
,
dom
->
uuid
);
if
(
gVBoxAPI
.
detachDevicesExplicitly
)
detachDevices_common
(
data
,
&
iid
);
rc
=
gVBoxAPI
.
unregisterMachine
(
data
,
&
iid
,
&
machine
);
DEBUGIID
(
"UUID of machine being undefined"
,
&
iid
);
if
(
NS_SUCCEEDED
(
rc
))
{
gVBoxAPI
.
deleteConfig
(
machine
);
ret
=
0
;
}
else
{
virReportError
(
VIR_ERR_INTERNAL_ERROR
,
_
(
"could not delete the domain, rc=%08x"
),
(
unsigned
)
rc
);
}
vboxIIDUnalloc
(
&
iid
);
VBOX_RELEASE
(
machine
);
return
ret
;
}
src/vbox/vbox_tmpl.c
浏览文件 @
e60e8da4
...
...
@@ -254,7 +254,6 @@ static vboxGlobalData *g_pVBoxGlobalData = NULL;
static
virDomainPtr
vboxDomainDefineXML
(
virConnectPtr
conn
,
const
char
*
xml
);
static
int
vboxDomainCreate
(
virDomainPtr
dom
);
static
int
vboxDomainUndefineFlags
(
virDomainPtr
dom
,
unsigned
int
flags
);
#if VBOX_API_VERSION > 2002000 && VBOX_API_VERSION < 4000000
/* Since vboxConnectGetCapabilities has been rewritten,
...
...
@@ -4784,181 +4783,6 @@ static virDomainPtr vboxDomainDefineXML(virConnectPtr conn, const char *xml)
return
NULL
;
}
static
int
vboxDomainUndefineFlags
(
virDomainPtr
dom
,
unsigned
int
flags
)
{
VBOX_OBJECT_CHECK
(
dom
->
conn
,
int
,
-
1
);
IMachine
*
machine
=
NULL
;
vboxIID
iid
=
VBOX_IID_INITIALIZER
;
nsresult
rc
;
#if VBOX_API_VERSION >= 4000000
vboxArray
media
=
VBOX_ARRAY_INITIALIZER
;
#endif
/* No managed save, so we explicitly reject
* VIR_DOMAIN_UNDEFINE_MANAGED_SAVE. No snapshot metadata for
* VBox, so we can trivially ignore that flag. */
virCheckFlags
(
VIR_DOMAIN_UNDEFINE_SNAPSHOTS_METADATA
,
-
1
);
vboxIIDFromUUID
(
&
iid
,
dom
->
uuid
);
#if VBOX_API_VERSION < 4000000
/* Block for checking if HDD's are attched to VM.
* considering just IDE bus for now. Also skipped
* chanel=1 and device=0 (Secondary Master) as currenlty
* it is allocated to CD/DVD Drive by default.
*
* Only do this for VirtualBox 3.x and before. Since
* VirtualBox 4.0 the Unregister method can do this for use.
*/
{
PRUnichar
*
hddcnameUtf16
=
NULL
;
char
*
hddcname
;
ignore_value
(
VIR_STRDUP
(
hddcname
,
"IDE"
));
VBOX_UTF8_TO_UTF16
(
hddcname
,
&
hddcnameUtf16
);
VIR_FREE
(
hddcname
);
/* Open a Session for the machine */
rc
=
VBOX_SESSION_OPEN
(
iid
.
value
,
machine
);
if
(
NS_SUCCEEDED
(
rc
))
{
rc
=
data
->
vboxSession
->
vtbl
->
GetMachine
(
data
->
vboxSession
,
&
machine
);
if
(
NS_SUCCEEDED
(
rc
)
&&
machine
)
{
# if VBOX_API_VERSION < 3001000
/* Disconnect all the drives if present */
machine
->
vtbl
->
DetachHardDisk
(
machine
,
hddcnameUtf16
,
0
,
0
);
machine
->
vtbl
->
DetachHardDisk
(
machine
,
hddcnameUtf16
,
0
,
1
);
machine
->
vtbl
->
DetachHardDisk
(
machine
,
hddcnameUtf16
,
1
,
1
);
# else
/* VBOX_API_VERSION >= 3001000 */
/* get all the controller first, then the attachments and
* remove them all so that the machine can be undefined
*/
vboxArray
storageControllers
=
VBOX_ARRAY_INITIALIZER
;
size_t
i
=
0
,
j
=
0
;
vboxArrayGet
(
&
storageControllers
,
machine
,
machine
->
vtbl
->
GetStorageControllers
);
for
(
i
=
0
;
i
<
storageControllers
.
count
;
i
++
)
{
IStorageController
*
strCtl
=
storageControllers
.
items
[
i
];
PRUnichar
*
strCtlName
=
NULL
;
vboxArray
mediumAttachments
=
VBOX_ARRAY_INITIALIZER
;
if
(
!
strCtl
)
continue
;
strCtl
->
vtbl
->
GetName
(
strCtl
,
&
strCtlName
);
vboxArrayGetWithPtrArg
(
&
mediumAttachments
,
machine
,
machine
->
vtbl
->
GetMediumAttachmentsOfController
,
strCtlName
);
for
(
j
=
0
;
j
<
mediumAttachments
.
count
;
j
++
)
{
IMediumAttachment
*
medAtt
=
mediumAttachments
.
items
[
j
];
PRInt32
port
=
~
0U
;
PRInt32
device
=
~
0U
;
if
(
!
medAtt
)
continue
;
medAtt
->
vtbl
->
GetPort
(
medAtt
,
&
port
);
medAtt
->
vtbl
->
GetDevice
(
medAtt
,
&
device
);
if
((
port
!=
~
0U
)
&&
(
device
!=
~
0U
))
{
machine
->
vtbl
->
DetachDevice
(
machine
,
strCtlName
,
port
,
device
);
}
}
vboxArrayRelease
(
&
storageControllers
);
machine
->
vtbl
->
RemoveStorageController
(
machine
,
strCtlName
);
VBOX_UTF16_FREE
(
strCtlName
);
}
vboxArrayRelease
(
&
storageControllers
);
# endif
/* VBOX_API_VERSION >= 3001000 */
machine
->
vtbl
->
SaveSettings
(
machine
);
}
VBOX_SESSION_CLOSE
();
}
VBOX_UTF16_FREE
(
hddcnameUtf16
);
}
#endif
#if VBOX_API_VERSION < 4000000
rc
=
data
->
vboxObj
->
vtbl
->
UnregisterMachine
(
data
->
vboxObj
,
iid
.
value
,
&
machine
);
#else
/* VBOX_API_VERSION >= 4000000 */
rc
=
VBOX_OBJECT_GET_MACHINE
(
iid
.
value
,
&
machine
);
if
(
NS_FAILED
(
rc
))
{
virReportError
(
VIR_ERR_NO_DOMAIN
,
"%s"
,
_
(
"no domain with matching uuid"
));
return
-
1
;
}
/* We're not interested in the array returned by the Unregister method,
* but in the side effect of unregistering the virtual machine. In order
* to call the Unregister method correctly we need to use the vboxArray
* wrapper here. */
rc
=
vboxArrayGetWithUintArg
(
&
media
,
machine
,
machine
->
vtbl
->
Unregister
,
CleanupMode_DetachAllReturnNone
);
#endif
/* VBOX_API_VERSION >= 4000000 */
DEBUGIID
(
"UUID of machine being undefined"
,
iid
.
value
);
if
(
NS_SUCCEEDED
(
rc
))
{
#if VBOX_API_VERSION < 4000000
machine
->
vtbl
->
DeleteSettings
(
machine
);
#else
/* VBOX_API_VERSION >= 4000000 */
IProgress
*
progress
=
NULL
;
/* The IMachine Delete method takes an array of IMedium items to be
* deleted along with the virtual machine. We just want to pass an
* empty array. But instead of adding a full vboxArraySetWithReturn to
* the glue layer (in order to handle the required signature of the
* Delete method) we use a local solution here. */
# ifdef WIN32
SAFEARRAY
*
safeArray
=
NULL
;
typedef
HRESULT
__stdcall
(
*
IMachine_Delete
)(
IMachine
*
self
,
SAFEARRAY
**
media
,
IProgress
**
progress
);
# if VBOX_API_VERSION < 4003000
((
IMachine_Delete
)
machine
->
vtbl
->
Delete
)(
machine
,
&
safeArray
,
&
progress
);
# else
((
IMachine_Delete
)
machine
->
vtbl
->
DeleteConfig
)(
machine
,
&
safeArray
,
&
progress
);
# endif
# else
/* XPCOM doesn't like NULL as an array, even when the array size is 0.
* Instead pass it a dummy array to avoid passing NULL. */
IMedium
*
array
[]
=
{
NULL
};
# if VBOX_API_VERSION < 4003000
machine
->
vtbl
->
Delete
(
machine
,
0
,
array
,
&
progress
);
# else
machine
->
vtbl
->
DeleteConfig
(
machine
,
0
,
array
,
&
progress
);
# endif
# endif
if
(
progress
!=
NULL
)
{
progress
->
vtbl
->
WaitForCompletion
(
progress
,
-
1
);
VBOX_RELEASE
(
progress
);
}
#endif
/* VBOX_API_VERSION >= 4000000 */
ret
=
0
;
}
else
{
virReportError
(
VIR_ERR_INTERNAL_ERROR
,
_
(
"could not delete the domain, rc=%08x"
),
(
unsigned
)
rc
);
}
#if VBOX_API_VERSION >= 4000000
vboxArrayUnalloc
(
&
media
);
#endif
vboxIIDUnalloc
(
&
iid
);
VBOX_RELEASE
(
machine
);
return
ret
;
}
static
int
vboxDomainUndefine
(
virDomainPtr
dom
)
{
...
...
@@ -11012,6 +10836,154 @@ void _registerGlobalData(vboxGlobalData *data ATTRIBUTE_UNUSED)
#endif
/* VBOX_API_VERSION != 2002000 */
}
#if VBOX_API_VERSION < 4000000
# if VBOX_API_VERSION < 3001000
static
void
_detachDevices
(
vboxGlobalData
*
data
ATTRIBUTE_UNUSED
,
IMachine
*
machine
,
PRUnichar
*
hddcnameUtf16
)
{
/* Disconnect all the drives if present */
machine
->
vtbl
->
DetachHardDisk
(
machine
,
hddcnameUtf16
,
0
,
0
);
machine
->
vtbl
->
DetachHardDisk
(
machine
,
hddcnameUtf16
,
0
,
1
);
machine
->
vtbl
->
DetachHardDisk
(
machine
,
hddcnameUtf16
,
1
,
1
);
}
# else
/* VBOX_API_VERSION >= 3001000 */
static
void
_detachDevices
(
vboxGlobalData
*
data
,
IMachine
*
machine
,
PRUnichar
*
hddcnameUtf16
ATTRIBUTE_UNUSED
)
{
/* get all the controller first, then the attachments and
* remove them all so that the machine can be undefined
*/
vboxArray
storageControllers
=
VBOX_ARRAY_INITIALIZER
;
size_t
i
=
0
,
j
=
0
;
vboxArrayGet
(
&
storageControllers
,
machine
,
machine
->
vtbl
->
GetStorageControllers
);
for
(
i
=
0
;
i
<
storageControllers
.
count
;
i
++
)
{
IStorageController
*
strCtl
=
storageControllers
.
items
[
i
];
PRUnichar
*
strCtlName
=
NULL
;
vboxArray
mediumAttachments
=
VBOX_ARRAY_INITIALIZER
;
if
(
!
strCtl
)
continue
;
strCtl
->
vtbl
->
GetName
(
strCtl
,
&
strCtlName
);
vboxArrayGetWithPtrArg
(
&
mediumAttachments
,
machine
,
machine
->
vtbl
->
GetMediumAttachmentsOfController
,
strCtlName
);
for
(
j
=
0
;
j
<
mediumAttachments
.
count
;
j
++
)
{
IMediumAttachment
*
medAtt
=
mediumAttachments
.
items
[
j
];
PRInt32
port
=
~
0U
;
PRInt32
device
=
~
0U
;
if
(
!
medAtt
)
continue
;
medAtt
->
vtbl
->
GetPort
(
medAtt
,
&
port
);
medAtt
->
vtbl
->
GetDevice
(
medAtt
,
&
device
);
if
((
port
!=
~
0U
)
&&
(
device
!=
~
0U
))
{
machine
->
vtbl
->
DetachDevice
(
machine
,
strCtlName
,
port
,
device
);
}
}
vboxArrayRelease
(
&
storageControllers
);
machine
->
vtbl
->
RemoveStorageController
(
machine
,
strCtlName
);
VBOX_UTF16_FREE
(
strCtlName
);
}
vboxArrayRelease
(
&
storageControllers
);
}
# endif
/* VBOX_API_VERSION >= 3001000 */
static
nsresult
_unregisterMachine
(
vboxGlobalData
*
data
,
vboxIIDUnion
*
iidu
,
IMachine
**
machine
)
{
return
data
->
vboxObj
->
vtbl
->
UnregisterMachine
(
data
->
vboxObj
,
IID_MEMBER
(
value
),
machine
);
}
static
void
_deleteConfig
(
IMachine
*
machine
)
{
machine
->
vtbl
->
DeleteSettings
(
machine
);
}
#else
/* VBOX_API_VERSION >= 4000000 */
static
void
_detachDevices
(
vboxGlobalData
*
data
ATTRIBUTE_UNUSED
,
IMachine
*
machine
ATTRIBUTE_UNUSED
,
PRUnichar
*
hddcnameUtf16
ATTRIBUTE_UNUSED
)
{
vboxUnsupported
();
}
static
nsresult
_unregisterMachine
(
vboxGlobalData
*
data
,
vboxIIDUnion
*
iidu
,
IMachine
**
machine
)
{
nsresult
rc
;
vboxArray
media
=
VBOX_ARRAY_INITIALIZER
;
rc
=
VBOX_OBJECT_GET_MACHINE
(
IID_MEMBER
(
value
),
machine
);
if
(
NS_FAILED
(
rc
))
{
virReportError
(
VIR_ERR_NO_DOMAIN
,
"%s"
,
_
(
"no domain with matching uuid"
));
return
rc
;
}
/* We're not interested in the array returned by the Unregister method,
* but in the side effect of unregistering the virtual machine. In order
* to call the Unregister method correctly we need to use the vboxArray
* wrapper here. */
rc
=
vboxArrayGetWithUintArg
(
&
media
,
*
machine
,
(
*
machine
)
->
vtbl
->
Unregister
,
CleanupMode_DetachAllReturnNone
);
vboxArrayUnalloc
(
&
media
);
return
rc
;
}
static
void
_deleteConfig
(
IMachine
*
machine
)
{
IProgress
*
progress
=
NULL
;
/* The IMachine Delete method takes an array of IMedium items to be
* deleted along with the virtual machine. We just want to pass an
* empty array. But instead of adding a full vboxArraySetWithReturn to
* the glue layer (in order to handle the required signature of the
* Delete method) we use a local solution here. */
# ifdef WIN32
SAFEARRAY
*
safeArray
=
NULL
;
typedef
HRESULT
__stdcall
(
*
IMachine_Delete
)(
IMachine
*
self
,
SAFEARRAY
**
media
,
IProgress
**
progress
);
# if VBOX_API_VERSION < 4003000
((
IMachine_Delete
)
machine
->
vtbl
->
Delete
)(
machine
,
&
safeArray
,
&
progress
);
# else
((
IMachine_Delete
)
machine
->
vtbl
->
DeleteConfig
)(
machine
,
&
safeArray
,
&
progress
);
# endif
# else
/* XPCOM doesn't like NULL as an array, even when the array size is 0.
* Instead pass it a dummy array to avoid passing NULL. */
IMedium
*
array
[]
=
{
NULL
};
# if VBOX_API_VERSION < 4003000
machine
->
vtbl
->
Delete
(
machine
,
0
,
array
,
&
progress
);
# else
machine
->
vtbl
->
DeleteConfig
(
machine
,
0
,
array
,
&
progress
);
# endif
# endif
if
(
progress
!=
NULL
)
{
progress
->
vtbl
->
WaitForCompletion
(
progress
,
-
1
);
VBOX_RELEASE
(
progress
);
}
}
#endif
/* VBOX_API_VERSION >= 4000000 */
static
void
_pfnUninitialize
(
vboxGlobalData
*
data
)
{
if
(
data
->
pFuncs
)
...
...
@@ -11138,8 +11110,20 @@ _machineGetId(IMachine *machine, vboxIIDUnion *iidu)
return
machine
->
vtbl
->
GetId
(
machine
,
&
IID_MEMBER
(
value
));
}
static
nsresult
_machineSaveSettings
(
IMachine
*
machine
)
{
return
machine
->
vtbl
->
SaveSettings
(
machine
);
}
#if VBOX_API_VERSION < 4000000
static
nsresult
_sessionOpen
(
vboxGlobalData
*
data
,
vboxIIDUnion
*
iidu
,
IMachine
*
machine
ATTRIBUTE_UNUSED
)
{
return
data
->
vboxObj
->
vtbl
->
OpenSession
(
data
->
vboxObj
,
data
->
vboxSession
,
IID_MEMBER
(
value
));
}
static
nsresult
_sessionOpenExisting
(
vboxGlobalData
*
data
,
vboxIIDUnion
*
iidu
,
IMachine
*
machine
ATTRIBUTE_UNUSED
)
{
...
...
@@ -11154,6 +11138,12 @@ _sessionClose(ISession *session)
#else
/* VBOX_API_VERSION >= 4000000 */
static
nsresult
_sessionOpen
(
vboxGlobalData
*
data
,
vboxIIDUnion
*
iidu
ATTRIBUTE_UNUSED
,
IMachine
*
machine
)
{
return
machine
->
vtbl
->
LockMachine
(
machine
,
data
->
vboxSession
,
LockType_Write
);
}
static
nsresult
_sessionOpenExisting
(
vboxGlobalData
*
data
,
vboxIIDUnion
*
iidu
ATTRIBUTE_UNUSED
,
IMachine
*
machine
)
{
...
...
@@ -11174,6 +11164,12 @@ _sessionGetConsole(ISession *session, IConsole **console)
return
session
->
vtbl
->
GetConsole
(
session
,
console
);
}
static
nsresult
_sessionGetMachine
(
ISession
*
session
,
IMachine
**
machine
)
{
return
session
->
vtbl
->
GetMachine
(
session
,
machine
);
}
static
nsresult
_consoleSaveState
(
IConsole
*
console
,
IProgress
**
progress
)
{
...
...
@@ -11249,11 +11245,14 @@ static vboxUniformedIMachine _UIMachine = {
.
GetState
=
_machineGetState
,
.
GetName
=
_machineGetName
,
.
GetId
=
_machineGetId
,
.
SaveSettings
=
_machineSaveSettings
,
};
static
vboxUniformedISession
_UISession
=
{
.
Open
=
_sessionOpen
,
.
OpenExisting
=
_sessionOpenExisting
,
.
GetConsole
=
_sessionGetConsole
,
.
GetMachine
=
_sessionGetMachine
,
.
Close
=
_sessionClose
,
};
...
...
@@ -11280,6 +11279,9 @@ void NAME(InstallUniformedAPI)(vboxUniformedAPI *pVBoxAPI)
pVBoxAPI
->
XPCOMCVersion
=
VBOX_XPCOMC_VERSION
;
pVBoxAPI
->
initializeDomainEvent
=
_initializeDomainEvent
;
pVBoxAPI
->
registerGlobalData
=
_registerGlobalData
;
pVBoxAPI
->
detachDevices
=
_detachDevices
;
pVBoxAPI
->
unregisterMachine
=
_unregisterMachine
;
pVBoxAPI
->
deleteConfig
=
_deleteConfig
;
pVBoxAPI
->
UPFN
=
_UPFN
;
pVBoxAPI
->
UIID
=
_UIID
;
pVBoxAPI
->
UArray
=
_UArray
;
...
...
@@ -11307,8 +11309,10 @@ void NAME(InstallUniformedAPI)(vboxUniformedAPI *pVBoxAPI)
#if VBOX_API_VERSION >= 4000000
/* Get machine for the call to VBOX_SESSION_OPEN_EXISTING */
pVBoxAPI
->
getMachineForSession
=
1
;
pVBoxAPI
->
detachDevicesExplicitly
=
0
;
#else
/* VBOX_API_VERSION < 4000000 */
pVBoxAPI
->
getMachineForSession
=
0
;
pVBoxAPI
->
detachDevicesExplicitly
=
1
;
#endif
/* VBOX_API_VERSION < 4000000 */
}
...
...
src/vbox/vbox_uniformed_api.h
浏览文件 @
e60e8da4
...
...
@@ -188,12 +188,15 @@ typedef struct {
nsresult
(
*
GetState
)(
IMachine
*
machine
,
PRUint32
*
state
);
nsresult
(
*
GetName
)(
IMachine
*
machine
,
PRUnichar
**
name
);
nsresult
(
*
GetId
)(
IMachine
*
machine
,
vboxIIDUnion
*
iidu
);
nsresult
(
*
SaveSettings
)(
IMachine
*
machine
);
}
vboxUniformedIMachine
;
/* Functions for ISession */
typedef
struct
{
nsresult
(
*
Open
)(
vboxGlobalData
*
data
,
vboxIIDUnion
*
iidu
,
IMachine
*
machine
);
nsresult
(
*
OpenExisting
)(
vboxGlobalData
*
data
,
vboxIIDUnion
*
iidu
,
IMachine
*
machine
);
nsresult
(
*
GetConsole
)(
ISession
*
session
,
IConsole
**
console
);
nsresult
(
*
GetMachine
)(
ISession
*
session
,
IMachine
**
machine
);
nsresult
(
*
Close
)(
ISession
*
session
);
}
vboxUniformedISession
;
...
...
@@ -224,6 +227,9 @@ typedef struct {
/* vbox APIs */
int
(
*
initializeDomainEvent
)(
vboxGlobalData
*
data
);
void
(
*
registerGlobalData
)(
vboxGlobalData
*
data
);
void
(
*
detachDevices
)(
vboxGlobalData
*
data
,
IMachine
*
machine
,
PRUnichar
*
hddcnameUtf16
);
nsresult
(
*
unregisterMachine
)(
vboxGlobalData
*
data
,
vboxIIDUnion
*
iidu
,
IMachine
**
machine
);
void
(
*
deleteConfig
)(
IMachine
*
machine
);
vboxUniformedPFN
UPFN
;
vboxUniformedIID
UIID
;
vboxUniformedArray
UArray
;
...
...
@@ -239,6 +245,7 @@ typedef struct {
bool
domainEventCallbacks
;
bool
hasStaticGlobalData
;
bool
getMachineForSession
;
bool
detachDevicesExplicitly
;
}
vboxUniformedAPI
;
/* libvirt API
...
...
@@ -262,6 +269,7 @@ int vboxConnectNumOfDomains(virConnectPtr conn);
virDomainPtr
vboxDomainLookupByID
(
virConnectPtr
conn
,
int
id
);
virDomainPtr
vboxDomainLookupByUUID
(
virConnectPtr
conn
,
const
unsigned
char
*
uuid
);
int
vboxDomainUndefineFlags
(
virDomainPtr
dom
,
unsigned
int
flags
);
/* Version specified functions for installing uniformed API */
void
vbox22InstallUniformedAPI
(
vboxUniformedAPI
*
pVBoxAPI
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录