Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
libvirt
提交
674afcb0
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看板
提交
674afcb0
编写于
11月 05, 2015
作者:
J
Jiri Denemark
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
qemu: Separate incoming URI generation from qemuMigrationPrepareAny
Signed-off-by:
N
Jiri Denemark
<
jdenemar@redhat.com
>
上级
0004ddf0
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
85 addition
and
69 deletion
+85
-69
src/qemu/qemu_migration.c
src/qemu/qemu_migration.c
+85
-69
未找到文件。
src/qemu/qemu_migration.c
浏览文件 @
674afcb0
...
...
@@ -3291,6 +3291,80 @@ qemuMigrationPrepareCleanup(virQEMUDriverPtr driver,
qemuDomainObjDiscardAsyncJob
(
driver
,
vm
);
}
static
char
*
qemuMigrationPrepareIncoming
(
virDomainObjPtr
vm
,
bool
tunnel
,
const
char
*
protocol
,
const
char
*
listenAddress
,
unsigned
short
port
)
{
qemuDomainObjPrivatePtr
priv
=
vm
->
privateData
;
char
*
migrateFrom
=
NULL
;
if
(
tunnel
)
{
if
(
VIR_STRDUP
(
migrateFrom
,
"stdio"
)
<
0
)
goto
cleanup
;
}
else
{
bool
encloseAddress
=
false
;
bool
hostIPv6Capable
=
false
;
bool
qemuIPv6Capable
=
false
;
struct
addrinfo
*
info
=
NULL
;
struct
addrinfo
hints
=
{
.
ai_flags
=
AI_ADDRCONFIG
,
.
ai_socktype
=
SOCK_STREAM
};
const
char
*
incFormat
;
if
(
getaddrinfo
(
"::"
,
NULL
,
&
hints
,
&
info
)
==
0
)
{
freeaddrinfo
(
info
);
hostIPv6Capable
=
true
;
}
qemuIPv6Capable
=
virQEMUCapsGet
(
priv
->
qemuCaps
,
QEMU_CAPS_IPV6_MIGRATION
);
if
(
listenAddress
)
{
if
(
virSocketAddrNumericFamily
(
listenAddress
)
==
AF_INET6
)
{
if
(
!
qemuIPv6Capable
)
{
virReportError
(
VIR_ERR_ARGUMENT_UNSUPPORTED
,
"%s"
,
_
(
"qemu isn't capable of IPv6"
));
goto
cleanup
;
}
if
(
!
hostIPv6Capable
)
{
virReportError
(
VIR_ERR_ARGUMENT_UNSUPPORTED
,
"%s"
,
_
(
"host isn't capable of IPv6"
));
goto
cleanup
;
}
/* IPv6 address must be escaped in brackets on the cmd line */
encloseAddress
=
true
;
}
else
{
/* listenAddress is a hostname or IPv4 */
}
}
else
if
(
qemuIPv6Capable
&&
hostIPv6Capable
)
{
/* Listen on :: instead of 0.0.0.0 if QEMU understands it
* and there is at least one IPv6 address configured
*/
listenAddress
=
"::"
;
encloseAddress
=
true
;
}
else
{
listenAddress
=
"0.0.0.0"
;
}
/* QEMU will be started with
* -incoming protocol:[<IPv6 addr>]:port,
* -incoming protocol:<IPv4 addr>:port, or
* -incoming protocol:<hostname>:port
*/
if
(
encloseAddress
)
incFormat
=
"%s:[%s]:%d"
;
else
incFormat
=
"%s:%s:%d"
;
if
(
virAsprintf
(
&
migrateFrom
,
incFormat
,
protocol
,
listenAddress
,
port
)
<
0
)
goto
cleanup
;
}
cleanup:
return
migrateFrom
;
}
static
int
qemuMigrationPrepareAny
(
virQEMUDriverPtr
driver
,
virConnectPtr
dconn
,
...
...
@@ -3397,75 +3471,6 @@ qemuMigrationPrepareAny(virQEMUDriverPtr driver,
}
}
if
(
tunnel
)
{
/* QEMU will be started with -incoming stdio
* (which qemu_command might convert to exec:cat or fd:n)
*/
if
(
VIR_STRDUP
(
migrateFrom
,
"stdio"
)
<
0
)
goto
cleanup
;
}
else
{
bool
encloseAddress
=
false
;
bool
hostIPv6Capable
=
false
;
bool
qemuIPv6Capable
=
false
;
virQEMUCapsPtr
qemuCaps
=
NULL
;
struct
addrinfo
*
info
=
NULL
;
struct
addrinfo
hints
=
{
.
ai_flags
=
AI_ADDRCONFIG
,
.
ai_socktype
=
SOCK_STREAM
};
const
char
*
incFormat
;
if
(
getaddrinfo
(
"::"
,
NULL
,
&
hints
,
&
info
)
==
0
)
{
freeaddrinfo
(
info
);
hostIPv6Capable
=
true
;
}
if
(
!
(
qemuCaps
=
virQEMUCapsCacheLookupCopy
(
driver
->
qemuCapsCache
,
(
*
def
)
->
emulator
,
(
*
def
)
->
os
.
machine
)))
goto
cleanup
;
qemuIPv6Capable
=
virQEMUCapsGet
(
qemuCaps
,
QEMU_CAPS_IPV6_MIGRATION
);
virObjectUnref
(
qemuCaps
);
if
(
listenAddress
)
{
if
(
virSocketAddrNumericFamily
(
listenAddress
)
==
AF_INET6
)
{
if
(
!
qemuIPv6Capable
)
{
virReportError
(
VIR_ERR_ARGUMENT_UNSUPPORTED
,
"%s"
,
_
(
"qemu isn't capable of IPv6"
));
goto
cleanup
;
}
if
(
!
hostIPv6Capable
)
{
virReportError
(
VIR_ERR_ARGUMENT_UNSUPPORTED
,
"%s"
,
_
(
"host isn't capable of IPv6"
));
goto
cleanup
;
}
/* IPv6 address must be escaped in brackets on the cmd line */
encloseAddress
=
true
;
}
else
{
/* listenAddress is a hostname or IPv4 */
}
}
else
if
(
qemuIPv6Capable
&&
hostIPv6Capable
)
{
/* Listen on :: instead of 0.0.0.0 if QEMU understands it
* and there is at least one IPv6 address configured
*/
listenAddress
=
"::"
;
encloseAddress
=
true
;
}
else
{
listenAddress
=
"0.0.0.0"
;
}
/* QEMU will be started with
* -incoming protocol:[<IPv6 addr>]:port,
* -incoming protocol:<IPv4 addr>:port, or
* -incoming protocol:<hostname>:port
*/
if
(
encloseAddress
)
incFormat
=
"%s:[%s]:%d"
;
else
incFormat
=
"%s:%s:%d"
;
if
(
virAsprintf
(
&
migrateFrom
,
incFormat
,
protocol
,
listenAddress
,
port
)
<
0
)
goto
cleanup
;
}
if
(
!
(
vm
=
virDomainObjListAdd
(
driver
->
domains
,
*
def
,
driver
->
xmlopt
,
VIR_DOMAIN_OBJ_LIST_ADD_LIVE
|
...
...
@@ -3520,6 +3525,17 @@ qemuMigrationPrepareAny(virQEMUDriverPtr driver,
goto
endjob
;
}
virObjectUnref
(
priv
->
qemuCaps
);
priv
->
qemuCaps
=
virQEMUCapsCacheLookupCopy
(
driver
->
qemuCapsCache
,
vm
->
def
->
emulator
,
vm
->
def
->
os
.
machine
);
if
(
!
priv
->
qemuCaps
)
goto
endjob
;
if
(
!
(
migrateFrom
=
qemuMigrationPrepareIncoming
(
vm
,
tunnel
,
protocol
,
listenAddress
,
port
)))
goto
endjob
;
/* Start the QEMU daemon, with the same command-line arguments plus
* -incoming $migrateFrom
*/
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录