qemu with hax to log dma reads & writes jcs.org/2018/11/12/vfio

iotests: Mirror with different source/target size

This tests that the mirror job catches situations where the target node
has a different size than the source node. It must also forbid resize
operations when the job is already running.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Message-Id: <20200511135825.219437-5-kwolf@redhat.com>
Reviewed-by: Max Reitz <mreitz@redhat.com>
Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>

+47 -2
+45
tests/qemu-iotests/041
··· 240 240 target=self.qmp_target) 241 241 self.assert_qmp(result, 'error/class', 'GenericError') 242 242 243 + def do_test_resize(self, device, node): 244 + def pre_finalize(): 245 + if device: 246 + result = self.vm.qmp('block_resize', device=device, size=65536) 247 + self.assert_qmp(result, 'error/class', 'GenericError') 248 + 249 + result = self.vm.qmp('block_resize', node_name=node, size=65536) 250 + self.assert_qmp(result, 'error/class', 'GenericError') 251 + 252 + result = self.vm.qmp(self.qmp_cmd, job_id='job0', device='drive0', 253 + sync='full', target=self.qmp_target, 254 + auto_finalize=False, auto_dismiss=False) 255 + self.assert_qmp(result, 'return', {}) 256 + 257 + result = self.vm.run_job('job0', auto_finalize=False, 258 + pre_finalize=pre_finalize) 259 + self.assertEqual(result, None) 260 + 261 + def test_source_resize(self): 262 + self.do_test_resize('drive0', 'top') 263 + 264 + def test_target_resize(self): 265 + self.do_test_resize(None, self.qmp_target) 266 + 267 + def do_test_target_size(self, size): 268 + result = self.vm.qmp('block_resize', node_name=self.qmp_target, 269 + size=size) 270 + self.assert_qmp(result, 'return', {}) 271 + 272 + result = self.vm.qmp(self.qmp_cmd, job_id='job0', 273 + device='drive0', sync='full', auto_dismiss=False, 274 + target=self.qmp_target) 275 + self.assert_qmp(result, 'return', {}) 276 + 277 + result = self.vm.run_job('job0') 278 + self.assertEqual(result, 'Source and target image have different sizes') 279 + 280 + def test_small_target(self): 281 + self.do_test_target_size(self.image_len // 2) 282 + 283 + def test_large_target(self): 284 + self.do_test_target_size(self.image_len * 2) 285 + 243 286 test_large_cluster = None 244 287 test_image_not_found = None 245 288 test_small_buffer2 = None ··· 251 294 252 295 class TestSingleBlockdevZeroLength(TestSingleBlockdev): 253 296 image_len = 0 297 + test_small_target = None 298 + test_large_target = None 254 299 255 300 class TestSingleDriveUnalignedLength(TestSingleDrive): 256 301 image_len = 1025 * 1024
+2 -2
tests/qemu-iotests/041.out
··· 1 - .............................................................................................. 1 + ........................................................................................................ 2 2 ---------------------------------------------------------------------- 3 - Ran 94 tests 3 + Ran 104 tests 4 4 5 5 OK