Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
libvirt
提交
ecd81131
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,发现更多精彩内容 >>
提交
ecd81131
编写于
6月 25, 2013
作者:
J
Jiri Denemark
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
qemu: Move common parts of Prepare phase to qemu_migration.c
上级
d3ce7363
变更
3
显示空白变更内容
内联
并排
Showing
3 changed file
with
65 addition
and
103 deletion
+65
-103
src/qemu/qemu_driver.c
src/qemu/qemu_driver.c
+17
-103
src/qemu/qemu_migration.c
src/qemu/qemu_migration.c
+44
-0
src/qemu/qemu_migration.h
src/qemu/qemu_migration.h
+4
-0
未找到文件。
src/qemu/qemu_driver.c
浏览文件 @
ecd81131
...
...
@@ -9962,25 +9962,14 @@ qemuDomainMigratePrepareTunnel(virConnectPtr dconn,
const
char
*
dom_xml
)
{
virQEMUDriverPtr
driver
=
dconn
->
privateData
;
virCapsPtr
caps
=
NULL
;
virDomainDefPtr
def
=
NULL
;
int
ret
=
-
1
;
virCheckFlags
(
QEMU_MIGRATION_FLAGS
,
-
1
);
if
(
!
dom_xml
)
{
virReportError
(
VIR_ERR_INTERNAL_ERROR
,
"%s"
,
_
(
"no domain XML passed"
));
goto
cleanup
;
}
if
(
!
(
flags
&
VIR_MIGRATE_TUNNELLED
))
{
virReportError
(
VIR_ERR_INTERNAL_ERROR
,
"%s"
,
_
(
"PrepareTunnel called but no TUNNELLED flag set"
));
goto
cleanup
;
}
if
(
st
==
NULL
)
{
virReportError
(
VIR_ERR_INTERNAL_ERROR
,
"%s"
,
_
(
"tunnelled migration requested but NULL stream passed"
));
virReportError
(
VIR_ERR_INTERNAL_ERROR
,
"%s"
,
_
(
"PrepareTunnel called but no TUNNELLED flag set"
));
goto
cleanup
;
}
...
...
@@ -9991,20 +9980,9 @@ qemuDomainMigratePrepareTunnel(virConnectPtr dconn,
goto
cleanup
;
}
if
(
!
(
caps
=
virQEMUDriverGetCapabilities
(
driver
,
fals
e
)))
if
(
!
(
def
=
qemuMigrationPrepareDef
(
driver
,
dom_xml
,
dnam
e
)))
goto
cleanup
;
if
(
!
(
def
=
virDomainDefParseString
(
dom_xml
,
caps
,
driver
->
xmlopt
,
QEMU_EXPECTED_VIRT_TYPES
,
VIR_DOMAIN_XML_INACTIVE
)))
goto
cleanup
;
if
(
dname
)
{
VIR_FREE
(
def
->
name
);
if
(
VIR_STRDUP
(
def
->
name
,
dname
)
<
0
)
goto
cleanup
;
}
if
(
virDomainMigratePrepareTunnelEnsureACL
(
dconn
,
def
)
<
0
)
goto
cleanup
;
...
...
@@ -10014,7 +9992,6 @@ qemuDomainMigratePrepareTunnel(virConnectPtr dconn,
cleanup:
virDomainDefFree
(
def
);
virObjectUnref
(
caps
);
return
ret
;
}
...
...
@@ -10034,49 +10011,30 @@ qemuDomainMigratePrepare2(virConnectPtr dconn,
const
char
*
dom_xml
)
{
virQEMUDriverPtr
driver
=
dconn
->
privateData
;
virCapsPtr
caps
=
NULL
;
virDomainDefPtr
def
=
NULL
;
int
ret
=
-
1
;
virCheckFlags
(
QEMU_MIGRATION_FLAGS
,
-
1
);
*
uri_out
=
NULL
;
if
(
virLockManagerPluginUsesState
(
driver
->
lockManager
))
{
virReportError
(
VIR_ERR_INTERNAL_ERROR
,
_
(
"Cannot use migrate v2 protocol with lock manager %s"
),
virLockManagerPluginGetName
(
driver
->
lockManager
));
goto
cleanup
;
}
if
(
flags
&
VIR_MIGRATE_TUNNELLED
)
{
/* this is a logical error; we never should have gotten here with
* VIR_MIGRATE_TUNNELLED set
*/
virReportError
(
VIR_ERR_INTERNAL_ERROR
,
"%s"
,
_
(
"Tunnelled migration requested but invalid RPC method called"
));
virReportError
(
VIR_ERR_INTERNAL_ERROR
,
"%s"
,
_
(
"Tunnelled migration requested but invalid "
"RPC method called"
));
goto
cleanup
;
}
if
(
!
dom_xml
)
{
if
(
virLockManagerPluginUsesState
(
driver
->
lockManager
)
)
{
virReportError
(
VIR_ERR_INTERNAL_ERROR
,
"%s"
,
_
(
"no domain XML passed"
));
_
(
"Cannot use migrate v2 protocol with lock manager %s"
),
virLockManagerPluginGetName
(
driver
->
lockManager
));
goto
cleanup
;
}
if
(
!
(
caps
=
virQEMUDriverGetCapabilities
(
driver
,
false
)))
goto
cleanup
;
if
(
!
(
def
=
virDomainDefParseString
(
dom_xml
,
caps
,
driver
->
xmlopt
,
QEMU_EXPECTED_VIRT_TYPES
,
VIR_DOMAIN_XML_INACTIVE
)))
goto
cleanup
;
if
(
dname
)
{
VIR_FREE
(
def
->
name
);
if
(
VIR_STRDUP
(
def
->
name
,
dname
)
<
0
)
if
(
!
(
def
=
qemuMigrationPrepareDef
(
driver
,
dom_xml
,
dname
)))
goto
cleanup
;
}
if
(
virDomainMigratePrepare2EnsureACL
(
dconn
,
def
)
<
0
)
goto
cleanup
;
...
...
@@ -10092,7 +10050,6 @@ qemuDomainMigratePrepare2(virConnectPtr dconn,
cleanup:
virDomainDefFree
(
def
);
virObjectUnref
(
caps
);
return
ret
;
}
...
...
@@ -10230,43 +10187,24 @@ qemuDomainMigratePrepare3(virConnectPtr dconn,
const
char
*
dom_xml
)
{
virQEMUDriverPtr
driver
=
dconn
->
privateData
;
virCapsPtr
caps
=
NULL
;
virDomainDefPtr
def
=
NULL
;
int
ret
=
-
1
;
virCheckFlags
(
QEMU_MIGRATION_FLAGS
,
-
1
);
*
uri_out
=
NULL
;
if
(
flags
&
VIR_MIGRATE_TUNNELLED
)
{
/* this is a logical error; we never should have gotten here with
* VIR_MIGRATE_TUNNELLED set
*/
virReportError
(
VIR_ERR_INTERNAL_ERROR
,
"%s"
,
_
(
"Tunnelled migration requested but invalid RPC method called"
));
goto
cleanup
;
}
if
(
!
dom_xml
)
{
virReportError
(
VIR_ERR_INTERNAL_ERROR
,
"%s"
,
_
(
"no domain XML passed"
));
virReportError
(
VIR_ERR_INTERNAL_ERROR
,
"%s"
,
_
(
"Tunnelled migration requested but invalid "
"RPC method called"
));
goto
cleanup
;
}
if
(
!
(
caps
=
virQEMUDriverGetCapabilities
(
driver
,
fals
e
)))
if
(
!
(
def
=
qemuMigrationPrepareDef
(
driver
,
dom_xml
,
dnam
e
)))
goto
cleanup
;
if
(
!
(
def
=
virDomainDefParseString
(
dom_xml
,
caps
,
driver
->
xmlopt
,
QEMU_EXPECTED_VIRT_TYPES
,
VIR_DOMAIN_XML_INACTIVE
)))
goto
cleanup
;
if
(
dname
)
{
VIR_FREE
(
def
->
name
);
if
(
VIR_STRDUP
(
def
->
name
,
dname
)
<
0
)
goto
cleanup
;
}
if
(
virDomainMigratePrepare3EnsureACL
(
dconn
,
def
)
<
0
)
goto
cleanup
;
...
...
@@ -10278,7 +10216,6 @@ qemuDomainMigratePrepare3(virConnectPtr dconn,
cleanup:
virDomainDefFree
(
def
);
virObjectUnref
(
caps
);
return
ret
;
}
...
...
@@ -10296,42 +10233,20 @@ qemuDomainMigratePrepareTunnel3(virConnectPtr dconn,
const
char
*
dom_xml
)
{
virQEMUDriverPtr
driver
=
dconn
->
privateData
;
virCapsPtr
caps
=
NULL
;
virDomainDefPtr
def
=
NULL
;
int
ret
=
-
1
;
virCheckFlags
(
QEMU_MIGRATION_FLAGS
,
-
1
);
if
(
!
dom_xml
)
{
virReportError
(
VIR_ERR_INTERNAL_ERROR
,
"%s"
,
_
(
"no domain XML passed"
));
goto
cleanup
;
}
if
(
!
(
flags
&
VIR_MIGRATE_TUNNELLED
))
{
virReportError
(
VIR_ERR_INTERNAL_ERROR
,
"%s"
,
_
(
"PrepareTunnel called but no TUNNELLED flag set"
));
goto
cleanup
;
}
if
(
st
==
NULL
)
{
virReportError
(
VIR_ERR_INTERNAL_ERROR
,
"%s"
,
_
(
"tunnelled migration requested but NULL stream passed"
));
virReportError
(
VIR_ERR_INTERNAL_ERROR
,
"%s"
,
_
(
"PrepareTunnel called but no TUNNELLED flag set"
));
goto
cleanup
;
}
if
(
!
(
caps
=
virQEMUDriverGetCapabilities
(
driver
,
false
)))
goto
cleanup
;
if
(
!
(
def
=
virDomainDefParseString
(
dom_xml
,
caps
,
driver
->
xmlopt
,
QEMU_EXPECTED_VIRT_TYPES
,
VIR_DOMAIN_XML_INACTIVE
)))
if
(
!
(
def
=
qemuMigrationPrepareDef
(
driver
,
dom_xml
,
dname
)))
goto
cleanup
;
if
(
dname
)
{
VIR_FREE
(
def
->
name
);
if
(
VIR_STRDUP
(
def
->
name
,
dname
)
<
0
)
goto
cleanup
;
}
if
(
virDomainMigratePrepareTunnel3EnsureACL
(
dconn
,
def
)
<
0
)
goto
cleanup
;
...
...
@@ -10342,7 +10257,6 @@ qemuDomainMigratePrepareTunnel3(virConnectPtr dconn,
cleanup:
virDomainDefFree
(
def
);
virObjectUnref
(
caps
);
return
ret
;
}
...
...
src/qemu/qemu_migration.c
浏览文件 @
ecd81131
...
...
@@ -2442,6 +2442,12 @@ qemuMigrationPrepareTunnel(virQEMUDriverPtr driver,
driver
,
dconn
,
NULLSTR
(
cookiein
),
cookieinlen
,
cookieout
,
cookieoutlen
,
st
,
*
def
,
flags
);
if
(
st
==
NULL
)
{
virReportError
(
VIR_ERR_INTERNAL_ERROR
,
"%s"
,
_
(
"tunnelled migration requested but NULL stream passed"
));
return
-
1
;
}
ret
=
qemuMigrationPrepareAny
(
driver
,
dconn
,
cookiein
,
cookieinlen
,
cookieout
,
cookieoutlen
,
def
,
st
,
0
,
flags
);
...
...
@@ -2476,6 +2482,8 @@ qemuMigrationPrepareDirect(virQEMUDriverPtr driver,
cookieout
,
cookieoutlen
,
NULLSTR
(
uri_in
),
uri_out
,
*
def
,
flags
);
*
uri_out
=
NULL
;
/* The URI passed in may be NULL or a string "tcp://somehostname:port".
*
* If the URI passed in is NULL then we allocate a port number
...
...
@@ -2580,6 +2588,42 @@ cleanup:
}
virDomainDefPtr
qemuMigrationPrepareDef
(
virQEMUDriverPtr
driver
,
const
char
*
dom_xml
,
const
char
*
dname
)
{
virCapsPtr
caps
=
NULL
;
virDomainDefPtr
def
;
if
(
!
dom_xml
)
{
virReportError
(
VIR_ERR_INTERNAL_ERROR
,
"%s"
,
_
(
"no domain XML passed"
));
return
NULL
;
}
if
(
!
(
caps
=
virQEMUDriverGetCapabilities
(
driver
,
false
)))
return
NULL
;
if
(
!
(
def
=
virDomainDefParseString
(
dom_xml
,
caps
,
driver
->
xmlopt
,
QEMU_EXPECTED_VIRT_TYPES
,
VIR_DOMAIN_XML_INACTIVE
)))
goto
cleanup
;
if
(
dname
)
{
VIR_FREE
(
def
->
name
);
if
(
VIR_STRDUP
(
def
->
name
,
dname
)
<
0
)
{
virDomainDefFree
(
def
);
def
=
NULL
;
}
}
cleanup:
virObjectUnref
(
caps
);
return
def
;
}
enum
qemuMigrationDestinationType
{
MIGRATION_DEST_HOST
,
MIGRATION_DEST_CONNECT_HOST
,
...
...
src/qemu/qemu_migration.h
浏览文件 @
ecd81131
...
...
@@ -92,6 +92,10 @@ char *qemuMigrationBegin(virConnectPtr conn,
int
*
cookieoutlen
,
unsigned
long
flags
);
virDomainDefPtr
qemuMigrationPrepareDef
(
virQEMUDriverPtr
driver
,
const
char
*
dom_xml
,
const
char
*
dname
);
int
qemuMigrationPrepareTunnel
(
virQEMUDriverPtr
driver
,
virConnectPtr
dconn
,
const
char
*
cookiein
,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录