Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
libvirt
提交
890fa6a0
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看板
提交
890fa6a0
编写于
5月 13, 2015
作者:
J
Jiri Denemark
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add privateData to virDomainDiskDef
Signed-off-by:
N
Jiri Denemark
<
jdenemar@redhat.com
>
上级
3511c122
变更
10
隐藏空白更改
内联
并排
Showing
10 changed file
with
30 addition
and
22 deletion
+30
-22
src/conf/domain_conf.c
src/conf/domain_conf.c
+9
-5
src/conf/domain_conf.h
src/conf/domain_conf.h
+5
-1
src/parallels/parallels_sdk.c
src/parallels/parallels_sdk.c
+2
-2
src/qemu/qemu_command.c
src/qemu/qemu_command.c
+2
-2
src/vbox/vbox_common.c
src/vbox/vbox_common.c
+2
-2
src/vbox/vbox_tmpl.c
src/vbox/vbox_tmpl.c
+3
-3
src/vmx/vmx.c
src/vmx/vmx.c
+1
-1
src/xenconfig/xen_sxpr.c
src/xenconfig/xen_sxpr.c
+3
-3
src/xenconfig/xen_xl.c
src/xenconfig/xen_xl.c
+1
-1
src/xenconfig/xen_xm.c
src/xenconfig/xen_xm.c
+2
-2
未找到文件。
src/conf/domain_conf.c
浏览文件 @
890fa6a0
...
...
@@ -1275,7 +1275,7 @@ void virDomainLeaseDefFree(virDomainLeaseDefPtr def)
virDomainDiskDefPtr
virDomainDiskDefNew(v
oid
)
virDomainDiskDefNew(v
irDomainXMLOptionPtr xmlopt
)
{
virDomainDiskDefPtr ret;
...
...
@@ -1285,6 +1285,11 @@ virDomainDiskDefNew(void)
if (VIR_ALLOC(ret->src) < 0)
goto error;
if (xmlopt &&
xmlopt->privateData.diskNew &&
!(ret->privateData = xmlopt->privateData.diskNew()))
goto error;
if (virCondInit(&ret->blockJobSyncCond) < 0) {
virReportSystemError(errno, "%s", _("Failed to initialize condition"));
goto error;
...
...
@@ -1293,9 +1298,7 @@ virDomainDiskDefNew(void)
return ret;
error:
virStorageSourceFree(ret->src);
VIR_FREE(ret);
virDomainDiskDefFree(ret);
return NULL;
}
...
...
@@ -1315,6 +1318,7 @@ virDomainDiskDefFree(virDomainDiskDefPtr def)
VIR_FREE(def->product);
VIR_FREE(def->domain_name);
virDomainDeviceInfoClear(&def->info);
virObjectUnref(def->privateData);
virCondDestroy(&def->blockJobSyncCond);
VIR_FREE(def);
...
...
@@ -6121,7 +6125,7 @@ virDomainDiskDefParseXML(virDomainXMLOptionPtr xmlopt,
int auth_secret_usage = -1;
int ret = 0;
if (!(def = virDomainDiskDefNew()))
if (!(def = virDomainDiskDefNew(
xmlopt
)))
return NULL;
def->geometry.cylinders = 0;
...
...
src/conf/domain_conf.h
浏览文件 @
890fa6a0
...
...
@@ -683,6 +683,8 @@ typedef enum {
struct
_virDomainDiskDef
{
virStorageSourcePtr
src
;
/* non-NULL. XXX Allow NULL for empty cdrom? */
virObjectPtr
privateData
;
int
device
;
/* enum virDomainDiskDevice */
int
bus
;
/* enum virDomainDiskBus */
char
*
dst
;
...
...
@@ -2332,6 +2334,7 @@ typedef virDomainXMLOption *virDomainXMLOptionPtr;
typedef
void
*
(
*
virDomainXMLPrivateDataAllocFunc
)(
void
);
typedef
void
(
*
virDomainXMLPrivateDataFreeFunc
)(
void
*
);
typedef
virObjectPtr
(
*
virDomainXMLPrivateDataNewFunc
)(
void
);
typedef
int
(
*
virDomainXMLPrivateDataFormatFunc
)(
virBufferPtr
,
void
*
);
typedef
int
(
*
virDomainXMLPrivateDataParseFunc
)(
xmlXPathContextPtr
,
void
*
);
...
...
@@ -2368,6 +2371,7 @@ typedef virDomainXMLPrivateDataCallbacks *virDomainXMLPrivateDataCallbacksPtr;
struct
_virDomainXMLPrivateDataCallbacks
{
virDomainXMLPrivateDataAllocFunc
alloc
;
virDomainXMLPrivateDataFreeFunc
free
;
virDomainXMLPrivateDataNewFunc
diskNew
;
virDomainXMLPrivateDataFormatFunc
format
;
virDomainXMLPrivateDataParseFunc
parse
;
};
...
...
@@ -2420,7 +2424,7 @@ void virDomainPanicDefFree(virDomainPanicDefPtr panic);
void
virDomainResourceDefFree
(
virDomainResourceDefPtr
resource
);
void
virDomainGraphicsDefFree
(
virDomainGraphicsDefPtr
def
);
void
virDomainInputDefFree
(
virDomainInputDefPtr
def
);
virDomainDiskDefPtr
virDomainDiskDefNew
(
v
oid
);
virDomainDiskDefPtr
virDomainDiskDefNew
(
v
irDomainXMLOptionPtr
xmlopt
);
void
virDomainDiskDefFree
(
virDomainDiskDefPtr
def
);
void
virDomainLeaseDefFree
(
virDomainLeaseDefPtr
def
);
int
virDomainDiskGetType
(
virDomainDiskDefPtr
def
);
...
...
src/parallels/parallels_sdk.c
浏览文件 @
890fa6a0
...
...
@@ -621,7 +621,7 @@ prlsdkAddDomainHardDisksInfo(PRL_HANDLE sdkdom, virDomainDefPtr def)
PrlHandle_Free
(
hdd
);
hdd
=
PRL_INVALID_HANDLE
;
}
else
{
if
(
!
(
disk
=
virDomainDiskDefNew
()))
if
(
!
(
disk
=
virDomainDiskDefNew
(
NULL
)))
goto
error
;
if
(
prlsdkGetDiskInfo
(
hdd
,
disk
,
false
)
<
0
)
...
...
@@ -661,7 +661,7 @@ prlsdkAddDomainOpticalDisksInfo(PRL_HANDLE sdkdom, virDomainDefPtr def)
pret
=
PrlVmCfg_GetOpticalDisk
(
sdkdom
,
i
,
&
cdrom
);
prlsdkCheckRetGoto
(
pret
,
error
);
if
(
!
(
disk
=
virDomainDiskDefNew
()))
if
(
!
(
disk
=
virDomainDiskDefNew
(
NULL
)))
goto
error
;
if
(
prlsdkGetDiskInfo
(
cdrom
,
disk
,
true
)
<
0
)
...
...
src/qemu/qemu_command.c
浏览文件 @
890fa6a0
...
...
@@ -12566,7 +12566,7 @@ qemuParseCommandLine(virCapsPtr qemuCaps,
STRPREFIX
(
arg
,
"-fd"
)
||
STREQ
(
arg
,
"-cdrom"
))
{
WANT_VALUE
();
if
(
!
(
disk
=
virDomainDiskDefNew
()))
if
(
!
(
disk
=
virDomainDiskDefNew
(
xmlopt
)))
goto
error
;
if
(
STRPREFIX
(
val
,
"/dev/"
))
{
...
...
@@ -12868,7 +12868,7 @@ qemuParseCommandLine(virCapsPtr qemuCaps,
goto
error
;
}
}
else
if
(
STRPREFIX
(
val
,
"disk:"
))
{
if
(
!
(
disk
=
virDomainDiskDefNew
()))
if
(
!
(
disk
=
virDomainDiskDefNew
(
xmlopt
)))
goto
error
;
if
(
VIR_STRDUP
(
disk
->
src
->
path
,
val
+
strlen
(
"disk:"
))
<
0
)
goto
error
;
...
...
src/vbox/vbox_common.c
浏览文件 @
890fa6a0
...
...
@@ -3126,7 +3126,7 @@ vboxDumpIDEHDDsNew(virDomainDefPtr def, vboxGlobalData *data, IMachine *machine)
/* Allocate mem, if fails return error */
if
(
VIR_ALLOC_N
(
def
->
disks
,
def
->
ndisks
)
>=
0
)
{
for
(
i
=
0
;
i
<
def
->
ndisks
;
i
++
)
{
virDomainDiskDefPtr
disk
=
virDomainDiskDefNew
();
virDomainDiskDefPtr
disk
=
virDomainDiskDefNew
(
NULL
);
if
(
!
disk
)
{
error
=
true
;
break
;
...
...
@@ -5850,7 +5850,7 @@ int vboxSnapshotGetReadOnlyDisks(virDomainSnapshotPtr snapshot,
/* Allocate mem, if fails return error */
if
(
VIR_ALLOC_N
(
def
->
dom
->
disks
,
def
->
dom
->
ndisks
)
>=
0
)
{
for
(
i
=
0
;
i
<
def
->
dom
->
ndisks
;
i
++
)
{
virDomainDiskDefPtr
diskDef
=
virDomainDiskDefNew
();
virDomainDiskDefPtr
diskDef
=
virDomainDiskDefNew
(
NULL
);
if
(
!
diskDef
)
goto
cleanup
;
def
->
dom
->
disks
[
i
]
=
diskDef
;
...
...
src/vbox/vbox_tmpl.c
浏览文件 @
890fa6a0
...
...
@@ -2187,7 +2187,7 @@ _dumpIDEHDDsOld(virDomainDefPtr def,
if
((
def
->
ndisks
>
0
)
&&
(
VIR_ALLOC_N
(
def
->
disks
,
def
->
ndisks
)
>=
0
))
{
size_t
i
;
for
(
i
=
0
;
i
<
def
->
ndisks
;
i
++
)
{
if
((
def
->
disks
[
i
]
=
virDomainDiskDefNew
()))
{
if
((
def
->
disks
[
i
]
=
virDomainDiskDefNew
(
NULL
)))
{
def
->
disks
[
i
]
->
device
=
VIR_DOMAIN_DISK_DEVICE_DISK
;
def
->
disks
[
i
]
->
bus
=
VIR_DOMAIN_DISK_BUS_IDE
;
virDomainDiskSetType
(
def
->
disks
[
i
],
...
...
@@ -2295,7 +2295,7 @@ _dumpDVD(virDomainDefPtr def,
def
->
ndisks
++
;
if
(
VIR_REALLOC_N
(
def
->
disks
,
def
->
ndisks
)
>=
0
)
{
if
((
def
->
disks
[
def
->
ndisks
-
1
]
=
virDomainDiskDefNew
()))
{
if
((
def
->
disks
[
def
->
ndisks
-
1
]
=
virDomainDiskDefNew
(
NULL
)))
{
def
->
disks
[
def
->
ndisks
-
1
]
->
device
=
VIR_DOMAIN_DISK_DEVICE_CDROM
;
def
->
disks
[
def
->
ndisks
-
1
]
->
bus
=
VIR_DOMAIN_DISK_BUS_IDE
;
virDomainDiskSetType
(
def
->
disks
[
def
->
ndisks
-
1
],
...
...
@@ -2437,7 +2437,7 @@ _dumpFloppy(virDomainDefPtr def,
def
->
ndisks
++
;
if
(
VIR_REALLOC_N
(
def
->
disks
,
def
->
ndisks
)
>=
0
)
{
if
((
def
->
disks
[
def
->
ndisks
-
1
]
=
virDomainDiskDefNew
()))
{
if
((
def
->
disks
[
def
->
ndisks
-
1
]
=
virDomainDiskDefNew
(
NULL
)))
{
def
->
disks
[
def
->
ndisks
-
1
]
->
device
=
VIR_DOMAIN_DISK_DEVICE_FLOPPY
;
def
->
disks
[
def
->
ndisks
-
1
]
->
bus
=
VIR_DOMAIN_DISK_BUS_FDC
;
virDomainDiskSetType
(
def
->
disks
[
def
->
ndisks
-
1
],
...
...
src/vmx/vmx.c
浏览文件 @
890fa6a0
...
...
@@ -1980,7 +1980,7 @@ virVMXParseDisk(virVMXContext *ctx, virDomainXMLOptionPtr xmlopt, virConfPtr con
return
-
1
;
}
if
(
!
(
*
def
=
virDomainDiskDefNew
()))
if
(
!
(
*
def
=
virDomainDiskDefNew
(
xmlopt
)))
return
-
1
;
(
*
def
)
->
device
=
device
;
...
...
src/xenconfig/xen_sxpr.c
浏览文件 @
890fa6a0
...
...
@@ -372,7 +372,7 @@ xenParseSxprDisks(virDomainDefPtr def,
bootable
=
sexpr_node
(
node
,
"device/tap/bootable"
);
}
if
(
!
(
disk
=
virDomainDiskDefNew
()))
if
(
!
(
disk
=
virDomainDiskDefNew
(
NULL
)))
goto
error
;
if
(
dst
==
NULL
)
{
...
...
@@ -1316,7 +1316,7 @@ xenParseSxpr(const struct sexpr *root,
tmp
=
sexpr_node
(
root
,
"domain/image/hvm/cdrom"
);
if
((
tmp
!=
NULL
)
&&
(
tmp
[
0
]
!=
0
))
{
virDomainDiskDefPtr
disk
;
if
(
!
(
disk
=
virDomainDiskDefNew
()))
if
(
!
(
disk
=
virDomainDiskDefNew
(
NULL
)))
goto
error
;
if
(
virDomainDiskSetSource
(
disk
,
tmp
)
<
0
)
{
virDomainDiskDefFree
(
disk
);
...
...
@@ -1351,7 +1351,7 @@ xenParseSxpr(const struct sexpr *root,
tmp
=
sexpr_fmt_node
(
root
,
"domain/image/hvm/%s"
,
fds
[
i
]);
if
((
tmp
!=
NULL
)
&&
(
tmp
[
0
]
!=
0
))
{
virDomainDiskDefPtr
disk
;
if
(
!
(
disk
=
virDomainDiskDefNew
()))
if
(
!
(
disk
=
virDomainDiskDefNew
(
NULL
)))
goto
error
;
if
(
virDomainDiskSetSource
(
disk
,
tmp
)
<
0
)
{
virDomainDiskDefFree
(
disk
);
...
...
src/xenconfig/xen_xl.c
浏览文件 @
890fa6a0
...
...
@@ -286,7 +286,7 @@ xenParseXLDisk(virConfPtr conf, virDomainDefPtr def)
if
(
xlu_disk_parse
(
xluconf
,
1
,
&
disk_spec
,
libxldisk
))
goto
fail
;
if
(
!
(
disk
=
virDomainDiskDefNew
()))
if
(
!
(
disk
=
virDomainDiskDefNew
(
NULL
)))
goto
fail
;
if
(
VIR_STRDUP
(
disk
->
dst
,
libxldisk
->
vdev
)
<
0
)
...
...
src/xenconfig/xen_xm.c
浏览文件 @
890fa6a0
...
...
@@ -123,7 +123,7 @@ xenParseXMDisk(virConfPtr conf, virDomainDefPtr def, int xendConfigVersion)
goto
skipdisk
;
head
=
list
->
str
;
if
(
!
(
disk
=
virDomainDiskDefNew
()))
if
(
!
(
disk
=
virDomainDiskDefNew
(
NULL
)))
return
-
1
;
/*
...
...
@@ -275,7 +275,7 @@ xenParseXMDisk(virConfPtr conf, virDomainDefPtr def, int xendConfigVersion)
if
(
xenConfigGetString
(
conf
,
"cdrom"
,
&
str
,
NULL
)
<
0
)
goto
cleanup
;
if
(
str
)
{
if
(
!
(
disk
=
virDomainDiskDefNew
()))
if
(
!
(
disk
=
virDomainDiskDefNew
(
NULL
)))
goto
cleanup
;
virDomainDiskSetType
(
disk
,
VIR_STORAGE_TYPE_FILE
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录