Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
tp-qemu
提交
7127d053
T
tp-qemu
项目概览
openeuler
/
tp-qemu
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
tp-qemu
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
7127d053
编写于
7月 22, 2020
作者:
Z
zhencliu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Incremental backup with none persistent bitmap
Signed-off-by:
N
Zhenchao Liu
<
zhencliu@redhat.com
>
上级
2544cbe4
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
153 addition
and
0 deletion
+153
-0
qemu/tests/blockdev_inc_backup_non_persistent_bitmap.py
qemu/tests/blockdev_inc_backup_non_persistent_bitmap.py
+114
-0
qemu/tests/cfg/blockdev_inc_backup_non_persistent_bitmap.cfg
qemu/tests/cfg/blockdev_inc_backup_non_persistent_bitmap.cfg
+39
-0
未找到文件。
qemu/tests/blockdev_inc_backup_non_persistent_bitmap.py
0 → 100644
浏览文件 @
7127d053
from
provider
import
backup_utils
from
provider
import
blockdev_base
from
provider
import
block_dirty_bitmap
class
BlockdevIncBackupNonPersistentBitmapTest
(
blockdev_base
.
BlockdevBaseTest
):
def
__init__
(
self
,
test
,
params
,
env
):
super
(
BlockdevIncBackupNonPersistentBitmapTest
,
self
).
__init__
(
test
,
params
,
env
)
self
.
source_images
=
[]
self
.
full_backups
=
[]
self
.
bitmaps
=
[]
self
.
src_img_tags
=
params
.
objects
(
"source_images"
)
self
.
bitmap_count
=
0
list
(
map
(
self
.
_init_arguments_by_params
,
self
.
src_img_tags
))
def
_init_arguments_by_params
(
self
,
tag
):
image_params
=
self
.
params
.
object_params
(
tag
)
image_chain
=
image_params
.
objects
(
"image_backup_chain"
)
self
.
source_images
.
append
(
"drive_%s"
%
tag
)
self
.
full_backups
.
append
(
"drive_%s"
%
image_chain
[
0
])
self
.
bitmaps
.
append
(
"bitmap_%s"
%
tag
)
def
do_full_backup
(
self
):
extra_options
=
{
"sync"
:
"full"
,
"auto_disable_bitmap"
:
False
}
backup_utils
.
blockdev_batch_backup
(
self
.
main_vm
,
self
.
source_images
,
self
.
full_backups
,
self
.
bitmaps
,
**
extra_options
)
def
get_bitmaps_info
(
self
):
out
=
[]
for
idx
,
bitmap
in
enumerate
(
self
.
bitmaps
):
node
=
self
.
source_images
[
idx
]
info
=
block_dirty_bitmap
.
get_bitmap_by_name
(
self
.
main_vm
,
node
,
bitmap
)
out
.
append
(
info
)
return
out
def
prepare_data_disk
(
self
,
tag
):
"""
Override this function, only make fs and mount it
:param tag: image tag
"""
self
.
format_data_disk
(
tag
)
def
write_files
(
self
):
return
list
(
map
(
self
.
generate_data_file
,
self
.
src_img_tags
))
def
check_bitmaps
(
self
,
file_write
=
False
):
bitmaps
=
self
.
get_bitmaps_info
()
if
not
bitmaps
:
self
.
test
.
fail
(
'No bitmap was found.'
)
for
info
in
bitmaps
:
# check if bitmap is non-persistent
if
info
[
'persistent'
]:
self
.
test
.
fail
(
'It should be non-persistent'
)
# check if count is changed after file writing
if
file_write
:
if
info
[
"count"
]
<=
self
.
bitmap_count
:
self
.
test
.
fail
(
'count of bitmap should be greater than '
'the original after writing a file'
)
else
:
self
.
bitmap_count
=
info
[
'count'
]
def
check_image_info
(
self
):
# make sure non-persistent bitmaps never exist after VM shutdown
for
tag
in
self
.
params
.
objects
(
"source_images"
):
params
=
self
.
params
.
object_params
(
tag
)
disk
=
self
.
source_disk_define_by_params
(
params
,
tag
)
out
=
disk
.
info
()
if
out
:
if
self
.
params
[
'check_bitmaps'
]
in
out
:
self
.
test
.
fail
(
'bitmap should not be in image'
)
else
:
self
.
test
.
error
(
'Error when querying image info by qemu-img'
)
def
do_test
(
self
):
self
.
do_full_backup
()
self
.
check_bitmaps
(
file_write
=
False
)
self
.
write_files
()
self
.
check_bitmaps
(
file_write
=
True
)
self
.
destroy_vms
()
self
.
check_image_info
()
def
run
(
test
,
params
,
env
):
"""
Blockdev incremental backup test: Add a non-persistent bitmap to image
test steps:
1. boot VM with a 2G data disk
2. format data disk and mount it
3. add target disks for backup to VM via qmp commands
4. do full backup and add non-persistent bitmap
5. check bitmap, persistent is False
6. create another file
7. check bitmap, count changed
8. shutdown VM
9. check non-persistent bitmaps never exist in image
:param test: test object
:param params: test configuration dict
:param env: env object
"""
inc_test
=
BlockdevIncBackupNonPersistentBitmapTest
(
test
,
params
,
env
)
inc_test
.
run_test
()
qemu/tests/cfg/blockdev_inc_backup_non_persistent_bitmap.cfg
0 → 100644
浏览文件 @
7127d053
# Storage backends:
# filesystem, iscsi_direct, gluster_direct, ceph, nbd
# The following testing scenario is covered:
# Add non-persistent bitmap on data disk
# The backup image is the local image(filesystem)
- blockdev_inc_backup_non_persistent_bitmap:
only Linux
no libcurl, libssh
start_vm = no
qemu_force_use_drive_expression = no
type = blockdev_inc_backup_non_persistent_bitmap
virt_test_type = qemu
images += " data"
source_images = "data"
image_backup_chain_data = "base"
remove_image_data = yes
force_create_image_data = yes
storage_pools = default
storage_pool = default
image_size_data = 2G
image_size_base = 2G
image_format_data = qcow2
image_format_base = qcow2
image_name_data = data
image_name_base = base
rebase_mode = unsafe
check_bitmaps = 'bitmaps:'
storage_type_default = "directory"
nbd:
force_create_image_data = no
nbd_port_data = 10822
image_create_support_data = no
iscsi_direct:
lun_data = 1
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录