示例#1
0
	def _test_storage_class_case(self, sc_name, params):
		pvc_name = 'pvc-{}'.format(sc_name)

		KubeUtils.create_storage_class(sc_name, params)
		self.addCleanup(lambda: KubeUtils.delete_storage_class(sc_name))

		KubeUtils.create_pvc_and_wait_to_bound(self, pvc_name, sc_name)

		nvmesh_vol_name = KubeUtils.get_nvmesh_vol_name_from_pvc_name(pvc_name)
		NVMeshUtils.wait_for_nvmesh_volume(nvmesh_vol_name)

		# Verify NVMesh Volume has the required properties
		NVMeshUtils.wait_for_nvmesh_vol_properties(nvmesh_vol_name, params, self)
示例#2
0
    def _test_extend_fs_volume(self, storage_class_name, fs_type):
        # Create PVC
        pvc_name = 'pvc-extend-fs'
        KubeUtils.create_pvc_and_wait_to_bound(self,
                                               pvc_name,
                                               storage_class_name,
                                               access_modes=['ReadWriteMany'])

        # Create Pod
        pod_name = 'extend-fs-consumer'
        pod = KubeUtils.get_fs_consumer_pod_template(pod_name, pvc_name)
        KubeUtils.create_pod(pod)
        self.addCleanup(lambda: KubeUtils.delete_pod_and_wait(pod_name))
        KubeUtils.wait_for_pod_to_be_running(pod_name)

        # Edit the PVC to increase the volume capacity
        new_size = '5Gi'
        pvc_patch = {
            'spec': {
                'resources': {
                    'requests': {
                        'storage': new_size
                    }
                },
            }
        }

        logger.info("Extending Volume {}".format(pvc_name))
        KubeUtils.patch_pvc(pvc_name, pvc_patch)

        # verify kuberentes object updated
        KubeUtils.wait_for_pvc_to_extend(pvc_name, new_size)

        # wait for NVMesh Volume to show the updated size
        nvmesh_vol_name = KubeUtils.get_nvmesh_vol_name_from_pvc_name(pvc_name)
        size_5_gib_in_bytes = 5368709120

        NVMeshUtils.wait_for_nvmesh_vol_properties(
            nvmesh_vol_name, {'capacity': size_5_gib_in_bytes},
            self,
            attempts=15)

        # check block device size in container (using lsblk)
        KubeUtils.wait_for_block_device_resize(self, pod_name, nvmesh_vol_name,
                                               '5G')

        # check file system size inside the container  (using df -h)
        expected_size = '4.9G' if fs_type == FSType.EXT4 else '5.0G'
        self._wait_for_file_system_resize(pod_name, expected_size)
示例#3
0
	def _test_storage_class_case(self, sc_name, params):
		pvc_name = 'pvc-{}'.format(sc_name)

		KubeUtils.create_storage_class(sc_name, params)
		self.addCleanup(lambda: KubeUtils.delete_storage_class(sc_name))

		additional_fields = {
			'description': 'Storage Class Parameters test for ' + sc_name
		}

		KubeUtils.create_pvc_and_wait_to_bound(self, pvc_name, sc_name, **additional_fields)

		nvmesh_vol_name = KubeUtils.get_nvmesh_vol_name_from_pvc_name(pvc_name)
		mgmt_address = NVMeshUtils.wait_for_nvmesh_volume(nvmesh_vol_name)

		# Verify NVMesh Volume has the required properties
		NVMeshUtils.wait_for_nvmesh_vol_properties(nvmesh_vol_name, params, self)
    def test_block_volume_extend(self):
        # Create PVC
        pvc_name = 'pvc-extend-block'
        KubeUtils.create_pvc_and_wait_to_bound(self,
                                               pvc_name,
                                               'nvmesh-raid10',
                                               volumeMode='Block',
                                               access_modes=['ReadWriteMany'])

        # Create Pod
        pod_name = 'extend-block-consumer'
        pod = KubeUtils.get_block_consumer_pod_template(pod_name, pvc_name)
        KubeUtils.create_pod(pod)
        self.addCleanup(lambda: KubeUtils.delete_pod_and_wait(pod_name))
        KubeUtils.wait_for_pod_to_be_running(pod_name)

        # Edit the PVC to increase the volume capacity
        new_size = '5Gi'
        pvc_patch = {
            'spec': {
                'resources': {
                    'requests': {
                        'storage': new_size
                    }
                },
            }
        }

        logger.info("Extending Volume {}".format(pvc_name))
        KubeUtils.patch_pvc(pvc_name, pvc_patch)

        # verify kuberentes object updated
        KubeUtils.wait_for_pvc_to_extend(pvc_name, new_size)

        # wait for NVMesh Volume to show the updated size
        nvmesh_vol_name = KubeUtils.get_nvmesh_vol_name_from_pvc_name(pvc_name)
        size_5_gib_in_bytes = 5368709120

        NVMeshUtils.wait_for_nvmesh_vol_properties(
            nvmesh_vol_name, {'capacity': size_5_gib_in_bytes},
            self,
            attempts=15)

        # check block device size in container (using lsblk)
        KubeUtils.wait_for_block_device_resize(self, pod_name, nvmesh_vol_name,
                                               '5G')
示例#5
0
    def _test_raid_type(self, raid_type):
        storage_class_name = 'nvmesh-{}'.format(raid_type).replace('_', '-')
        pvc_name = storage_class_name
        KubeUtils.create_pvc_and_wait_to_bound(self, pvc_name,
                                               storage_class_name)

        # wait for nvmesh volume to be created
        nvmesh_vol_name = KubeUtils.get_nvmesh_vol_name_from_pvc_name(pvc_name)
        NVMeshUtils.wait_for_nvmesh_volume(nvmesh_vol_name)

        # verify NVMesh Volumes Properties
        NVMeshUtils.wait_for_nvmesh_vol_properties(nvmesh_vol_name,
                                                   {'raidLevel': raid_type},
                                                   self)

        def cleanup_volume():
            KubeUtils.delete_pvc(pvc_name)
            KubeUtils.wait_for_pvc_to_delete(pvc_name)

        self.addCleanup(cleanup_volume)