Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
libvirt
提交
25706034
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,发现更多精彩内容 >>
提交
25706034
编写于
12月 02, 2015
作者:
J
Jiri Denemark
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
virsh: Configurable migrate --timeout action
Signed-off-by:
N
Jiri Denemark
<
jdenemar@redhat.com
>
上级
179d9728
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
64 addition
and
13 deletion
+64
-13
tools/virsh-domain.c
tools/virsh-domain.c
+54
-8
tools/virsh.pod
tools/virsh.pod
+10
-5
未找到文件。
tools/virsh-domain.c
浏览文件 @
25706034
...
...
@@ -9661,7 +9661,16 @@ static const vshCmdOptDef opts_migrate[] = {
},
{.
name
=
"timeout"
,
.
type
=
VSH_OT_INT
,
.
help
=
N_
(
"force guest to suspend if live migration exceeds timeout (in seconds)"
)
.
help
=
N_
(
"run action specified by --timeout-* option (suspend by "
"default) if live migration exceeds timeout (in seconds)"
)
},
{.
name
=
"timeout-suspend"
,
.
type
=
VSH_OT_BOOL
,
.
help
=
N_
(
"suspend the guest after timeout"
)
},
{.
name
=
"timeout-postcopy"
,
.
type
=
VSH_OT_BOOL
,
.
help
=
N_
(
"switch to post-copy after timeout"
)
},
{.
name
=
"xml"
,
.
type
=
VSH_OT_STRING
,
...
...
@@ -9851,14 +9860,35 @@ doMigrate(void *opaque)
goto
out
;
}
typedef
enum
{
VIRSH_MIGRATE_TIMEOUT_DEFAULT
,
VIRSH_MIGRATE_TIMEOUT_SUSPEND
,
VIRSH_MIGRATE_TIMEOUT_POSTCOPY
,
}
virshMigrateTimeoutAction
;
static
void
virshMigrat
ion
Timeout
(
vshControl
*
ctl
,
virDomainPtr
dom
,
void
*
opaque
ATTRIBUTE_UNUSED
)
virshMigrat
e
Timeout
(
vshControl
*
ctl
,
virDomainPtr
dom
,
void
*
opaque
)
{
vshDebug
(
ctl
,
VSH_ERR_DEBUG
,
"suspending the domain, "
"since migration timed out
\n
"
);
virDomainSuspend
(
dom
);
virshMigrateTimeoutAction
action
=
*
(
virshMigrateTimeoutAction
*
)
opaque
;
switch
(
action
)
{
case
VIRSH_MIGRATE_TIMEOUT_DEFAULT
:
/* unreachable */
case
VIRSH_MIGRATE_TIMEOUT_SUSPEND
:
vshDebug
(
ctl
,
VSH_ERR_DEBUG
,
"migration timed out; suspending domain
\n
"
);
if
(
virDomainSuspend
(
dom
)
<
0
)
vshDebug
(
ctl
,
VSH_ERR_INFO
,
"suspending domain failed
\n
"
);
break
;
case
VIRSH_MIGRATE_TIMEOUT_POSTCOPY
:
vshDebug
(
ctl
,
VSH_ERR_DEBUG
,
"migration timed out; switching to post-copy
\n
"
);
if
(
virDomainMigrateStartPostCopy
(
dom
,
0
)
<
0
)
vshDebug
(
ctl
,
VSH_ERR_INFO
,
"switching to post-copy failed
\n
"
);
break
;
}
}
static
bool
...
...
@@ -9870,10 +9900,12 @@ cmdMigrate(vshControl *ctl, const vshCmd *cmd)
bool
verbose
=
false
;
bool
functionReturn
=
false
;
int
timeout
=
0
;
virshMigrateTimeoutAction
timeoutAction
=
VIRSH_MIGRATE_TIMEOUT_DEFAULT
;
bool
live_flag
=
false
;
virshCtrlData
data
=
{
.
dconn
=
NULL
};
VSH_EXCLUSIVE_OPTIONS
(
"live"
,
"offline"
);
VSH_EXCLUSIVE_OPTIONS
(
"timeout-suspend"
,
"timeout-postcopy"
);
if
(
!
(
dom
=
virshCommandOptDomain
(
ctl
,
cmd
,
NULL
)))
return
false
;
...
...
@@ -9891,6 +9923,19 @@ cmdMigrate(vshControl *ctl, const vshCmd *cmd)
goto
cleanup
;
}
if
(
vshCommandOptBool
(
cmd
,
"timeout-suspend"
))
timeoutAction
=
VIRSH_MIGRATE_TIMEOUT_SUSPEND
;
if
(
vshCommandOptBool
(
cmd
,
"timeout-postcopy"
))
timeoutAction
=
VIRSH_MIGRATE_TIMEOUT_POSTCOPY
;
if
(
timeout
>
0
)
{
if
(
timeoutAction
==
VIRSH_MIGRATE_TIMEOUT_DEFAULT
)
timeoutAction
=
VIRSH_MIGRATE_TIMEOUT_SUSPEND
;
}
else
if
(
timeoutAction
)
{
vshError
(
ctl
,
"%s"
,
_
(
"migrate: Unexpected --timeout-* option without --timeout"
));
goto
cleanup
;
}
if
(
pipe
(
p
)
<
0
)
goto
cleanup
;
...
...
@@ -9921,7 +9966,8 @@ cmdMigrate(vshControl *ctl, const vshCmd *cmd)
&
data
)
<
0
)
goto
cleanup
;
functionReturn
=
virshWatchJob
(
ctl
,
dom
,
verbose
,
p
[
0
],
timeout
,
virshMigrationTimeout
,
NULL
,
_
(
"Migration"
));
virshMigrateTimeout
,
&
timeoutAction
,
_
(
"Migration"
));
virThreadJoin
(
&
workerThread
);
...
...
tools/virsh.pod
浏览文件 @
25706034
...
...
@@ -1531,8 +1531,8 @@ to the I<uri> namespace is displayed instead of being modified.
[I<--copy-storage-inc>] [I<--change-protection>] [I<--unsafe>] [I<--verbose>]
[I<--compressed>] [I<--abort-on-error>] [I<--auto-converge>] [I<--postcopy>]
I<domain> I<desturi> [I<migrateuri>] [I<graphicsuri>] [I<listen-address>]
[I<dname>] [I<--timeout> B<seconds>
] [I<--xml> B<file>
]
[I<--migrate-disks> B<disk-list>] [I<--disks-port> B<port>]
[I<dname>] [I<--timeout> B<seconds>
[I<--timeout-suspend> | I<--timeout-postcopy>]
]
[I<--
xml> B<file>] [I<--
migrate-disks> B<disk-list>] [I<--disks-port> B<port>]
Migrate domain to another host. Add I<--live> for live migration; <--p2p>
for peer-2-peer migration; I<--direct> for direct migration; or I<--tunnelled>
...
...
@@ -1582,9 +1582,14 @@ the destination to supply a larger set of changes to any host-specific
portions of the domain XML, such as accounting for naming differences
between source and destination in accessing underlying storage.
I<--timeout> B<seconds> forces guest to suspend when live migration exceeds
that many seconds, and
then the migration will complete offline. It can only be used with I<--live>.
I<--timeout> B<seconds> tells virsh to run a specified action when live
migration exceeds that many seconds. It can only be used with I<--live>.
If I<--timeout-suspend> is specified, the domain will be suspended after
the timeout and the migration will complete offline; this is the default
if no I<--timeout-*> option is specified on the command line. When
I<--timeout-postcopy> is used, virsh will switch migration from pre-copy
to post-copy upon timeout; migration has to be started with I<--postcopy>
option for this to work.
Running migration can be canceled by interrupting virsh (usually using
C<Ctrl-C>) or by B<domjobabort> command sent from another virsh instance.
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录