Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
libvirt
提交
bdb6578a
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看板
提交
bdb6578a
编写于
6月 17, 2013
作者:
J
Jiri Denemark
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
virsh: Use extensible migration APIs
上级
6f4c6af6
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
54 addition
and
23 deletion
+54
-23
tools/virsh-domain.c
tools/virsh-domain.c
+54
-23
未找到文件。
tools/virsh-domain.c
浏览文件 @
bdb6578a
...
...
@@ -8345,15 +8345,15 @@ doMigrate(void *opaque)
char
ret
=
'1'
;
virDomainPtr
dom
=
NULL
;
const
char
*
desturi
=
NULL
;
const
char
*
migrateuri
=
NULL
;
const
char
*
dname
=
NULL
;
const
char
*
opt
=
NULL
;
unsigned
int
flags
=
0
;
vshCtrlData
*
data
=
opaque
;
vshControl
*
ctl
=
data
->
ctl
;
const
vshCmd
*
cmd
=
data
->
cmd
;
const
char
*
xmlfile
=
NULL
;
char
*
xml
=
NULL
;
sigset_t
sigmask
,
oldsigmask
;
virTypedParameterPtr
params
=
NULL
;
int
nparams
=
0
;
int
maxparams
=
0
;
sigemptyset
(
&
sigmask
);
sigaddset
(
&
sigmask
,
SIGINT
);
...
...
@@ -8363,12 +8363,41 @@ doMigrate(void *opaque)
if
(
!
(
dom
=
vshCommandOptDomain
(
ctl
,
cmd
,
NULL
)))
goto
out
;
if
(
vshCommandOptStringReq
(
ctl
,
cmd
,
"desturi"
,
&
desturi
)
<
0
||
vshCommandOptStringReq
(
ctl
,
cmd
,
"migrateuri"
,
&
migrateuri
)
<
0
||
vshCommandOptStringReq
(
ctl
,
cmd
,
"dname"
,
&
dname
)
<
0
||
vshCommandOptStringReq
(
ctl
,
cmd
,
"xml"
,
&
xmlfile
)
<
0
)
if
(
vshCommandOptStringReq
(
ctl
,
cmd
,
"desturi"
,
&
desturi
)
<
0
)
goto
out
;
if
(
vshCommandOptStringReq
(
ctl
,
cmd
,
"migrateuri"
,
&
opt
)
<
0
)
goto
out
;
if
(
opt
&&
virTypedParamsAddString
(
&
params
,
&
nparams
,
&
maxparams
,
VIR_MIGRATE_PARAM_URI
,
opt
)
<
0
)
goto
save_error
;
if
(
vshCommandOptStringReq
(
ctl
,
cmd
,
"dname"
,
&
opt
)
<
0
)
goto
out
;
if
(
opt
&&
virTypedParamsAddString
(
&
params
,
&
nparams
,
&
maxparams
,
VIR_MIGRATE_PARAM_DEST_NAME
,
opt
)
<
0
)
goto
save_error
;
if
(
vshCommandOptStringReq
(
ctl
,
cmd
,
"xml"
,
&
opt
)
<
0
)
goto
out
;
if
(
opt
)
{
char
*
xml
;
if
(
virFileReadAll
(
opt
,
1024
*
1024
,
&
xml
)
<
0
)
{
vshError
(
ctl
,
_
(
"cannot read file '%s'"
),
opt
);
goto
save_error
;
}
if
(
virTypedParamsAddString
(
&
params
,
&
nparams
,
&
maxparams
,
VIR_MIGRATE_PARAM_DEST_XML
,
xml
)
<
0
)
{
VIR_FREE
(
xml
);
goto
save_error
;
}
VIR_FREE
(
xml
);
}
if
(
vshCommandOptBool
(
cmd
,
"live"
))
flags
|=
VIR_MIGRATE_LIVE
;
if
(
vshCommandOptBool
(
cmd
,
"p2p"
))
...
...
@@ -8406,23 +8435,19 @@ doMigrate(void *opaque)
if
(
vshCommandOptBool
(
cmd
,
"abort-on-error"
))
flags
|=
VIR_MIGRATE_ABORT_ON_ERROR
;
if
(
xmlfile
&&
virFileReadAll
(
xmlfile
,
8192
,
&
xml
)
<
0
)
{
vshError
(
ctl
,
_
(
"file '%s' doesn't exist"
),
xmlfile
);
goto
out
;
}
if
((
flags
&
VIR_MIGRATE_PEER2PEER
)
||
vshCommandOptBool
(
cmd
,
"direct"
))
{
/* migrateuri doesn't make sense for tunnelled migration */
if
(
flags
&
VIR_MIGRATE_TUNNELLED
&&
migrateuri
!=
NULL
)
{
vshError
(
ctl
,
"%s"
,
_
(
"migrate: Unexpected migrateuri for peer2peer/direct migration"
));
if
(
flags
&
VIR_MIGRATE_TUNNELLED
&&
virTypedParamsGetString
(
params
,
nparams
,
VIR_MIGRATE_PARAM_URI
,
NULL
)
==
1
)
{
vshError
(
ctl
,
"%s"
,
_
(
"migrate: Unexpected migrateuri for "
"peer2peer/direct migration"
));
goto
out
;
}
if
(
virDomainMigrateToURI2
(
dom
,
desturi
,
migrateuri
,
xml
,
flags
,
dname
,
0
)
==
0
)
if
(
virDomainMigrateToURI3
(
dom
,
desturi
,
params
,
nparams
,
flags
)
==
0
)
ret
=
'0'
;
}
else
{
/* For traditional live migration, connect to the destination host directly. */
...
...
@@ -8430,10 +8455,10 @@ doMigrate(void *opaque)
virDomainPtr
ddom
=
NULL
;
dconn
=
virConnectOpenAuth
(
desturi
,
virConnectAuthPtrDefault
,
0
);
if
(
!
dconn
)
goto
out
;
if
(
!
dconn
)
goto
out
;
ddom
=
virDomainMigrate2
(
dom
,
dconn
,
xml
,
flags
,
dname
,
migrateuri
,
0
);
if
(
ddom
)
{
if
((
ddom
=
virDomainMigrate3
(
dom
,
dconn
,
params
,
nparams
,
flags
)))
{
virDomainFree
(
ddom
);
ret
=
'0'
;
}
...
...
@@ -8443,9 +8468,15 @@ doMigrate(void *opaque)
out:
pthread_sigmask
(
SIG_SETMASK
,
&
oldsigmask
,
NULL
);
out_sig:
if
(
dom
)
virDomainFree
(
dom
);
VIR_FREE
(
xml
);
virTypedParamsFree
(
params
,
nparams
);
if
(
dom
)
virDomainFree
(
dom
);
ignore_value
(
safewrite
(
data
->
writefd
,
&
ret
,
sizeof
(
ret
)));
return
;
save_error:
vshSaveLibvirtError
();
goto
out
;
}
static
void
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录