Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
libvirt
提交
492afb82
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,发现更多精彩内容 >>
提交
492afb82
编写于
2月 18, 2013
作者:
J
Jiri Denemark
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
qemu: Implement virDomainMigrate*CompressionCache
上级
e94aeb14
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
223 addition
and
0 deletion
+223
-0
src/qemu/qemu_driver.c
src/qemu/qemu_driver.c
+107
-0
src/qemu/qemu_monitor.c
src/qemu/qemu_monitor.c
+43
-0
src/qemu/qemu_monitor.h
src/qemu/qemu_monitor.h
+5
-0
src/qemu/qemu_monitor_json.c
src/qemu/qemu_monitor_json.c
+63
-0
src/qemu/qemu_monitor_json.h
src/qemu/qemu_monitor_json.h
+5
-0
未找到文件。
src/qemu/qemu_driver.c
浏览文件 @
492afb82
...
@@ -10432,6 +10432,111 @@ cleanup:
...
@@ -10432,6 +10432,111 @@ cleanup:
return
ret
;
return
ret
;
}
}
static
int
qemuDomainMigrateGetCompressionCache
(
virDomainPtr
dom
,
unsigned
long
long
*
cacheSize
,
unsigned
int
flags
)
{
virQEMUDriverPtr
driver
=
dom
->
conn
->
privateData
;
virDomainObjPtr
vm
;
qemuDomainObjPrivatePtr
priv
;
int
ret
=
-
1
;
virCheckFlags
(
0
,
-
1
);
if
(
!
(
vm
=
qemuDomObjFromDomain
(
dom
)))
goto
cleanup
;
if
(
qemuDomainObjBeginJob
(
driver
,
vm
,
QEMU_JOB_QUERY
)
<
0
)
goto
cleanup
;
if
(
!
virDomainObjIsActive
(
vm
))
{
virReportError
(
VIR_ERR_OPERATION_INVALID
,
"%s"
,
_
(
"domain is not running"
));
goto
endjob
;
}
priv
=
vm
->
privateData
;
qemuDomainObjEnterMonitor
(
driver
,
vm
);
ret
=
qemuMonitorGetMigrationCapability
(
priv
->
mon
,
QEMU_MONITOR_MIGRATION_CAPS_XBZRLE
);
if
(
ret
==
0
)
{
virReportError
(
VIR_ERR_OPERATION_UNSUPPORTED
,
"%s"
,
_
(
"Compressed migration is not supported by "
"QEMU binary"
));
ret
=
-
1
;
}
else
if
(
ret
>
0
)
{
ret
=
qemuMonitorGetMigrationCacheSize
(
priv
->
mon
,
cacheSize
);
}
qemuDomainObjExitMonitor
(
driver
,
vm
);
endjob:
if
(
qemuDomainObjEndJob
(
driver
,
vm
)
==
0
)
vm
=
NULL
;
cleanup:
if
(
vm
)
virObjectUnlock
(
vm
);
return
ret
;
}
static
int
qemuDomainMigrateSetCompressionCache
(
virDomainPtr
dom
,
unsigned
long
long
cacheSize
,
unsigned
int
flags
)
{
virQEMUDriverPtr
driver
=
dom
->
conn
->
privateData
;
virDomainObjPtr
vm
;
qemuDomainObjPrivatePtr
priv
;
int
ret
=
-
1
;
virCheckFlags
(
0
,
-
1
);
if
(
!
(
vm
=
qemuDomObjFromDomain
(
dom
)))
goto
cleanup
;
if
(
qemuDomainObjBeginJob
(
driver
,
vm
,
QEMU_JOB_MIGRATION_OP
)
<
0
)
goto
cleanup
;
if
(
!
virDomainObjIsActive
(
vm
))
{
virReportError
(
VIR_ERR_OPERATION_INVALID
,
"%s"
,
_
(
"domain is not running"
));
goto
endjob
;
}
priv
=
vm
->
privateData
;
qemuDomainObjEnterMonitor
(
driver
,
vm
);
ret
=
qemuMonitorGetMigrationCapability
(
priv
->
mon
,
QEMU_MONITOR_MIGRATION_CAPS_XBZRLE
);
if
(
ret
==
0
)
{
virReportError
(
VIR_ERR_OPERATION_UNSUPPORTED
,
"%s"
,
_
(
"Compressed migration is not supported by "
"QEMU binary"
));
ret
=
-
1
;
}
else
if
(
ret
>
0
)
{
VIR_DEBUG
(
"Setting compression cache to %llu B"
,
cacheSize
);
ret
=
qemuMonitorSetMigrationCacheSize
(
priv
->
mon
,
cacheSize
);
}
qemuDomainObjExitMonitor
(
driver
,
vm
);
endjob:
if
(
qemuDomainObjEndJob
(
driver
,
vm
)
==
0
)
vm
=
NULL
;
cleanup:
if
(
vm
)
virObjectUnlock
(
vm
);
return
ret
;
}
static
int
static
int
qemuDomainMigrateSetMaxSpeed
(
virDomainPtr
dom
,
qemuDomainMigrateSetMaxSpeed
(
virDomainPtr
dom
,
unsigned
long
bandwidth
,
unsigned
long
bandwidth
,
...
@@ -14993,6 +15098,8 @@ static virDriver qemuDriver = {
...
@@ -14993,6 +15098,8 @@ static virDriver qemuDriver = {
.
domainGetJobStats
=
qemuDomainGetJobStats
,
/* 1.0.3 */
.
domainGetJobStats
=
qemuDomainGetJobStats
,
/* 1.0.3 */
.
domainAbortJob
=
qemuDomainAbortJob
,
/* 0.7.7 */
.
domainAbortJob
=
qemuDomainAbortJob
,
/* 0.7.7 */
.
domainMigrateSetMaxDowntime
=
qemuDomainMigrateSetMaxDowntime
,
/* 0.8.0 */
.
domainMigrateSetMaxDowntime
=
qemuDomainMigrateSetMaxDowntime
,
/* 0.8.0 */
.
domainMigrateGetCompressionCache
=
qemuDomainMigrateGetCompressionCache
,
/* 1.0.3 */
.
domainMigrateSetCompressionCache
=
qemuDomainMigrateSetCompressionCache
,
/* 1.0.3 */
.
domainMigrateSetMaxSpeed
=
qemuDomainMigrateSetMaxSpeed
,
/* 0.9.0 */
.
domainMigrateSetMaxSpeed
=
qemuDomainMigrateSetMaxSpeed
,
/* 0.9.0 */
.
domainMigrateGetMaxSpeed
=
qemuDomainMigrateGetMaxSpeed
,
/* 0.9.5 */
.
domainMigrateGetMaxSpeed
=
qemuDomainMigrateGetMaxSpeed
,
/* 0.9.5 */
.
domainEventRegisterAny
=
qemuDomainEventRegisterAny
,
/* 0.8.0 */
.
domainEventRegisterAny
=
qemuDomainEventRegisterAny
,
/* 0.8.0 */
...
...
src/qemu/qemu_monitor.c
浏览文件 @
492afb82
...
@@ -1804,6 +1804,49 @@ int qemuMonitorSetMigrationDowntime(qemuMonitorPtr mon,
...
@@ -1804,6 +1804,49 @@ int qemuMonitorSetMigrationDowntime(qemuMonitorPtr mon,
}
}
int
qemuMonitorGetMigrationCacheSize
(
qemuMonitorPtr
mon
,
unsigned
long
long
*
cacheSize
)
{
VIR_DEBUG
(
"mon=%p cacheSize=%p"
,
mon
,
cacheSize
);
if
(
!
mon
)
{
virReportError
(
VIR_ERR_INVALID_ARG
,
"%s"
,
_
(
"monitor must not be NULL"
));
return
-
1
;
}
if
(
!
mon
->
json
)
{
virReportError
(
VIR_ERR_OPERATION_UNSUPPORTED
,
"%s"
,
_
(
"JSON monitor is required"
));
return
-
1
;
}
return
qemuMonitorJSONGetMigrationCacheSize
(
mon
,
cacheSize
);
}
int
qemuMonitorSetMigrationCacheSize
(
qemuMonitorPtr
mon
,
unsigned
long
long
cacheSize
)
{
VIR_DEBUG
(
"mon=%p cacheSize=%llu"
,
mon
,
cacheSize
);
if
(
!
mon
)
{
virReportError
(
VIR_ERR_INVALID_ARG
,
"%s"
,
_
(
"monitor must not be NULL"
));
return
-
1
;
}
if
(
!
mon
->
json
)
{
virReportError
(
VIR_ERR_OPERATION_UNSUPPORTED
,
"%s"
,
_
(
"JSON monitor is required"
));
return
-
1
;
}
return
qemuMonitorJSONSetMigrationCacheSize
(
mon
,
cacheSize
);
}
int
qemuMonitorGetMigrationStatus
(
qemuMonitorPtr
mon
,
int
qemuMonitorGetMigrationStatus
(
qemuMonitorPtr
mon
,
qemuMonitorMigrationStatusPtr
status
)
qemuMonitorMigrationStatusPtr
status
)
{
{
...
...
src/qemu/qemu_monitor.h
浏览文件 @
492afb82
...
@@ -326,6 +326,11 @@ int qemuMonitorSetMigrationSpeed(qemuMonitorPtr mon,
...
@@ -326,6 +326,11 @@ int qemuMonitorSetMigrationSpeed(qemuMonitorPtr mon,
int
qemuMonitorSetMigrationDowntime
(
qemuMonitorPtr
mon
,
int
qemuMonitorSetMigrationDowntime
(
qemuMonitorPtr
mon
,
unsigned
long
long
downtime
);
unsigned
long
long
downtime
);
int
qemuMonitorGetMigrationCacheSize
(
qemuMonitorPtr
mon
,
unsigned
long
long
*
cacheSize
);
int
qemuMonitorSetMigrationCacheSize
(
qemuMonitorPtr
mon
,
unsigned
long
long
cacheSize
);
enum
{
enum
{
QEMU_MONITOR_MIGRATION_STATUS_INACTIVE
,
QEMU_MONITOR_MIGRATION_STATUS_INACTIVE
,
QEMU_MONITOR_MIGRATION_STATUS_ACTIVE
,
QEMU_MONITOR_MIGRATION_STATUS_ACTIVE
,
...
...
src/qemu/qemu_monitor_json.c
浏览文件 @
492afb82
...
@@ -2256,6 +2256,69 @@ int qemuMonitorJSONSetMigrationDowntime(qemuMonitorPtr mon,
...
@@ -2256,6 +2256,69 @@ int qemuMonitorJSONSetMigrationDowntime(qemuMonitorPtr mon,
}
}
int
qemuMonitorJSONGetMigrationCacheSize
(
qemuMonitorPtr
mon
,
unsigned
long
long
*
cacheSize
)
{
int
ret
;
virJSONValuePtr
cmd
;
virJSONValuePtr
reply
=
NULL
;
*
cacheSize
=
0
;
cmd
=
qemuMonitorJSONMakeCommand
(
"query-migrate-cache-size"
,
NULL
);
if
(
!
cmd
)
return
-
1
;
ret
=
qemuMonitorJSONCommand
(
mon
,
cmd
,
&
reply
);
if
(
ret
==
0
)
ret
=
qemuMonitorJSONCheckError
(
cmd
,
reply
);
if
(
ret
<
0
)
goto
cleanup
;
ret
=
virJSONValueObjectGetNumberUlong
(
reply
,
"return"
,
cacheSize
);
if
(
ret
<
0
)
{
virReportError
(
VIR_ERR_INTERNAL_ERROR
,
"%s"
,
_
(
"query-migrate-cache-size reply was missing "
"'return' data"
));
goto
cleanup
;
}
ret
=
0
;
cleanup:
virJSONValueFree
(
cmd
);
virJSONValueFree
(
reply
);
return
ret
;
}
int
qemuMonitorJSONSetMigrationCacheSize
(
qemuMonitorPtr
mon
,
unsigned
long
long
cacheSize
)
{
int
ret
;
virJSONValuePtr
cmd
;
virJSONValuePtr
reply
=
NULL
;
cmd
=
qemuMonitorJSONMakeCommand
(
"migrate-set-cache-size"
,
"U:value"
,
cacheSize
,
NULL
);
if
(
!
cmd
)
return
-
1
;
ret
=
qemuMonitorJSONCommand
(
mon
,
cmd
,
&
reply
);
if
(
ret
==
0
)
ret
=
qemuMonitorJSONCheckError
(
cmd
,
reply
);
virJSONValueFree
(
cmd
);
virJSONValueFree
(
reply
);
return
ret
;
}
static
int
static
int
qemuMonitorJSONGetMigrationStatusReply
(
virJSONValuePtr
reply
,
qemuMonitorJSONGetMigrationStatusReply
(
virJSONValuePtr
reply
,
qemuMonitorMigrationStatusPtr
status
)
qemuMonitorMigrationStatusPtr
status
)
...
...
src/qemu/qemu_monitor_json.h
浏览文件 @
492afb82
...
@@ -120,6 +120,11 @@ int qemuMonitorJSONSetMigrationSpeed(qemuMonitorPtr mon,
...
@@ -120,6 +120,11 @@ int qemuMonitorJSONSetMigrationSpeed(qemuMonitorPtr mon,
int
qemuMonitorJSONSetMigrationDowntime
(
qemuMonitorPtr
mon
,
int
qemuMonitorJSONSetMigrationDowntime
(
qemuMonitorPtr
mon
,
unsigned
long
long
downtime
);
unsigned
long
long
downtime
);
int
qemuMonitorJSONGetMigrationCacheSize
(
qemuMonitorPtr
mon
,
unsigned
long
long
*
cacheSize
);
int
qemuMonitorJSONSetMigrationCacheSize
(
qemuMonitorPtr
mon
,
unsigned
long
long
cacheSize
);
int
qemuMonitorJSONGetMigrationStatus
(
qemuMonitorPtr
mon
,
int
qemuMonitorJSONGetMigrationStatus
(
qemuMonitorPtr
mon
,
qemuMonitorMigrationStatusPtr
status
);
qemuMonitorMigrationStatusPtr
status
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录