Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
libvirt
提交
51d1a29d
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,发现更多精彩内容 >>
提交
51d1a29d
编写于
8月 11, 2014
作者:
T
Taowei
提交者:
Michal Privoznik
8月 15, 2014
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
vbox: Add API for vboxDomainSnapshotCreateXML
上级
2ad7b494
变更
3
显示空白变更内容
内联
并排
Showing
3 changed file
with
187 addition
and
2 deletion
+187
-2
src/vbox/vbox_common.h
src/vbox/vbox_common.h
+1
-0
src/vbox/vbox_tmpl.c
src/vbox/vbox_tmpl.c
+169
-2
src/vbox/vbox_uniformed_api.h
src/vbox/vbox_uniformed_api.h
+17
-0
未找到文件。
src/vbox/vbox_common.h
浏览文件 @
51d1a29d
...
...
@@ -269,5 +269,6 @@ typedef nsISupports IMedium;
typedef
nsISupports
IMediumAttachment
;
typedef
nsISupports
IStorageController
;
typedef
nsISupports
ISharedFolder
;
typedef
nsISupports
ISnapshot
;
#endif
/* VBOX_COMMON_H */
src/vbox/vbox_tmpl.c
浏览文件 @
51d1a29d
...
...
@@ -666,7 +666,6 @@ _vboxIIDFromArrayItem(vboxGlobalData *data, vboxIIDUnion *iidu,
vboxIIDFromArrayItem_v3_x
(
data
,
&
iidu
->
vboxIID_v3_x
,
array
,
idx
);
}
# define vboxIIDUnalloc(iid) vboxIIDUnalloc_v3_x(data, iid)
# define vboxIIDToUUID(iid, uuid) vboxIIDToUUID_v3_x(data, iid, uuid)
# define vboxIIDFromUUID(iid, uuid) vboxIIDFromUUID_v3_x(data, iid, uuid)
...
...
@@ -677,7 +676,6 @@ _vboxIIDFromArrayItem(vboxGlobalData *data, vboxIIDUnion *iidu,
#endif
/* !(VBOX_API_VERSION == 2002000) */
/**
* function to generate the name for medium,
* for e.g: hda, sda, etc
...
...
@@ -7786,6 +7784,18 @@ static void _DEBUGIID(const char *msg, vboxIIDUnion *iidu)
#endif
/* VBOX_API_VERSION != 2002000 */
static
void
_vboxIIDToUtf8
(
vboxGlobalData
*
data
ATTRIBUTE_UNUSED
,
vboxIIDUnion
*
iidu
ATTRIBUTE_UNUSED
,
char
**
utf8
ATTRIBUTE_UNUSED
)
{
#if VBOX_API_VERSION == 2002000
vboxUnsupported
();
#else
/* !(VBOX_API_VERSION == 2002000) */
data
->
pFuncs
->
pfnUtf16ToUtf8
(
IID_MEMBER
(
value
),
utf8
);
#endif
/* !(VBOX_API_VERSION == 2002000) */
}
static
void
*
_handleGetMachines
(
IVirtualBox
*
vboxObj
)
{
return
vboxObj
->
vtbl
->
GetMachines
;
...
...
@@ -7839,6 +7849,12 @@ _virtualboxGetMachine(IVirtualBox *vboxObj, vboxIIDUnion *iidu, IMachine **machi
#endif
/* VBOX_API_VERSION >= 4000000 */
static
nsresult
_virtualboxOpenMachine
(
IVirtualBox
*
vboxObj
,
PRUnichar
*
settingsFile
,
IMachine
**
machine
)
{
return
vboxObj
->
vtbl
->
OpenMachine
(
vboxObj
,
settingsFile
,
machine
);
}
static
nsresult
_virtualboxGetSystemProperties
(
IVirtualBox
*
vboxObj
,
ISystemProperties
**
systemProperties
)
{
...
...
@@ -7909,6 +7925,20 @@ _virtualboxCreateMachine(vboxGlobalData *data, virDomainDefPtr def, IMachine **m
return
rc
;
}
static
nsresult
_virtualboxCreateHardDiskMedium
(
IVirtualBox
*
vboxObj
ATTRIBUTE_UNUSED
,
PRUnichar
*
format
ATTRIBUTE_UNUSED
,
PRUnichar
*
location
ATTRIBUTE_UNUSED
,
IMedium
**
medium
ATTRIBUTE_UNUSED
)
{
#if VBOX_API_VERSION < 3001000
vboxUnsupported
();
return
0
;
#else
/* VBOX_API_VERSION >= 3001000 */
return
vboxObj
->
vtbl
->
CreateHardDisk
(
vboxObj
,
format
,
location
,
medium
);
#endif
/* VBOX_API_VERSION >= 3001000 */
}
static
nsresult
_virtualboxRegisterMachine
(
IVirtualBox
*
vboxObj
,
IMachine
*
machine
)
{
...
...
@@ -8032,6 +8062,20 @@ _machineLaunchVMProcess(vboxGlobalData *data,
#endif
/* VBOX_API_VERSION >= 4000000 */
}
static
nsresult
_machineUnregister
(
IMachine
*
machine
ATTRIBUTE_UNUSED
,
PRUint32
cleanupMode
ATTRIBUTE_UNUSED
,
PRUint32
*
aMediaSize
ATTRIBUTE_UNUSED
,
IMedium
***
aMedia
ATTRIBUTE_UNUSED
)
{
#if VBOX_API_VERSION < 4000000
vboxUnsupported
();
return
0
;
#else
/* VBOX_API_VERSION >= 4000000 */
return
machine
->
vtbl
->
Unregister
(
machine
,
cleanupMode
,
aMediaSize
,
aMedia
);
#endif
/* VBOX_API_VERSION >= 4000000 */
}
static
nsresult
_machineGetAccessible
(
IMachine
*
machine
,
PRBool
*
isAccessible
)
{
...
...
@@ -8117,6 +8161,18 @@ _machineGetUSBCommon(IMachine *machine, IUSBCommon **USBCommon)
#endif
}
static
nsresult
_machineGetCurrentSnapshot
(
IMachine
*
machine
,
ISnapshot
**
currentSnapshot
)
{
return
machine
->
vtbl
->
GetCurrentSnapshot
(
machine
,
currentSnapshot
);
}
static
nsresult
_machineGetSettingsFilePath
(
IMachine
*
machine
,
PRUnichar
**
settingsFilePath
)
{
return
machine
->
vtbl
->
GetSettingsFilePath
(
machine
,
settingsFilePath
);
}
static
nsresult
_machineGetCPUCount
(
IMachine
*
machine
,
PRUint32
*
CPUCount
)
{
...
...
@@ -8356,6 +8412,13 @@ _consoleReset(IConsole *console)
return
console
->
vtbl
->
Reset
(
console
);
}
static
nsresult
_consoleTakeSnapshot
(
IConsole
*
console
,
PRUnichar
*
name
,
PRUnichar
*
description
,
IProgress
**
progress
)
{
return
console
->
vtbl
->
TakeSnapshot
(
console
,
name
,
description
,
progress
);
}
static
nsresult
_progressWaitForCompletion
(
IProgress
*
progress
,
PRInt32
timeout
)
{
...
...
@@ -9012,10 +9075,74 @@ static nsresult _mediumGetReadOnly(IMedium *medium ATTRIBUTE_UNUSED,
#endif
/* VBOX_API_VERSION >= 3001000 */
}
#if VBOX_API_VERSION < 3001000
static
nsresult
_mediumGetParent
(
IMedium
*
medium
ATTRIBUTE_UNUSED
,
IMedium
**
parent
ATTRIBUTE_UNUSED
)
{
vboxUnsupported
();
return
0
;
}
static
nsresult
_mediumGetChildren
(
IMedium
*
medium
ATTRIBUTE_UNUSED
,
PRUint32
*
childrenSize
ATTRIBUTE_UNUSED
,
IMedium
***
children
ATTRIBUTE_UNUSED
)
{
vboxUnsupported
();
return
0
;
}
static
nsresult
_mediumGetFormat
(
IMedium
*
medium
ATTRIBUTE_UNUSED
,
PRUnichar
**
format
ATTRIBUTE_UNUSED
)
{
vboxUnsupported
();
return
0
;
}
static
nsresult
_mediumDeleteStorage
(
IMedium
*
medium
ATTRIBUTE_UNUSED
,
IProgress
**
progress
ATTRIBUTE_UNUSED
)
{
vboxUnsupported
();
return
0
;
}
#else
/* VBOX_API_VERSION >= 3001000 */
static
nsresult
_mediumGetParent
(
IMedium
*
medium
,
IMedium
**
parent
)
{
return
medium
->
vtbl
->
GetParent
(
medium
,
parent
);
}
static
nsresult
_mediumGetChildren
(
IMedium
*
medium
,
PRUint32
*
childrenSize
,
IMedium
***
children
)
{
return
medium
->
vtbl
->
GetChildren
(
medium
,
childrenSize
,
children
);
}
static
nsresult
_mediumGetFormat
(
IMedium
*
medium
,
PRUnichar
**
format
)
{
return
medium
->
vtbl
->
GetFormat
(
medium
,
format
);
}
static
nsresult
_mediumDeleteStorage
(
IMedium
*
medium
,
IProgress
**
progress
)
{
return
medium
->
vtbl
->
DeleteStorage
(
medium
,
progress
);
}
#endif
/* VBOX_API_VERSION >= 3001000 */
static
nsresult
_mediumRelease
(
IMedium
*
medium
)
{
return
medium
->
vtbl
->
nsisupports
.
Release
((
nsISupports
*
)
medium
);
}
static
nsresult
_mediumClose
(
IMedium
*
medium
)
{
return
medium
->
vtbl
->
Close
(
medium
);
}
static
nsresult
_mediumSetType
(
IMedium
*
medium
ATTRIBUTE_UNUSED
,
PRUint32
type
ATTRIBUTE_UNUSED
)
...
...
@@ -9028,6 +9155,27 @@ static nsresult _mediumSetType(IMedium *medium ATTRIBUTE_UNUSED,
#endif
}
static
nsresult
_mediumCreateDiffStorage
(
IMedium
*
medium
ATTRIBUTE_UNUSED
,
IMedium
*
target
ATTRIBUTE_UNUSED
,
PRUint32
variantSize
ATTRIBUTE_UNUSED
,
PRUint32
*
variant
ATTRIBUTE_UNUSED
,
IProgress
**
progress
ATTRIBUTE_UNUSED
)
{
#if VBOX_API_VERSION < 3001000
vboxUnsupported
();
return
0
;
#elif VBOX_API_VERSION < 4003000
if
(
variantSize
==
0
)
return
0
;
if
(
variantSize
>
1
)
VIR_WARN
(
"Only one variant is avaible in current version"
);
return
medium
->
vtbl
->
CreateDiffStorage
(
medium
,
target
,
variant
[
0
],
progress
);
#else
/* VBOX_API_VERSION >= 4003000 */
return
medium
->
vtbl
->
CreateDiffStorage
(
medium
,
target
,
variantSize
,
variant
,
progress
);
#endif
/* VBOX_API_VERSION >= 4003000 */
}
static
nsresult
_mediumAttachmentGetMedium
(
IMediumAttachment
*
mediumAttachment
ATTRIBUTE_UNUSED
,
IMedium
**
medium
ATTRIBUTE_UNUSED
)
...
...
@@ -9146,6 +9294,7 @@ static vboxUniformedIID _UIID = {
.
vboxIIDFromUUID
=
_vboxIIDFromUUID
,
.
vboxIIDIsEqual
=
_vboxIIDIsEqual
,
.
vboxIIDFromArrayItem
=
_vboxIIDFromArrayItem
,
.
vboxIIDToUtf8
=
_vboxIIDToUtf8
,
.
DEBUGIID
=
_DEBUGIID
,
};
...
...
@@ -9165,8 +9314,10 @@ static vboxUniformednsISupports _nsUISupports = {
static
vboxUniformedIVirtualBox
_UIVirtualBox
=
{
.
GetVersion
=
_virtualboxGetVersion
,
.
GetMachine
=
_virtualboxGetMachine
,
.
OpenMachine
=
_virtualboxOpenMachine
,
.
GetSystemProperties
=
_virtualboxGetSystemProperties
,
.
CreateMachine
=
_virtualboxCreateMachine
,
.
CreateHardDiskMedium
=
_virtualboxCreateHardDiskMedium
,
.
RegisterMachine
=
_virtualboxRegisterMachine
,
.
FindMedium
=
_virtualboxFindMedium
,
.
OpenMedium
=
_virtualboxOpenMedium
,
...
...
@@ -9179,6 +9330,7 @@ static vboxUniformedIMachine _UIMachine = {
.
CreateSharedFolder
=
_machineCreateSharedFolder
,
.
RemoveSharedFolder
=
_machineRemoveSharedFolder
,
.
LaunchVMProcess
=
_machineLaunchVMProcess
,
.
Unregister
=
_machineUnregister
,
.
GetAccessible
=
_machineGetAccessible
,
.
GetState
=
_machineGetState
,
.
GetName
=
_machineGetName
,
...
...
@@ -9191,6 +9343,8 @@ static vboxUniformedIMachine _UIMachine = {
.
GetParallelPort
=
_machineGetParallelPort
,
.
GetVRDxServer
=
_machineGetVRDxServer
,
.
GetUSBCommon
=
_machineGetUSBCommon
,
.
GetCurrentSnapshot
=
_machineGetCurrentSnapshot
,
.
GetSettingsFilePath
=
_machineGetSettingsFilePath
,
.
GetCPUCount
=
_machineGetCPUCount
,
.
SetCPUCount
=
_machineSetCPUCount
,
.
GetMemorySize
=
_machineGetMemorySize
,
...
...
@@ -9227,6 +9381,7 @@ static vboxUniformedIConsole _UIConsole = {
.
PowerButton
=
_consolePowerButton
,
.
PowerDown
=
_consolePowerDown
,
.
Reset
=
_consoleReset
,
.
TakeSnapshot
=
_consoleTakeSnapshot
,
};
static
vboxUniformedIProgress
_UIProgress
=
{
...
...
@@ -9337,8 +9492,14 @@ static vboxUniformedIMedium _UIMedium = {
.
GetId
=
_mediumGetId
,
.
GetLocation
=
_mediumGetLocation
,
.
GetReadOnly
=
_mediumGetReadOnly
,
.
GetParent
=
_mediumGetParent
,
.
GetChildren
=
_mediumGetChildren
,
.
GetFormat
=
_mediumGetFormat
,
.
DeleteStorage
=
_mediumDeleteStorage
,
.
Release
=
_mediumRelease
,
.
Close
=
_mediumClose
,
.
SetType
=
_mediumSetType
,
.
CreateDiffStorage
=
_mediumCreateDiffStorage
,
};
static
vboxUniformedIMediumAttachment
_UIMediumAttachment
=
{
...
...
@@ -9446,6 +9607,12 @@ void NAME(InstallUniformedAPI)(vboxUniformedAPI *pVBoxAPI)
pVBoxAPI
->
accelerate2DVideo
=
0
;
pVBoxAPI
->
oldMediumInterface
=
1
;
#endif
/* VBOX_API_VERSION < 3001000 */
#if VBOX_API_VERSION >= 4002000
pVBoxAPI
->
vboxSnapshotRedefine
=
1
;
#else
/* VBOX_API_VERSION < 4002000 */
pVBoxAPI
->
vboxSnapshotRedefine
=
0
;
#endif
/* VBOX_API_VERSION < 4002000 */
}
/**
...
...
src/vbox/vbox_uniformed_api.h
浏览文件 @
51d1a29d
...
...
@@ -159,6 +159,7 @@ typedef struct {
void
(
*
vboxIIDFromUUID
)(
vboxGlobalData
*
data
,
vboxIIDUnion
*
iidu
,
const
unsigned
char
*
uuid
);
bool
(
*
vboxIIDIsEqual
)(
vboxGlobalData
*
data
,
vboxIIDUnion
*
iidu1
,
vboxIIDUnion
*
iidu2
);
void
(
*
vboxIIDFromArrayItem
)(
vboxGlobalData
*
data
,
vboxIIDUnion
*
iidu
,
vboxArray
*
array
,
int
idx
);
void
(
*
vboxIIDToUtf8
)(
vboxGlobalData
*
data
,
vboxIIDUnion
*
iidu
,
char
**
utf8
);
void
(
*
DEBUGIID
)(
const
char
*
msg
,
vboxIIDUnion
*
iidu
);
}
vboxUniformedIID
;
...
...
@@ -182,8 +183,10 @@ typedef struct {
typedef
struct
{
nsresult
(
*
GetVersion
)(
IVirtualBox
*
vboxObj
,
PRUnichar
**
versionUtf16
);
nsresult
(
*
GetMachine
)(
IVirtualBox
*
vboxObj
,
vboxIIDUnion
*
iidu
,
IMachine
**
machine
);
nsresult
(
*
OpenMachine
)(
IVirtualBox
*
vboxObj
,
PRUnichar
*
settingsFile
,
IMachine
**
machine
);
nsresult
(
*
GetSystemProperties
)(
IVirtualBox
*
vboxObj
,
ISystemProperties
**
systemProperties
);
nsresult
(
*
CreateMachine
)(
vboxGlobalData
*
data
,
virDomainDefPtr
def
,
IMachine
**
machine
,
char
*
uuidstr
);
nsresult
(
*
CreateHardDiskMedium
)(
IVirtualBox
*
vboxObj
,
PRUnichar
*
format
,
PRUnichar
*
location
,
IMedium
**
medium
);
nsresult
(
*
RegisterMachine
)(
IVirtualBox
*
vboxObj
,
IMachine
*
machine
);
nsresult
(
*
FindMedium
)(
IVirtualBox
*
vboxObj
,
PRUnichar
*
location
,
PRUint32
deviceType
,
PRUint32
accessMode
,
IMedium
**
medium
);
nsresult
(
*
OpenMedium
)(
IVirtualBox
*
vboxObj
,
PRUnichar
*
location
,
PRUint32
deviceType
,
PRUint32
accessMode
,
IMedium
**
medium
);
...
...
@@ -206,6 +209,8 @@ typedef struct {
vboxIIDUnion
*
iidu
,
PRUnichar
*
sessionType
,
PRUnichar
*
env
,
IProgress
**
progress
);
nsresult
(
*
Unregister
)(
IMachine
*
machine
,
PRUint32
cleanupMode
,
PRUint32
*
aMediaSize
,
IMedium
***
aMedia
);
nsresult
(
*
GetAccessible
)(
IMachine
*
machine
,
PRBool
*
isAccessible
);
nsresult
(
*
GetState
)(
IMachine
*
machine
,
PRUint32
*
state
);
nsresult
(
*
GetName
)(
IMachine
*
machine
,
PRUnichar
**
name
);
...
...
@@ -218,6 +223,8 @@ typedef struct {
nsresult
(
*
GetParallelPort
)(
IMachine
*
machine
,
PRUint32
slot
,
IParallelPort
**
port
);
nsresult
(
*
GetVRDxServer
)(
IMachine
*
machine
,
IVRDxServer
**
VRDxServer
);
nsresult
(
*
GetUSBCommon
)(
IMachine
*
machine
,
IUSBCommon
**
USBCommon
);
nsresult
(
*
GetCurrentSnapshot
)(
IMachine
*
machine
,
ISnapshot
**
currentSnapshot
);
nsresult
(
*
GetSettingsFilePath
)(
IMachine
*
machine
,
PRUnichar
**
settingsFilePath
);
nsresult
(
*
GetCPUCount
)(
IMachine
*
machine
,
PRUint32
*
CPUCount
);
nsresult
(
*
SetCPUCount
)(
IMachine
*
machine
,
PRUint32
CPUCount
);
nsresult
(
*
GetMemorySize
)(
IMachine
*
machine
,
PRUint32
*
memorySize
);
...
...
@@ -256,6 +263,8 @@ typedef struct {
nsresult
(
*
PowerButton
)(
IConsole
*
console
);
nsresult
(
*
PowerDown
)(
IConsole
*
console
);
nsresult
(
*
Reset
)(
IConsole
*
console
);
nsresult
(
*
TakeSnapshot
)(
IConsole
*
console
,
PRUnichar
*
name
,
PRUnichar
*
description
,
IProgress
**
progress
);
}
vboxUniformedIConsole
;
/* Functions for IProgress */
...
...
@@ -385,8 +394,15 @@ typedef struct {
nsresult
(
*
GetId
)(
IMedium
*
medium
,
vboxIIDUnion
*
iidu
);
nsresult
(
*
GetLocation
)(
IMedium
*
medium
,
PRUnichar
**
location
);
nsresult
(
*
GetReadOnly
)(
IMedium
*
medium
,
PRBool
*
readOnly
);
nsresult
(
*
GetParent
)(
IMedium
*
medium
,
IMedium
**
parent
);
nsresult
(
*
GetChildren
)(
IMedium
*
medium
,
PRUint32
*
childrenSize
,
IMedium
***
children
);
nsresult
(
*
GetFormat
)(
IMedium
*
medium
,
PRUnichar
**
format
);
nsresult
(
*
DeleteStorage
)(
IMedium
*
medium
,
IProgress
**
progress
);
nsresult
(
*
Release
)(
IMedium
*
medium
);
nsresult
(
*
Close
)(
IMedium
*
medium
);
nsresult
(
*
SetType
)(
IMedium
*
medium
,
PRUint32
type
);
nsresult
(
*
CreateDiffStorage
)(
IMedium
*
medium
,
IMedium
*
target
,
PRUint32
variantSize
,
PRUint32
*
variant
,
IProgress
**
progress
);
}
vboxUniformedIMedium
;
/* Functions for IMediumAttachment */
...
...
@@ -471,6 +487,7 @@ typedef struct {
bool
accelerate2DVideo
;
bool
vboxAttachDrivesUseOld
;
bool
oldMediumInterface
;
bool
vboxSnapshotRedefine
;
}
vboxUniformedAPI
;
/* libvirt API
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录