Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
libvirt
提交
d3ce7363
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,发现更多精彩内容 >>
提交
d3ce7363
编写于
6月 25, 2013
作者:
J
Jiri Denemark
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
qemu: Move internals of Begin phase to qemu_migration.c
上级
83b43717
变更
3
显示空白变更内容
内联
并排
Showing
3 changed file
with
89 addition
and
70 deletion
+89
-70
src/qemu/qemu_driver.c
src/qemu/qemu_driver.c
+5
-66
src/qemu/qemu_migration.c
src/qemu/qemu_migration.c
+83
-3
src/qemu/qemu_migration.h
src/qemu/qemu_migration.h
+1
-1
未找到文件。
src/qemu/qemu_driver.c
浏览文件 @
d3ce7363
...
...
@@ -10200,81 +10200,20 @@ qemuDomainMigrateBegin3(virDomainPtr domain,
const
char
*
dname
,
unsigned
long
resource
ATTRIBUTE_UNUSED
)
{
virQEMUDriverPtr
driver
=
domain
->
conn
->
privateData
;
virDomainObjPtr
vm
;
char
*
xml
=
NULL
;
enum
qemuDomainAsyncJob
asyncJob
;
virCheckFlags
(
QEMU_MIGRATION_FLAGS
,
NULL
);
if
(
!
(
vm
=
qemuDomObjFromDomain
(
domain
)))
return
NULL
;
if
(
virDomainMigrateBegin3EnsureACL
(
domain
->
conn
,
vm
->
def
)
<
0
)
goto
cleanup
;
if
((
flags
&
VIR_MIGRATE_CHANGE_PROTECTION
))
{
if
(
qemuMigrationJobStart
(
driver
,
vm
,
QEMU_ASYNC_JOB_MIGRATION_OUT
)
<
0
)
goto
cleanup
;
asyncJob
=
QEMU_ASYNC_JOB_MIGRATION_OUT
;
}
else
{
if
(
qemuDomainObjBeginJob
(
driver
,
vm
,
QEMU_JOB_MODIFY
)
<
0
)
goto
cleanup
;
asyncJob
=
QEMU_ASYNC_JOB_NONE
;
}
if
(
!
virDomainObjIsActive
(
vm
)
&&
!
(
flags
&
VIR_MIGRATE_OFFLINE
))
{
virReportError
(
VIR_ERR_OPERATION_INVALID
,
"%s"
,
_
(
"domain is not running"
));
goto
endjob
;
}
/* Check if there is any ejected media.
* We don't want to require them on the destination.
*/
if
(
!
(
flags
&
VIR_MIGRATE_OFFLINE
)
&&
qemuDomainCheckEjectableMedia
(
driver
,
vm
,
asyncJob
)
<
0
)
goto
endjob
;
if
(
!
(
xml
=
qemuMigrationBegin
(
driver
,
vm
,
xmlin
,
dname
,
cookieout
,
cookieoutlen
,
flags
)))
goto
endjob
;
if
((
flags
&
VIR_MIGRATE_CHANGE_PROTECTION
))
{
/* We keep the job active across API calls until the confirm() call.
* This prevents any other APIs being invoked while migration is taking
* place.
*/
if
(
virQEMUCloseCallbacksSet
(
driver
->
closeCallbacks
,
vm
,
domain
->
conn
,
qemuMigrationCleanup
)
<
0
)
goto
endjob
;
if
(
qemuMigrationJobContinue
(
vm
)
==
0
)
{
vm
=
NULL
;
virReportError
(
VIR_ERR_OPERATION_FAILED
,
"%s"
,
_
(
"domain disappeared"
));
VIR_FREE
(
xml
);
if
(
cookieout
)
VIR_FREE
(
*
cookieout
);
}
}
else
{
goto
endjob
;
}
cleanup:
if
(
vm
)
if
(
virDomainMigrateBegin3EnsureACL
(
domain
->
conn
,
vm
->
def
)
<
0
)
{
virObjectUnlock
(
vm
);
return
xml
;
endjob:
if
((
flags
&
VIR_MIGRATE_CHANGE_PROTECTION
))
{
if
(
qemuMigrationJobFinish
(
driver
,
vm
)
==
0
)
vm
=
NULL
;
}
else
{
if
(
qemuDomainObjEndJob
(
driver
,
vm
)
==
0
)
vm
=
NULL
;
return
NULL
;
}
goto
cleanup
;
return
qemuMigrationBegin
(
domain
->
conn
,
vm
,
xmlin
,
dname
,
cookieout
,
cookieoutlen
,
flags
);
}
static
int
...
...
src/qemu/qemu_migration.c
浏览文件 @
d3ce7363
...
...
@@ -39,6 +39,7 @@
#include "qemu_capabilities.h"
#include "qemu_command.h"
#include "qemu_cgroup.h"
#include "qemu_hotplug.h"
#include "domain_audit.h"
#include "virlog.h"
...
...
@@ -1923,8 +1924,10 @@ cleanup:
return
vm
;
}
/* The caller is supposed to lock the vm and start a migration job. */
char
*
qemuMigrationBegin
(
virQEMUDriverPtr
driver
,
static
char
*
qemuMigrationBeginPhase
(
virQEMUDriverPtr
driver
,
virDomainObjPtr
vm
,
const
char
*
xmlin
,
const
char
*
dname
,
...
...
@@ -2024,6 +2027,83 @@ cleanup:
return
rv
;
}
char
*
qemuMigrationBegin
(
virConnectPtr
conn
,
virDomainObjPtr
vm
,
const
char
*
xmlin
,
const
char
*
dname
,
char
**
cookieout
,
int
*
cookieoutlen
,
unsigned
long
flags
)
{
virQEMUDriverPtr
driver
=
conn
->
privateData
;
char
*
xml
=
NULL
;
enum
qemuDomainAsyncJob
asyncJob
;
if
((
flags
&
VIR_MIGRATE_CHANGE_PROTECTION
))
{
if
(
qemuMigrationJobStart
(
driver
,
vm
,
QEMU_ASYNC_JOB_MIGRATION_OUT
)
<
0
)
goto
cleanup
;
asyncJob
=
QEMU_ASYNC_JOB_MIGRATION_OUT
;
}
else
{
if
(
qemuDomainObjBeginJob
(
driver
,
vm
,
QEMU_JOB_MODIFY
)
<
0
)
goto
cleanup
;
asyncJob
=
QEMU_ASYNC_JOB_NONE
;
}
if
(
!
virDomainObjIsActive
(
vm
)
&&
!
(
flags
&
VIR_MIGRATE_OFFLINE
))
{
virReportError
(
VIR_ERR_OPERATION_INVALID
,
"%s"
,
_
(
"domain is not running"
));
goto
endjob
;
}
/* Check if there is any ejected media.
* We don't want to require them on the destination.
*/
if
(
!
(
flags
&
VIR_MIGRATE_OFFLINE
)
&&
qemuDomainCheckEjectableMedia
(
driver
,
vm
,
asyncJob
)
<
0
)
goto
endjob
;
if
(
!
(
xml
=
qemuMigrationBeginPhase
(
driver
,
vm
,
xmlin
,
dname
,
cookieout
,
cookieoutlen
,
flags
)))
goto
endjob
;
if
((
flags
&
VIR_MIGRATE_CHANGE_PROTECTION
))
{
/* We keep the job active across API calls until the confirm() call.
* This prevents any other APIs being invoked while migration is taking
* place.
*/
if
(
virQEMUCloseCallbacksSet
(
driver
->
closeCallbacks
,
vm
,
conn
,
qemuMigrationCleanup
)
<
0
)
goto
endjob
;
if
(
qemuMigrationJobContinue
(
vm
)
==
0
)
{
vm
=
NULL
;
virReportError
(
VIR_ERR_OPERATION_FAILED
,
"%s"
,
_
(
"domain disappeared"
));
VIR_FREE
(
xml
);
if
(
cookieout
)
VIR_FREE
(
*
cookieout
);
}
}
else
{
goto
endjob
;
}
cleanup:
if
(
vm
)
virObjectUnlock
(
vm
);
return
xml
;
endjob:
if
((
flags
&
VIR_MIGRATE_CHANGE_PROTECTION
))
{
if
(
qemuMigrationJobFinish
(
driver
,
vm
)
==
0
)
vm
=
NULL
;
}
else
{
if
(
qemuDomainObjEndJob
(
driver
,
vm
)
==
0
)
vm
=
NULL
;
}
goto
cleanup
;
}
/* Prepare is the first step, and it runs on the destination host.
*/
...
...
@@ -3341,7 +3421,7 @@ static int doPeer2PeerMigrate3(virQEMUDriverPtr driver,
* bit here, because we are already running inside the context of
* a single job. */
dom_xml
=
qemuMigrationBegin
(
driver
,
vm
,
xmlin
,
dname
,
dom_xml
=
qemuMigrationBegin
Phase
(
driver
,
vm
,
xmlin
,
dname
,
&
cookieout
,
&
cookieoutlen
,
flags
);
if
(
!
dom_xml
)
goto
cleanup
;
...
...
src/qemu/qemu_migration.h
浏览文件 @
d3ce7363
...
...
@@ -84,7 +84,7 @@ virDomainObjPtr qemuMigrationCleanup(virQEMUDriverPtr driver,
virDomainObjPtr
vm
,
virConnectPtr
conn
);
char
*
qemuMigrationBegin
(
vir
QEMUDriverPtr
driver
,
char
*
qemuMigrationBegin
(
vir
ConnectPtr
conn
,
virDomainObjPtr
vm
,
const
char
*
xmlin
,
const
char
*
dname
,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录