未验证 提交 d7aeabff 编写于 作者: Y YongxueHong 提交者: GitHub

Merge pull request #2182 from aliang123/1820491

Commit during guest reboot
...@@ -94,6 +94,18 @@ class BlockDevCommitTest(object): ...@@ -94,6 +94,18 @@ class BlockDevCommitTest(object):
return kname return kname
return None return None
def configure_disk(self, tag):
"""
support configuration on both system and data disk
"""
if tag == self.params["images"].split()[0]:
self.configure_system_disk(tag)
else:
self.configure_data_disk(tag)
def configure_system_disk(self, tag):
self.disks_info.append(["", self.params["mount_point"], tag])
def configure_data_disk(self, tag): def configure_data_disk(self, tag):
os_type = self.params["os_type"] os_type = self.params["os_type"]
disk_params = self.params.object_params(tag) disk_params = self.params.object_params(tag)
...@@ -132,7 +144,7 @@ class BlockDevCommitTest(object): ...@@ -132,7 +144,7 @@ class BlockDevCommitTest(object):
device_params = self.params.object_params(device) device_params = self.params.object_params(device)
snapshot_tags = device_params["snapshot_tags"].split() snapshot_tags = device_params["snapshot_tags"].split()
self.device_node = self.get_node_name(device) self.device_node = self.get_node_name(device)
self.configure_data_disk(device) self.configure_disk(device)
self.prepare_snapshot_file(snapshot_tags) self.prepare_snapshot_file(snapshot_tags)
self.create_snapshots(snapshot_tags, device) self.create_snapshots(snapshot_tags, device)
......
from provider import backup_utils
from provider import job_utils
from provider.blockdev_commit_base import BlockDevCommitTest
class BlockdevCommitReboot(BlockDevCommitTest):
def commit_snapshots(self):
device = self.params.get("device_tag")
device_params = self.params.object_params(device)
snapshot_tags = device_params["snapshot_tags"].split()
self.device_node = self.get_node_name(device)
options = ["base-node", "top-node", "speed"]
arguments = self.params.copy_from_keys(options)
arguments["base-node"] = self.get_node_name(device)
arguments["top-node"] = self.get_node_name(snapshot_tags[-2])
device = self.get_node_name(snapshot_tags[-1])
commit_cmd = backup_utils.block_commit_qmp_cmd
cmd, args = commit_cmd(device, **arguments)
self.main_vm.monitor.cmd(cmd, args)
job_id = args.get("job-id", device)
self.main_vm.reboot(method="system_reset")
job_utils.wait_until_block_job_completed(self.main_vm, job_id)
def run(test, params, env):
"""
Block commit base Test
1. boot guest with data disk
2. create 4 snapshots and save file in each snapshot
3. commit snapshot 4 to snapshot 3
4. during commit, reboot guest
5. verify files's md5 after commit
"""
block_test = BlockdevCommitReboot(test, params, env)
block_test.run_test()
- blockdev_commit_reboot:
type = blockdev_commit_reboot
virt_test_type = qemu
only Linux
start_vm = yes
kill_vm = yes
storage_pools = default
storage_type_default = "directory"
storage_pool = default
snapshot_tags = sn1 sn2 sn3 sn4
image_name_sn1 = sn1
image_format_sn1 = qcow2
image_name_sn2 = sn2
image_format_sn2 = qcow2
image_name_sn3 = sn3
image_format_sn3 = qcow2
image_name_sn4 = sn4
image_format_sn4 = qcow2
device_tag = "image1"
rebase_mode = unsafe
mount_point = "/tmp"
qemu_force_use_drive_expression = no
Windows:
mount_point = "C:\\"
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册