Example #1
0
    def setUp(self):
        super(TestSriovVIFDriver, self).setUp()

        self._res_map = {
            SRIOV_PHYSNET_A: SRIOV_RESOURCE_NAME_A,
            SRIOV_PHYSNET_B: SRIOV_RESOURCE_NAME_B
        }
        sriov_request = {
            drvs.sriov_make_resource(k_const.K8S_SRIOV_PREFIX, SRIOV_RESOURCE_NAME_A):
            (str(AMOUNT_FOR_SUBNET_A)),
            drvs.sriov_make_resource(k_const.K8S_SRIOV_PREFIX, SRIOV_RESOURCE_NAME_B):
            (str(AMOUNT_FOR_SUBNET_B))
        }

        self._pod = {
            'metadata': {
                'resourceVersion': mock.sentinel.pod_version,
                'selfLink': mock.sentinel.pod_link,
                'name': 'podname'
            },
            'status': {
                'phase': k_const.K8S_POD_STATUS_PENDING
            },
            'spec': {
                'hostNetwork': False,
                'nodeName': 'hostname',
                'containers': [{
                    'resources': {
                        'requests': sriov_request
                    }
                }]
            }
        }
    def setUp(self):
        super(TestSriovVIFDriver, self).setUp()

        self._res_map = {
            SRIOV_PHYSNET_A: SRIOV_RESOURCE_NAME_A,
            SRIOV_PHYSNET_B: SRIOV_RESOURCE_NAME_B
        }
        sriov_request = {
            drvs.sriov_make_resource(k_const.K8S_SRIOV_PREFIX, SRIOV_RESOURCE_NAME_A):
            (str(AMOUNT_FOR_SUBNET_A)),
            drvs.sriov_make_resource(k_const.K8S_SRIOV_PREFIX, SRIOV_RESOURCE_NAME_B):
            (str(AMOUNT_FOR_SUBNET_B))
        }
        self._pod = fake.get_k8s_pod()
        self._pod['status'] = {'phase': k_const.K8S_POD_STATUS_PENDING}
        self._pod['spec'] = {
            'hostNetwork': False,
            'nodeName': 'hostname',
            'containers': [{
                'resources': {
                    'requests': sriov_request
                }
            }]
        }