Commit a1be5921 authored by Kevin Wolf's avatar Kevin Wolf
Browse files

Merge remote-tracking branch 'mreitz/tags/pull-block-2018-03-09' into queue-block



Block patches

# gpg: Signature made Fri Mar  9 15:40:32 2018 CET
# gpg:                using RSA key F407DB0061D5CF40
# gpg: Good signature from "Max Reitz <mreitz@redhat.com>"
# Primary key fingerprint: 91BE B60A 30DB 3E88 57D1  1829 F407 DB00 61D5 CF40

* mreitz/tags/pull-block-2018-03-09:
  qemu-iotests: fix 203 migration completion race
  iotests: Tweak 030 in order to trigger a race condition with parallel jobs
  iotests: Skip test for ENOMEM error
  iotests: Mark all tests executable
  iotests: Test creating overlay when guest running

Signed-off-by: default avatarKevin Wolf <kwolf@redhat.com>
parents 56ea7450 21794244
Loading
Loading
Loading
Loading
+43 −9
Original line number Diff line number Diff line
@@ -156,7 +156,7 @@ class TestSingleDrive(iotests.QMPTestCase):
class TestParallelOps(iotests.QMPTestCase):
    num_ops = 4 # Number of parallel block-stream operations
    num_imgs = num_ops * 2 + 1
    image_len = num_ops * 1024 * 1024
    image_len = num_ops * 512 * 1024
    imgs = []

    def setUp(self):
@@ -176,14 +176,14 @@ class TestParallelOps(iotests.QMPTestCase):
                     '-o', 'backing_file=%s' % self.imgs[i-1], self.imgs[i])

        # Put data into the images we are copying data from
        for i in range(self.num_imgs / 2):
            img_index = i * 2 + 1
            # Alternate between 512k and 1M.
        odd_img_indexes = [x for x in reversed(range(self.num_imgs)) if x % 2 == 1]
        for i in range(len(odd_img_indexes)):
            # Alternate between 256KB and 512KB.
            # This way jobs will not finish in the same order they were created
            num_kb = 512 + 512 * (i % 2)
            num_kb = 256 + 256 * (i % 2)
            qemu_io('-f', iotests.imgfmt,
                    '-c', 'write -P %d %d %d' % (i, i*1024*1024, num_kb * 1024),
                    self.imgs[img_index])
                    '-c', 'write -P 0xFF %dk %dk' % (i * 512, num_kb),
                    self.imgs[odd_img_indexes[i]])

        # Attach the drive to the VM
        self.vm = iotests.VM()
@@ -318,12 +318,14 @@ class TestParallelOps(iotests.QMPTestCase):
        self.wait_until_completed(drive='commit-drive0')

    # Test a block-stream and a block-commit job in parallel
    def test_stream_commit(self):
    # Here the stream job is supposed to finish quickly in order to reproduce
    # the scenario that triggers the bug fixed in 3d5d319e1221 and 1a63a907507
    def test_stream_commit_1(self):
        self.assertLessEqual(8, self.num_imgs)
        self.assert_no_active_block_jobs()

        # Stream from node0 into node2
        result = self.vm.qmp('block-stream', device='node2', job_id='node2')
        result = self.vm.qmp('block-stream', device='node2', base_node='node0', job_id='node2')
        self.assert_qmp(result, 'return', {})

        # Commit from the active layer into node3
@@ -348,6 +350,38 @@ class TestParallelOps(iotests.QMPTestCase):

        self.assert_no_active_block_jobs()

    # This is similar to test_stream_commit_1 but both jobs are slowed
    # down so they can run in parallel for a little while.
    def test_stream_commit_2(self):
        self.assertLessEqual(8, self.num_imgs)
        self.assert_no_active_block_jobs()

        # Stream from node0 into node4
        result = self.vm.qmp('block-stream', device='node4', base_node='node0', job_id='node4', speed=1024*1024)
        self.assert_qmp(result, 'return', {})

        # Commit from the active layer into node5
        result = self.vm.qmp('block-commit', device='drive0', base=self.imgs[5], speed=1024*1024)
        self.assert_qmp(result, 'return', {})

        # Wait for all jobs to be finished.
        pending_jobs = ['node4', 'drive0']
        while len(pending_jobs) > 0:
            for event in self.vm.get_qmp_events(wait=True):
                if event['event'] == 'BLOCK_JOB_COMPLETED':
                    node_name = self.dictpath(event, 'data/device')
                    self.assertTrue(node_name in pending_jobs)
                    self.assert_qmp_absent(event, 'data/error')
                    pending_jobs.remove(node_name)
                if event['event'] == 'BLOCK_JOB_READY':
                    self.assert_qmp(event, 'data/device', 'drive0')
                    self.assert_qmp(event, 'data/type', 'commit')
                    self.assert_qmp_absent(event, 'data/error')
                    self.assertTrue('drive0' in pending_jobs)
                    self.vm.qmp('block-job-complete', device='drive0')

        self.assert_no_active_block_jobs()

    # Test the base_node parameter
    def test_stream_base_node_name(self):
        self.assert_no_active_block_jobs()
+2 −2
Original line number Diff line number Diff line
.......................
........................
----------------------------------------------------------------------
Ran 23 tests
Ran 24 tests

OK
+2 −3
Original line number Diff line number Diff line
@@ -152,9 +152,8 @@ done
echo
echo "=== Testing afl image with a very large capacity ==="
_use_sample_img afl9.vmdk.bz2
# The sed makes this test pass on machines with little RAM
# (and also with 32 bit builds)
_img_info | sed -e 's/Cannot allocate memory/Invalid argument/'
_img_info | grep -q 'Cannot allocate memory' && _notrun "Insufficent memory, skipped test"
_img_info
_cleanup_test_img

# success, all done

tests/qemu-iotests/096

100644 → 100755
+0 −0

File mode changed from 100644 to 100755.

tests/qemu-iotests/124

100644 → 100755
+0 −0

File mode changed from 100644 to 100755.

Loading