Beispiel #1
0
 def make_env(self,
              storage_type,
              src_fmt,
              dst_fmt,
              chain_length=1,
              size=DEFAULT_SIZE,
              sd_version=3,
              src_qcow2_compat='0.10',
              prealloc=sc.SPARSE_VOL):
     with fake_env(storage_type, sd_version=sd_version) as env:
         rm = FakeResourceManager()
         with MonkeyPatchScope([
             (guarded, 'context', fake_guarded_context()),
             (copy_data, 'sdCache', env.sdcache),
             (blockVolume, 'rm', rm),
         ]):
             # Create existing volume - may use compat 0.10 or 1.1.
             src_vols = make_qemu_chain(env,
                                        size,
                                        src_fmt,
                                        chain_length,
                                        qcow2_compat=src_qcow2_compat,
                                        prealloc=prealloc)
             # New volumes are always created using the domain
             # prefered format.
             sd_compat = env.sd_manifest.qcow2_compat()
             dst_vols = make_qemu_chain(env,
                                        size,
                                        dst_fmt,
                                        chain_length,
                                        qcow2_compat=sd_compat,
                                        prealloc=prealloc)
             env.src_chain = src_vols
             env.dst_chain = dst_vols
             yield env
Beispiel #2
0
    def make_env(self,
                 sd_type='block',
                 format='raw',
                 prealloc=sc.SPARSE_VOL,
                 chain_len=2):
        size = 2 * GiB
        base_fmt = sc.name2type(format)
        with fake_env(sd_type) as env:
            with MonkeyPatch().context() as mp:
                mp.setattr(guarded, 'context', fake_guarded_context())
                mp.setattr(merge, 'sdCache', env.sdcache)
                mp.setattr(blockVolume, 'rm', FakeResourceManager())
                mp.setattr(image, 'Image', FakeImage)

                env.chain = make_qemu_chain(env,
                                            size,
                                            base_fmt,
                                            chain_len,
                                            prealloc=prealloc)

                volumes = {(vol.imgUUID, vol.volUUID): FakeVolume()
                           for vol in env.chain}
                env.sdcache.domains[env.sd_manifest.sdUUID].volumes = volumes

                def fake_chain(self, sdUUID, imgUUID, volUUID=None):
                    return env.chain

                image.Image.getChain = fake_chain
                image.Image.syncVolumeChain = FakeSyncVolumeChain()

                yield env
Beispiel #3
0
def test_make_qemu_chain(storage_type):
    with fake_env(storage_type) as env:
        vol_list = make_qemu_chain(env, 0, sc.RAW_FORMAT, 2)
        msg = "Internal volume has wrong type: %s" % vol_list[0].getVolType()
        assert vol_list[0].isInternal(), msg
        msg = "Leaf volume has wrong type: %s" % vol_list[1].getVolType()
        assert vol_list[1].isLeaf(), msg
Beispiel #4
0
 def make_volume(self, size, storage_type='file', format=sc.RAW_FORMAT):
     img_id = make_uuid()
     vol_id = make_uuid()
     with fake_env(storage_type) as env:
         env.make_volume(size, img_id, vol_id, vol_format=format)
         vol = env.sd_manifest.produceVolume(img_id, vol_id)
         yield vol
Beispiel #5
0
 def make_volume(self, size, storage_type='file', format=sc.RAW_FORMAT):
     img_id = make_uuid()
     vol_id = make_uuid()
     with fake_env(storage_type) as env:
         env.make_volume(size, img_id, vol_id, vol_format=format)
         vol = env.sd_manifest.produceVolume(img_id, vol_id)
         yield vol
Beispiel #6
0
 def volume(self):
     img_id = make_uuid()
     vol_id = make_uuid()
     with fake_env('file') as env:
         env.make_volume(MB, img_id, vol_id)
         vol = env.sd_manifest.produceVolume(img_id, vol_id)
         yield vol
Beispiel #7
0
    def make_env(self,
                 sd_type,
                 chain_len=2,
                 base_format=sc.RAW_FORMAT,
                 qcow2_compat='0.10'):
        size = MiB
        base_fmt = base_format
        with fake_env(sd_type) as env:
            rm = FakeResourceManager()
            with MonkeyPatchScope([
                (guarded, 'context', fake_guarded_context()),
                (image, 'sdCache', env.sdcache),
                (merge, 'sdCache', env.sdcache),
                (blockVolume, 'rm', rm),
                (image, 'Image', FakeImage),
            ]):
                env.chain = make_qemu_chain(env,
                                            size,
                                            base_fmt,
                                            chain_len,
                                            qcow2_compat=qcow2_compat)

                def fake_chain(sdUUID, imgUUID, volUUID=None):
                    return env.chain

                image.Image.getChain = fake_chain

                yield env
Beispiel #8
0
    def test_pattern_written_to_base_raises(self, storage_type):
        with fake_env(storage_type) as env:
            vol_list = make_qemu_chain(env, MB, sc.RAW_FORMAT, 3)

            # Writes the entire pattern into the base volume
            bad_list = vol_list[:1] * 3
            write_qemu_chain(bad_list)
            self.assertRaises(qemuio.VerificationError, verify_qemu_chain,
                              vol_list)
Beispiel #9
0
    def test_optimal_size_cow_internal_as_leaf(self):
        def fake_check(path, format):
            return {'offset': 512 * MiB}

        with fake_env('block') as env:
            with MonkeyPatchScope([(qemuimg, 'check', fake_check)]):
                env.chain = make_qemu_chain(env, 3 * GiB, sc.COW_FORMAT, 3)
                vol = env.chain[1]
                self.assertEqual(vol.optimal_size(as_leaf=True), 1536 * MiB)
Beispiel #10
0
    def test_pattern_written_to_base_raises(self, storage_type):
        with fake_env(storage_type) as env:
            vol_list = make_qemu_chain(env, MB, sc.RAW_FORMAT, 3)

            # Writes the entire pattern into the base volume
            bad_list = vol_list[:1] * 3
            write_qemu_chain(bad_list)
            self.assertRaises(qemuio.VerificationError,
                              verify_qemu_chain, vol_list)
Beispiel #11
0
    def test_get_children(self):
        remote_path = "[2001:db8:85a3::8a2e:370:7334]:1234:/path"
        size = 5 * MEGAB

        # Simulate a domain with an ipv6 address
        with fake_env(storage_type='file', remote_path=remote_path) as env:
            env.chain = make_qemu_chain(env, size, sc.name2type('raw'), 2)
            base_vol = env.chain[0]
            assert (env.chain[1].volUUID, ) == base_vol.getChildren()
Beispiel #12
0
 def test_make_qemu_chain(self, storage_type):
     with fake_env(storage_type) as env:
         vol_list = make_qemu_chain(env, 0, sc.RAW_FORMAT, 2)
         self.assertTrue(vol_list[0].isInternal(),
                         "Internal volume has wrong type: %s"
                         % vol_list[0].getVolType())
         self.assertTrue(vol_list[1].isLeaf(),
                         "Leaf volume has wrong type: %s"
                         % vol_list[1].getVolType())
Beispiel #13
0
    def test_get_children(self):
        remote_path = "[2001:db8:85a3::8a2e:370:7334]:1234:/path"
        size = 5 * MEGAB

        # Simulate a domain with an ipv6 address
        with fake_env(storage_type='file', remote_path=remote_path) as env:
            env.chain = make_qemu_chain(env, size, sc.name2type('raw'), 2)
            base_vol = env.chain[0]
            assert (env.chain[1].volUUID,) == base_vol.getChildren()
Beispiel #14
0
def test_pattern_written_to_base_raises(storage_type):
    with fake_env(storage_type) as env:
        vol_list = make_qemu_chain(env, MiB, sc.RAW_FORMAT, 3)

        # Writes the entire pattern into the base volume.
        bad_list = vol_list[:1] * 3
        write_qemu_chain(bad_list)
        with pytest.raises(qemuio.VerificationError):
            verify_qemu_chain(vol_list)
Beispiel #15
0
    def test_optimal_size_cow_internal(self, actual_size, optimal_size):
        def fake_check(path, format):
            return {'offset': actual_size}

        with fake_env('block') as env:
            # In order to test edge cases, mainly of volumes with big data, we
            # fake qemuimg check to return big volumes size, instead of writing
            # big data to volumes, an operation that takes long time.
            with MonkeyPatchScope([(qemuimg, 'check', fake_check)]):
                env.chain = make_qemu_chain(env, actual_size, sc.COW_FORMAT, 3)
                self.assertEqual(env.chain[1].optimal_size(), optimal_size)
Beispiel #16
0
    def test_optimal_size_cow_internal(self, actual_size, optimal_size):
        def fake_check(path, format):
            return {'offset': actual_size}

        with fake_env('block') as env:
            # In order to test edge cases, mainly of volumes with big data, we
            # fake qemuimg check to return big volumes size, instead of writing
            # big data to volumes, an operation that takes long time.
            with MonkeyPatchScope([(qemuimg, 'check', fake_check)]):
                env.chain = make_qemu_chain(env, actual_size, sc.COW_FORMAT, 3)
                self.assertEqual(env.chain[1].optimal_size(), optimal_size)
Beispiel #17
0
 def make_volume(self, size, storage_type='block', format=sc.RAW_FORMAT):
     img_id = make_uuid()
     vol_id = make_uuid()
     # TODO fix make_volume helper to create the qcow image when needed
     with fake_env(storage_type) as env:
         if format == sc.RAW_FORMAT:
             env.make_volume(size, img_id, vol_id, vol_format=format)
             vol = env.sd_manifest.produceVolume(img_id, vol_id)
             yield vol
         else:
             chain = make_qemu_chain(env, size, format, 1)
             yield chain[0]
Beispiel #18
0
 def make_env(self, storage_type, fmt=sc.name2type('cow'), chain_length=1,
              size=DEFAULT_SIZE, qcow2_compat='0.10'):
     with fake_env(storage_type, sd_version=4) as env:
         rm = FakeResourceManager()
         with MonkeyPatchScope([
             (guarded, 'context', fake_guarded_context()),
             (copy_data, 'sdCache', env.sdcache),
             (blockVolume, 'rm', rm),
         ]):
             env.chain = make_qemu_chain(env, size, fmt, chain_length,
                                         qcow2_compat=qcow2_compat)
             yield env
Beispiel #19
0
 def make_volume(self, size, storage_type='block', format=sc.RAW_FORMAT):
     img_id = make_uuid()
     vol_id = make_uuid()
     # TODO fix make_volume helper to create the qcow image when needed
     with fake_env(storage_type) as env:
         if format == sc.RAW_FORMAT:
             env.make_volume(size, img_id, vol_id, vol_format=format)
             vol = env.sd_manifest.produceVolume(img_id, vol_id)
             yield vol
         else:
             chain = make_qemu_chain(env, size, format, 1)
             yield chain[0]
Beispiel #20
0
 def make_env(self, storage_type, fmt=sc.name2type('cow'), chain_length=1,
              size=DEFAULT_SIZE, qcow2_compat='0.10'):
     with fake_env(storage_type, sd_version=4) as env:
         rm = FakeResourceManager()
         with MonkeyPatchScope([
             (guarded, 'context', fake_guarded_context()),
             (copy_data, 'sdCache', env.sdcache),
             (blockVolume, 'rm', rm),
         ]):
             env.chain = make_qemu_chain(env, size, fmt, chain_length,
                                         qcow2_compat=qcow2_compat)
             yield env
Beispiel #21
0
    def test_get_image_volumes(self):
        img_id = make_uuid()
        vol_id = make_uuid()
        remote_path = "[2001:db8:85a3::8a2e:370:7334]:1234:/path"
        size = 5 * MEGAB

        # Simulate a domain with an ipv6 address
        with fake_env(storage_type='file', remote_path=remote_path) as env:
            env.make_volume(size, img_id, vol_id)
            vol = env.sd_manifest.produceVolume(img_id, vol_id)
            vol_path = vol.getVolumePath()
            sduuid = fileVolume.getDomUuidFromVolumePath(vol_path)

            assert vol.getImageVolumes(sduuid, img_id) == [vol_id]
Beispiel #22
0
    def test_get_image_volumes(self):
        img_id = make_uuid()
        vol_id = make_uuid()
        remote_path = "[2001:db8:85a3::8a2e:370:7334]:1234:/path"
        size = 5 * MEGAB

        # Simulate a domain with an ipv6 address
        with fake_env(storage_type='file', remote_path=remote_path) as env:
            env.make_volume(size, img_id, vol_id)
            vol = env.sd_manifest.produceVolume(img_id, vol_id)
            vol_path = vol.getVolumePath()
            sduuid = fileVolume.getDomUuidFromVolumePath(vol_path)

            assert vol.getImageVolumes(sduuid, img_id) == [vol_id]
Beispiel #23
0
def make_env(env_type, base, top):
    img_id = make_uuid()
    base_id = make_uuid()
    top_id = make_uuid()

    if env_type == 'block' and base.format == 'raw':
        prealloc = sc.PREALLOCATED_VOL
    else:
        prealloc = sc.SPARSE_VOL

    with fake_env(env_type) as env:
        with MonkeyPatch().context() as mp:
            mp.setattr(guarded, 'context', fake_guarded_context())
            mp.setattr(merge, 'sdCache', env.sdcache)
            mp.setattr(blockVolume, "config", CONFIG)
            mp.setattr(blockVolume, 'rm', FakeResourceManager())
            mp.setattr(blockVolume, 'sdCache', env.sdcache)
            mp.setattr(
                image.Image, 'getChain', lambda self, sdUUID, imgUUID:
                [env.subchain.base_vol, env.subchain.top_vol])

            env.make_volume(base.virtual * GiB,
                            img_id,
                            base_id,
                            vol_format=sc.name2type(base.format),
                            prealloc=prealloc,
                            vol_type=sc.INTERNAL_VOL)

            env.make_volume(
                top.virtual * GiB,
                img_id,
                top_id,
                parent_vol_id=base_id,
                vol_format=sc.COW_FORMAT,
                vol_type=sc.LEAF_VOL if top.leaf else sc.INTERNAL_VOL)

            env.subchain = merge.SubchainInfo(
                dict(sd_id=env.sd_manifest.sdUUID,
                     img_id=img_id,
                     base_id=base_id,
                     top_id=top_id), 0)

            if env_type == 'block':
                # Simulate allocation by adjusting the LV sizes
                env.lvm.extendLV(env.sd_manifest.sdUUID, base_id,
                                 base.physical * GiB // MiB)
                env.lvm.extendLV(env.sd_manifest.sdUUID, top_id,
                                 top.physical * GiB // MiB)

            yield env
Beispiel #24
0
def make_env(env_type, base, top):
    img_id = make_uuid()
    base_id = make_uuid()
    top_id = make_uuid()

    if env_type == 'block' and base.format == 'raw':
        prealloc = sc.PREALLOCATED_VOL
    else:
        prealloc = sc.SPARSE_VOL

    with fake_env(env_type) as env:
        env.make_volume(base.virtual * GB,
                        img_id,
                        base_id,
                        vol_format=sc.name2type(base.format),
                        prealloc=prealloc)
        env.make_volume(top.virtual * GB,
                        img_id,
                        top_id,
                        parent_vol_id=base_id,
                        vol_format=sc.COW_FORMAT)
        env.subchain = merge.SubchainInfo(
            dict(sd_id=env.sd_manifest.sdUUID,
                 img_id=img_id,
                 base_id=base_id,
                 top_id=top_id), 0)

        if env_type == 'block':
            # Simulate allocation by adjusting the LV sizes
            env.lvm.extendLV(env.sd_manifest.sdUUID, base_id,
                             base.physical * GB / MB)
            env.lvm.extendLV(env.sd_manifest.sdUUID, top_id,
                             top.physical * GB / MB)

        rm = FakeResourceManager()
        with MonkeyPatchScope([
            (guarded, 'context', fake_guarded_context()),
            (merge, 'sdCache', env.sdcache),
            (blockVolume, 'rm', rm),
            (blockVolume, 'sdCache', env.sdcache),
            (image.Image, 'getChain', lambda self, sdUUID, imgUUID:
             [env.subchain.base_vol, env.subchain.top_vol]),
            (blockVolume.BlockVolume, 'extendSize',
             partial(fake_blockVolume_extendSize, env)),
            (fileVolume.FileVolume, 'extendSize',
             partial(fake_fileVolume_extendSize, env)),
        ]):
            yield env
Beispiel #25
0
    def make_env(self, sd_type='file', format='raw', chain_len=2,
                 shared=False):
        size = MiB
        base_fmt = sc.name2type(format)
        with fake_env(sd_type) as env:
            with MonkeyPatch().context() as mp:
                mp.setattr(guarded, 'context', fake_guarded_context())
                mp.setattr(merge, 'sdCache', env.sdcache)
                mp.setattr(blockVolume, 'rm', FakeResourceManager())

                env.chain = make_qemu_chain(env, size, base_fmt, chain_len)

                def fake_chain(self, sdUUID, imgUUID, volUUID=None):
                    return env.chain

                image.Image.getChain = fake_chain

                yield env
Beispiel #26
0
    def make_env(self, sd_type='file', format='raw', chain_len=2,
                 shared=False):
        size = 1048576
        base_fmt = sc.name2type(format)
        with fake_env(sd_type) as env:
            with MonkeyPatch().context() as mp:
                mp.setattr(guarded, 'context', fake_guarded_context())
                mp.setattr(merge, 'sdCache', env.sdcache)
                mp.setattr(blockVolume, 'rm', FakeResourceManager())

                env.chain = make_qemu_chain(env, size, base_fmt, chain_len)

                def fake_chain(self, sdUUID, imgUUID, volUUID=None):
                    return env.chain

                image.Image.getChain = fake_chain

                yield env
Beispiel #27
0
def make_env(env_type, base, top):
    img_id = make_uuid()
    base_id = make_uuid()
    top_id = make_uuid()

    if env_type == 'block' and base.format == 'raw':
        prealloc = sc.PREALLOCATED_VOL
    else:
        prealloc = sc.SPARSE_VOL

    with fake_env(env_type) as env:
        env.make_volume(base.virtual * GB, img_id, base_id,
                        vol_format=sc.name2type(base.format),
                        prealloc=prealloc)
        env.make_volume(top.virtual * GB, img_id, top_id,
                        parent_vol_id=base_id,
                        vol_format=sc.COW_FORMAT)
        env.subchain = merge.SubchainInfo(
            dict(sd_id=env.sd_manifest.sdUUID, img_id=img_id,
                 base_id=base_id, top_id=top_id), 0)

        if env_type == 'block':
            # Simulate allocation by adjusting the LV sizes
            env.lvm.extendLV(env.sd_manifest.sdUUID, base_id,
                             base.physical * GB // MB)
            env.lvm.extendLV(env.sd_manifest.sdUUID, top_id,
                             top.physical * GB // MB)

        with MonkeyPatch().context() as mp:
            mp.setattr(guarded, 'context', fake_guarded_context())
            mp.setattr(merge, 'sdCache', env.sdcache)
            mp.setattr(blockVolume, 'rm', FakeResourceManager())
            mp.setattr(blockVolume, 'sdCache', env.sdcache)
            mp.setattr(
                image.Image, 'getChain',
                lambda self, sdUUID, imgUUID:
                    [env.subchain.base_vol, env.subchain.top_vol])
            mp.setattr(
                blockVolume.BlockVolume, 'extendSize',
                partial(fake_blockVolume_extendSize, env))
            mp.setattr(
                fileVolume.FileVolume, 'extendSize',
                partial(fake_fileVolume_extendSize, env))
            yield env
Beispiel #28
0
    def make_env(self, sd_type='file', format='raw', chain_len=2,
                 shared=False):
        size = 1048576
        base_fmt = sc.name2type(format)
        with fake_env(sd_type) as env:
            rm = FakeResourceManager()
            with MonkeyPatchScope([
                (guarded, 'context', fake_guarded_context()),
                (merge, 'sdCache', env.sdcache),
                (blockVolume, 'rm', rm),
            ]):
                env.chain = make_qemu_chain(env, size, base_fmt, chain_len)

                def fake_chain(self, sdUUID, imgUUID, volUUID=None):
                    return env.chain

                image.Image.getChain = fake_chain

                yield env
Beispiel #29
0
def make_env(storage_type,
             fmt,
             chain_length=1,
             size=DEFAULT_SIZE,
             sd_version=5,
             qcow2_compat='1.1'):
    with fake_env(storage_type, sd_version=sd_version) as env:
        rm = FakeResourceManager()
        with MonkeyPatchScope([
            (guarded, 'context', fake_guarded_context()),
            (volume_info, 'sdCache', env.sdcache),
            (blockVolume, 'rm', rm),
        ]):
            env.chain = make_qemu_chain(env,
                                        size,
                                        fmt,
                                        chain_length,
                                        qcow2_compat=qcow2_compat)
            yield env
Beispiel #30
0
    def make_env(self, sd_type='block', format='raw', chain_len=2):
        size = 1048576
        base_fmt = sc.name2type(format)
        with fake_env(sd_type) as env:
            with MonkeyPatch().context() as mp:
                mp.setattr(guarded, 'context', fake_guarded_context())
                mp.setattr(merge, 'sdCache', env.sdcache)
                mp.setattr(blockVolume, 'rm', FakeResourceManager())
                mp.setattr(image, 'Image', FakeImage)

                env.chain = make_qemu_chain(env, size, base_fmt, chain_len)

                volumes = {(vol.imgUUID, vol.volUUID): FakeVolume()
                           for vol in env.chain}
                env.sdcache.domains[env.sd_manifest.sdUUID].volumes = volumes

                def fake_chain(self, sdUUID, imgUUID, volUUID=None):
                    return env.chain

                image.Image.getChain = fake_chain
                image.Image.syncVolumeChain = FakeSyncVolumeChain()

                yield env
Beispiel #31
0
 def make_env(self, storage_type, src_fmt, dst_fmt, chain_length=1,
              size=DEFAULT_SIZE, sd_version=3,
              src_qcow2_compat='0.10', prealloc=sc.SPARSE_VOL):
     with fake_env(storage_type, sd_version=sd_version) as env:
         rm = FakeResourceManager()
         with MonkeyPatchScope([
             (guarded, 'context', fake_guarded_context()),
             (copy_data, 'sdCache', env.sdcache),
             (blockVolume, 'rm', rm),
         ]):
             # Create existing volume - may use compat 0.10 or 1.1.
             src_vols = make_qemu_chain(env, size, src_fmt, chain_length,
                                        qcow2_compat=src_qcow2_compat,
                                        prealloc=prealloc)
             # New volumes are always created using the domain
             # prefered format.
             sd_compat = env.sd_manifest.qcow2_compat()
             dst_vols = make_qemu_chain(env, size, dst_fmt, chain_length,
                                        qcow2_compat=sd_compat,
                                        prealloc=prealloc)
             env.src_chain = src_vols
             env.dst_chain = dst_vols
             yield env
Beispiel #32
0
    def make_env(self, sd_type='block', format='raw', chain_len=2):
        size = 1048576
        base_fmt = sc.name2type(format)
        with fake_env(sd_type) as env:
            rm = FakeResourceManager()
            with MonkeyPatchScope([
                (guarded, 'context', fake_guarded_context()),
                (merge, 'sdCache', env.sdcache),
                (blockVolume, 'rm', rm),
                (image, 'Image', FakeImage),
            ]):
                env.chain = make_qemu_chain(env, size, base_fmt, chain_len)

                volumes = {(vol.imgUUID, vol.volUUID): FakeVolume()
                           for vol in env.chain}
                env.sdcache.domains[env.sd_manifest.sdUUID].volumes = volumes

                def fake_chain(self, sdUUID, imgUUID, volUUID=None):
                    return env.chain

                image.Image.getChain = fake_chain
                image.Image.syncVolumeChain = FakeSyncVolumeChain()

                yield env
Beispiel #33
0
def test_domain_version(env_type, sd_version):
    with fake_env(env_type, sd_version=sd_version) as env:
        assert sd_version == env.sd_manifest.getVersion()
Beispiel #34
0
 def test_domain_version(self, env_type, sd_version):
     with fake_env(env_type, sd_version=sd_version) as env:
         self.assertEqual(sd_version, env.sd_manifest.getVersion())
Beispiel #35
0
 def test_reversed_chain_raises(self, storage_type):
     with fake_env(storage_type) as env:
         vol_list = make_qemu_chain(env, MB, sc.RAW_FORMAT, 2)
         write_qemu_chain(reversed(vol_list))
         self.assertRaises(qemuio.VerificationError,
                           verify_qemu_chain, vol_list)
Beispiel #36
0
 def test_verify_chain(self, storage_type):
     with fake_env(storage_type) as env:
         vol_list = make_qemu_chain(env, MB, sc.RAW_FORMAT, 2)
         write_qemu_chain(vol_list)
         verify_qemu_chain(vol_list)
Beispiel #37
0
 def test_domain_version(self, env_type, sd_version):
     with fake_env(env_type, sd_version=sd_version) as env:
         self.assertEqual(sd_version, env.sd_manifest.getVersion())
Beispiel #38
0
 def test_default_domain_version(self, env_type):
     with fake_env(env_type) as env:
         self.assertEqual(3, env.sd_manifest.getVersion())
Beispiel #39
0
 def test_reversed_chain_raises(self, storage_type):
     with fake_env(storage_type) as env:
         vol_list = make_qemu_chain(env, MB, sc.RAW_FORMAT, 2)
         write_qemu_chain(reversed(vol_list))
         self.assertRaises(qemuio.VerificationError, verify_qemu_chain,
                           vol_list)
Beispiel #40
0
 def test_default_domain_version(self, env_type):
     with fake_env(env_type) as env:
         self.assertEqual(3, env.sd_manifest.getVersion())
Beispiel #41
0
def test_verify_chain(storage_type):
    with fake_env(storage_type) as env:
        vol_list = make_qemu_chain(env, MiB, sc.RAW_FORMAT, 2)
        write_qemu_chain(vol_list)
        verify_qemu_chain(vol_list)
Beispiel #42
0
def test_reversed_chain_raises(storage_type):
    with fake_env(storage_type) as env:
        vol_list = make_qemu_chain(env, MiB, sc.RAW_FORMAT, 2)
        write_qemu_chain(reversed(vol_list))
        with pytest.raises(qemuio.VerificationError):
            verify_qemu_chain(vol_list)
Beispiel #43
0
def test_default_domain_version(env_type):
    with fake_env(env_type) as env:
        assert 3 == env.sd_manifest.getVersion()