Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
libvirt
提交
56ff156d
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,发现更多精彩内容 >>
提交
56ff156d
编写于
8月 21, 2013
作者:
C
Cole Robinson
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
qemu: snapshots: Simplify REDEFINE flag check
Makes things more readable IMO
上级
9881bfed
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
7 addition
and
7 deletion
+7
-7
src/qemu/qemu_driver.c
src/qemu/qemu_driver.c
+7
-7
未找到文件。
src/qemu/qemu_driver.c
浏览文件 @
56ff156d
...
@@ -12275,6 +12275,7 @@ qemuDomainSnapshotCreateXML(virDomainPtr domain,
...
@@ -12275,6 +12275,7 @@ qemuDomainSnapshotCreateXML(virDomainPtr domain,
char
uuidstr
[
VIR_UUID_STRING_BUFLEN
];
char
uuidstr
[
VIR_UUID_STRING_BUFLEN
];
virDomainSnapshotDefPtr
def
=
NULL
;
virDomainSnapshotDefPtr
def
=
NULL
;
bool
update_current
=
true
;
bool
update_current
=
true
;
bool
redefine
=
flags
&
VIR_DOMAIN_SNAPSHOT_CREATE_REDEFINE
;
unsigned
int
parse_flags
=
VIR_DOMAIN_SNAPSHOT_PARSE_DISKS
;
unsigned
int
parse_flags
=
VIR_DOMAIN_SNAPSHOT_PARSE_DISKS
;
virDomainSnapshotObjPtr
other
=
NULL
;
virDomainSnapshotObjPtr
other
=
NULL
;
int
align_location
=
VIR_DOMAIN_SNAPSHOT_LOCATION_INTERNAL
;
int
align_location
=
VIR_DOMAIN_SNAPSHOT_LOCATION_INTERNAL
;
...
@@ -12299,11 +12300,10 @@ qemuDomainSnapshotCreateXML(virDomainPtr domain,
...
@@ -12299,11 +12300,10 @@ qemuDomainSnapshotCreateXML(virDomainPtr domain,
return
NULL
;
return
NULL
;
}
}
if
(((
flags
&
VIR_DOMAIN_SNAPSHOT_CREATE_REDEFINE
)
&&
if
((
redefine
&&
!
(
flags
&
VIR_DOMAIN_SNAPSHOT_CREATE_CURRENT
))
||
!
(
flags
&
VIR_DOMAIN_SNAPSHOT_CREATE_CURRENT
))
||
(
flags
&
VIR_DOMAIN_SNAPSHOT_CREATE_NO_METADATA
))
(
flags
&
VIR_DOMAIN_SNAPSHOT_CREATE_NO_METADATA
))
update_current
=
false
;
update_current
=
false
;
if
(
flags
&
VIR_DOMAIN_SNAPSHOT_CREATE_REDEFINE
)
if
(
redefine
)
parse_flags
|=
VIR_DOMAIN_SNAPSHOT_PARSE_REDEFINE
;
parse_flags
|=
VIR_DOMAIN_SNAPSHOT_PARSE_REDEFINE
;
virUUIDFormat
(
domain
->
uuid
,
uuidstr
);
virUUIDFormat
(
domain
->
uuid
,
uuidstr
);
...
@@ -12368,14 +12368,14 @@ qemuDomainSnapshotCreateXML(virDomainPtr domain,
...
@@ -12368,14 +12368,14 @@ qemuDomainSnapshotCreateXML(virDomainPtr domain,
if
(
flags
&
VIR_DOMAIN_SNAPSHOT_CREATE_LIVE
&&
if
(
flags
&
VIR_DOMAIN_SNAPSHOT_CREATE_LIVE
&&
(
!
virDomainObjIsActive
(
vm
)
||
(
!
virDomainObjIsActive
(
vm
)
||
def
->
memory
!=
VIR_DOMAIN_SNAPSHOT_LOCATION_EXTERNAL
||
def
->
memory
!=
VIR_DOMAIN_SNAPSHOT_LOCATION_EXTERNAL
||
flags
&
VIR_DOMAIN_SNAPSHOT_CREATE_REDEFINE
))
{
redefine
))
{
virReportError
(
VIR_ERR_OPERATION_UNSUPPORTED
,
"%s"
,
virReportError
(
VIR_ERR_OPERATION_UNSUPPORTED
,
"%s"
,
_
(
"live snapshot creation is supported only "
_
(
"live snapshot creation is supported only "
"with external checkpoints"
));
"with external checkpoints"
));
goto
cleanup
;
goto
cleanup
;
}
}
if
(
flags
&
VIR_DOMAIN_SNAPSHOT_CREATE_REDEFINE
)
{
if
(
redefine
)
{
/* Prevent circular chains */
/* Prevent circular chains */
if
(
def
->
parent
)
{
if
(
def
->
parent
)
{
if
(
STREQ
(
def
->
name
,
def
->
parent
))
{
if
(
STREQ
(
def
->
name
,
def
->
parent
))
{
...
@@ -12546,7 +12546,7 @@ qemuDomainSnapshotCreateXML(virDomainPtr domain,
...
@@ -12546,7 +12546,7 @@ qemuDomainSnapshotCreateXML(virDomainPtr domain,
if
(
update_current
)
if
(
update_current
)
snap
->
def
->
current
=
true
;
snap
->
def
->
current
=
true
;
if
(
vm
->
current_snapshot
)
{
if
(
vm
->
current_snapshot
)
{
if
(
!
(
flags
&
VIR_DOMAIN_SNAPSHOT_CREATE_REDEFINE
)
&&
if
(
!
redefine
&&
VIR_STRDUP
(
snap
->
def
->
parent
,
vm
->
current_snapshot
->
def
->
name
)
<
0
)
VIR_STRDUP
(
snap
->
def
->
parent
,
vm
->
current_snapshot
->
def
->
name
)
<
0
)
goto
cleanup
;
goto
cleanup
;
if
(
update_current
)
{
if
(
update_current
)
{
...
@@ -12559,7 +12559,7 @@ qemuDomainSnapshotCreateXML(virDomainPtr domain,
...
@@ -12559,7 +12559,7 @@ qemuDomainSnapshotCreateXML(virDomainPtr domain,
}
}
/* actually do the snapshot */
/* actually do the snapshot */
if
(
flags
&
VIR_DOMAIN_SNAPSHOT_CREATE_REDEFINE
)
{
if
(
redefine
)
{
/* XXX Should we validate that the redefined snapshot even
/* XXX Should we validate that the redefined snapshot even
* makes sense, such as checking that qemu-img recognizes the
* makes sense, such as checking that qemu-img recognizes the
* snapshot name in at least one of the domain's disks? */
* snapshot name in at least one of the domain's disks? */
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录