示例#1
0
    def test_no_nodes(self):
        # One error per each flavor
        expected = actions.Result(
            error={
                'errors': [
                    'Error: only 0 of 1 requested ironic nodes are '
                    'tagged to profile compute (for flavor '
                    'compute)\n'
                    'Recommendation: tag more nodes using openstack '
                    'baremetal node set --property  '
                    '"capabilities=profile:compute,'
                    'boot_option:local" <NODE ID>',
                    'Error: only 0 of 1 requested ironic nodes are '
                    'tagged to profile control (for flavor '
                    'control).\n'
                    'Recommendation: tag more nodes using openstack '
                    'baremetal node set --property '
                    '"capabilities=profile:control,'
                    'boot_option:local" <NODE ID>'
                ],
                'warnings': []
            })

        action = validations.VerifyProfilesAction(self.nodes, self.flavors)
        result = action.run(self.ctx)
        self.assertEqual(expected.error['errors'].sort(),
                         result.error['errors'].sort())
        self.assertEqual(expected.error['warnings'], result.error['warnings'])
        self.assertEqual(None, result.data)
示例#2
0
    def test_assign_profiles_wrong_state(self):
        # active nodes are not considered for assigning profiles
        self.nodes[:] = [
            self._get_fake_node(possible_profiles=['compute'],
                                provision_state='active'),
            self._get_fake_node(possible_profiles=['control'],
                                provision_state='cleaning'),
            self._get_fake_node(profile='compute', provision_state='error')
        ]
        expected = actions.Result(
            error={
                'warnings': [
                    'There are 1 ironic nodes with no profile that will not '
                    'be used: %s' % self.nodes[0].get('uuid')
                ],
                'errors': [
                    'Error: only 0 of 1 requested ironic nodes are tagged to '
                    'profile control (for flavor control).\n'
                    'Recommendation: tag more nodes using openstack baremetal '
                    'node set --property "capabilities=profile:control,'
                    'boot_option:local" <NODE ID>',
                    'Error: only 0 of 1 requested ironic nodes are tagged to '
                    'profile compute (for flavor compute).\n'
                    'Recommendation: tag more nodes using openstack baremetal '
                    'node set --property "capabilities=profile:compute,'
                    'boot_option:local" <NODE ID>'
                ]
            })

        action = validations.VerifyProfilesAction(self.nodes, self.flavors)
        result = action.run(self.ctx)
        self.assertEqual(expected.error['errors'].sort(),
                         result.error['errors'].sort())
        self.assertEqual(expected.error['warnings'], result.error['warnings'])
        self.assertEqual(None, result.data)
示例#3
0
    def _test(self, expected_result):
        action = validations.VerifyProfilesAction(self.nodes, self.flavors)
        result = action.run(self.ctx)

        self.assertEqual(expected_result, result)