Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
libvirt
提交
061e2428
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看板
提交
061e2428
编写于
4月 14, 2016
作者:
N
Nikolay Shirokovskiy
提交者:
Jiri Denemark
4月 14, 2016
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
qemu: migration: support setting compession parameters
Signed-off-by:
N
Nikolay Shirokovskiy
<
nshirokovskiy@virtuozzo.com
>
上级
f9433ea0
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
134 addition
and
2 deletion
+134
-2
include/libvirt/libvirt-domain.h
include/libvirt/libvirt-domain.h
+33
-0
src/qemu/qemu_migration.c
src/qemu/qemu_migration.c
+92
-2
src/qemu/qemu_migration.h
src/qemu/qemu_migration.h
+9
-0
未找到文件。
include/libvirt/libvirt-domain.h
浏览文件 @
061e2428
...
...
@@ -797,6 +797,39 @@ typedef enum {
*/
# define VIR_MIGRATE_PARAM_COMPRESSION "compression"
/**
* VIR_MIGRATE_PARAM_COMPRESSION_MT_LEVEL:
*
* virDomainMigrate* params field: the level of compression for multithread
* compression as VIR_TYPED_PARAM_INT. Accepted values are in range 0-9.
* 0 is no compression, 1 is maximum speed and 9 is maximum compression.
*/
# define VIR_MIGRATE_PARAM_COMPRESSION_MT_LEVEL "compression.mt.level"
/**
* VIR_MIGRATE_PARAM_COMPRESSION_MT_THREADS:
*
* virDomainMigrate* params field: the number of compression threads for
* multithread compression as VIR_TYPED_PARAM_INT.
*/
# define VIR_MIGRATE_PARAM_COMPRESSION_MT_THREADS "compression.mt.threads"
/**
* VIR_MIGRATE_PARAM_COMPRESSION_MT_DTHREADS:
*
* virDomainMigrate* params field: the number of decompression threads for
* multithread compression as VIR_TYPED_PARAM_INT.
*/
# define VIR_MIGRATE_PARAM_COMPRESSION_MT_DTHREADS "compression.mt.dthreads"
/**
* VIR_MIGRATE_PARAM_COMPRESSION_XBZRLE_CACHE:
*
* virDomainMigrate* params field: the size of page cache for xbzrle
* compression as VIR_TYPED_PARAM_ULLONG.
*/
# define VIR_MIGRATE_PARAM_COMPRESSION_XBZRLE_CACHE "compression.xbzrle.cache"
/* Domain migration. */
virDomainPtr
virDomainMigrate
(
virDomainPtr
domain
,
virConnectPtr
dconn
,
unsigned
long
flags
,
const
char
*
dname
,
...
...
src/qemu/qemu_migration.c
浏览文件 @
061e2428
...
...
@@ -3424,6 +3424,10 @@ qemuMigrationSetCompression(virQEMUDriverPtr driver,
qemuDomainAsyncJob
job
,
qemuMigrationCompressionPtr
compression
)
{
int
ret
=
-
1
;
qemuDomainObjPrivatePtr
priv
=
vm
->
privateData
;
qemuMonitorMigrationCompressionPtr
params
=
&
compression
->
params
;
if
(
qemuMigrationSetOption
(
driver
,
vm
,
QEMU_MONITOR_MIGRATION_CAPS_XBZRLE
,
compression
->
methods
&
...
...
@@ -3438,7 +3442,25 @@ qemuMigrationSetCompression(virQEMUDriverPtr driver,
job
)
<
0
)
return
-
1
;
return
0
;
if
(
qemuDomainObjEnterMonitorAsync
(
driver
,
vm
,
job
)
<
0
)
return
-
1
;
if
((
params
->
level_set
||
params
->
threads_set
||
params
->
dthreads_set
)
&&
qemuMonitorSetMigrationCompression
(
priv
->
mon
,
params
)
<
0
)
goto
cleanup
;
if
(
compression
->
xbzrle_cache_set
&&
qemuMonitorSetMigrationCacheSize
(
priv
->
mon
,
compression
->
xbzrle_cache
)
<
0
)
goto
cleanup
;
ret
=
0
;
cleanup:
if
(
qemuDomainObjExitMonitor
(
driver
,
vm
)
<
0
)
ret
=
-
1
;
return
ret
;
}
static
int
...
...
@@ -6621,6 +6643,7 @@ qemuMigrationCompressionParse(virTypedParameterPtr params,
{
size_t
i
;
qemuMigrationCompressionPtr
compression
=
NULL
;
qemuMonitorMigrationCompressionPtr
cparams
;
if
(
VIR_ALLOC
(
compression
)
<
0
)
return
NULL
;
...
...
@@ -6649,6 +6672,47 @@ qemuMigrationCompressionParse(virTypedParameterPtr params,
compression
->
methods
|=
1ULL
<<
method
;
}
#define GET_PARAM(PARAM, TYPE, PARENT, VALUE) \
do { \
int rc; \
\
if ((rc = virTypedParamsGet ## TYPE(params, nparams, \
PARAM, &PARENT->VALUE)) < 0) \
goto error; \
\
if (rc == 1) \
PARENT->VALUE ## _set = true; \
} while (0)
cparams
=
&
compression
->
params
;
if
(
params
)
{
GET_PARAM
(
VIR_MIGRATE_PARAM_COMPRESSION_MT_LEVEL
,
Int
,
cparams
,
level
);
GET_PARAM
(
VIR_MIGRATE_PARAM_COMPRESSION_MT_THREADS
,
Int
,
cparams
,
threads
);
GET_PARAM
(
VIR_MIGRATE_PARAM_COMPRESSION_MT_DTHREADS
,
Int
,
cparams
,
dthreads
);
GET_PARAM
(
VIR_MIGRATE_PARAM_COMPRESSION_XBZRLE_CACHE
,
ULLong
,
compression
,
xbzrle_cache
);
}
#undef GET_PARAM
if
((
cparams
->
level_set
||
cparams
->
threads_set
||
cparams
->
dthreads_set
)
&&
!
(
compression
->
methods
&
(
1ULL
<<
QEMU_MIGRATION_COMPRESS_MT
)))
{
virReportError
(
VIR_ERR_INVALID_ARG
,
"%s"
,
_
(
"Turn multithread compression on to tune it"
));
goto
error
;
}
if
(
compression
->
xbzrle_cache_set
&&
!
(
compression
->
methods
&
(
1ULL
<<
QEMU_MIGRATION_COMPRESS_XBZRLE
)))
{
virReportError
(
VIR_ERR_INVALID_ARG
,
"%s"
,
_
(
"Turn xbzrle compression on to tune it"
));
goto
error
;
}
if
(
!
compression
->
methods
&&
(
flags
&
VIR_MIGRATE_COMPRESSED
))
compression
->
methods
=
1ULL
<<
QEMU_MIGRATION_COMPRESS_XBZRLE
;
...
...
@@ -6667,8 +6731,10 @@ qemuMigrationCompressionDump(qemuMigrationCompressionPtr compression,
unsigned
long
*
flags
)
{
size_t
i
;
qemuMonitorMigrationCompressionPtr
cparams
=
&
compression
->
params
;
if
(
compression
->
methods
==
1ULL
<<
QEMU_MIGRATION_COMPRESS_XBZRLE
)
{
if
(
compression
->
methods
==
1ULL
<<
QEMU_MIGRATION_COMPRESS_XBZRLE
&&
!
compression
->
xbzrle_cache_set
)
{
*
flags
|=
VIR_MIGRATE_COMPRESSED
;
return
0
;
}
...
...
@@ -6681,5 +6747,29 @@ qemuMigrationCompressionDump(qemuMigrationCompressionPtr compression,
return
-
1
;
}
if
(
cparams
->
level_set
&&
virTypedParamsAddInt
(
params
,
nparams
,
maxparams
,
VIR_MIGRATE_PARAM_COMPRESSION_MT_LEVEL
,
cparams
->
level
)
<
0
)
return
-
1
;
if
(
cparams
->
threads_set
&&
virTypedParamsAddInt
(
params
,
nparams
,
maxparams
,
VIR_MIGRATE_PARAM_COMPRESSION_MT_THREADS
,
cparams
->
threads
)
<
0
)
return
-
1
;
if
(
cparams
->
dthreads_set
&&
virTypedParamsAddInt
(
params
,
nparams
,
maxparams
,
VIR_MIGRATE_PARAM_COMPRESSION_MT_DTHREADS
,
cparams
->
dthreads
)
<
0
)
return
-
1
;
if
(
compression
->
xbzrle_cache_set
&&
virTypedParamsAddULLong
(
params
,
nparams
,
maxparams
,
VIR_MIGRATE_PARAM_COMPRESSION_XBZRLE_CACHE
,
compression
->
xbzrle_cache
)
<
0
)
return
-
1
;
return
0
;
}
src/qemu/qemu_migration.h
浏览文件 @
061e2428
...
...
@@ -60,6 +60,10 @@ typedef qemuMigrationCompression *qemuMigrationCompressionPtr;
VIR_MIGRATE_PARAM_DISKS_PORT, VIR_TYPED_PARAM_INT, \
VIR_MIGRATE_PARAM_COMPRESSION, VIR_TYPED_PARAM_STRING | \
VIR_TYPED_PARAM_MULTIPLE, \
VIR_MIGRATE_PARAM_COMPRESSION_MT_LEVEL, VIR_TYPED_PARAM_INT, \
VIR_MIGRATE_PARAM_COMPRESSION_MT_THREADS, VIR_TYPED_PARAM_INT, \
VIR_MIGRATE_PARAM_COMPRESSION_MT_DTHREADS, VIR_TYPED_PARAM_INT, \
VIR_MIGRATE_PARAM_COMPRESSION_XBZRLE_CACHE, VIR_TYPED_PARAM_ULLONG, \
NULL
...
...
@@ -89,6 +93,11 @@ VIR_ENUM_DECL(qemuMigrationCompressMethod)
struct
_qemuMigrationCompression
{
unsigned
long
long
methods
;
qemuMonitorMigrationCompression
params
;
bool
xbzrle_cache_set
;
unsigned
long
long
xbzrle_cache
;
};
qemuMigrationCompressionPtr
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录