コード例 #1
0
ファイル: deploy.py プロジェクト: olliewalsh/ironic
 def validate(self, task):
     common.verify_node_info(task.node)
     try:
         common.validate_oneview_resources_compatibility(task)
     except exception.OneViewError as oneview_exc:
         raise exception.InvalidParameterValue(oneview_exc)
     super(OneViewAgentDeploy, self).validate(task)
コード例 #2
0
    def validate(self, task):
        """Checks required info on 'driver_info' and validates node with OneView

        Validates whether the 'oneview_info' property of the supplied
        task's node contains the required info such as server_hardware_uri,
        server_hardware_type, server_profile_template_uri and
        enclosure_group_uri. Also, checks if the server profile of the node is
        applied, if NICs are valid for the server profile of the node, and if
        the server hardware attributes (ram, memory, vcpus count) are
        consistent with OneView. It validates if the node is being used by
        Oneview.

        :param task: a task from TaskManager.
        :raises: MissingParameterValue if a required parameter is missing.
        :raises: InvalidParameterValue if parameters set are inconsistent with
                 resources in OneView
        :raises: InvalidParameterValue if the node in use by OneView.
        :raises: OneViewError if not possible to get OneView's information
                 for the given node, if not possible to retrieve Server
                 Hardware from OneView.
        """
        common.verify_node_info(task.node)

        try:
            common.validate_oneview_resources_compatibility(task)
            if deploy_utils.is_node_in_use_by_oneview(task.node):
                raise exception.InvalidParameterValue(
                    _("Node %s is in use by OneView.") % task.node.uuid)
        except exception.OneViewError as oneview_exc:
            raise exception.InvalidParameterValue(oneview_exc)
コード例 #3
0
ファイル: test_common.py プロジェクト: ysqtianyang/ironic
    def test_validate_oneview_resources_compatibility(self,
                                                      mock_get_ov_client):
        """Validate compatibility of resources.

        1) Check validate_node_server_profile_template method is called
        2) Check validate_node_server_hardware_type method is called
        3) Check validate_node_enclosure_group method is called
        4) Check validate_node_server_hardware method is called
        5) Check is_node_port_mac_compatible_with_server_hardware method
           is called
        6) Check validate_server_profile_template_mac_type method is called
        """
        oneview_client = mock_get_ov_client()
        with task_manager.acquire(self.context, self.node.uuid) as task:
            common.validate_oneview_resources_compatibility(
                oneview_client, task)
            self.assertTrue(
                oneview_client.validate_node_server_profile_template.called)
            self.assertTrue(
                oneview_client.validate_node_server_hardware_type.called)
            self.assertTrue(
                oneview_client.validate_node_enclosure_group.called)
            self.assertTrue(
                oneview_client.validate_node_server_hardware.called)
            self.assertTrue(
                oneview_client.
                is_node_port_mac_compatible_with_server_hardware.called)
            self.assertTrue(oneview_client.
                            validate_server_profile_template_mac_type.called)
コード例 #4
0
ファイル: management.py プロジェクト: ysqtianyang/ironic
    def validate(self, task):
        """Checks required info on 'driver_info' and validates node with OneView

        Validates whether the 'driver_info' property of the supplied
        task's node contains the required info such as server_hardware_uri,
        server_hardware_type, server_profile_template_uri and
        enclosure_group_uri. Also, checks if the server profile of the node is
        applied, if NICs are valid for the server profile of the node, and if
        the server hardware attributes (ram, memory, vcpus count) are
        consistent with OneView.

        :param task: a task from TaskManager.
        :raises: InvalidParameterValue if parameters set are inconsistent with
                 resources in OneView
        """

        common.verify_node_info(task.node)

        try:
            common.validate_oneview_resources_compatibility(
                self.oneview_client, task)

            if not deploy_utils.is_node_in_use_by_ironic(
                    self.oneview_client, task.node):
                raise exception.InvalidParameterValue(
                    _("Node %s is not in use by ironic.") % task.node.uuid)
        except exception.OneViewError as oneview_exc:
            raise exception.InvalidParameterValue(oneview_exc)
コード例 #5
0
 def test_validate_oneview_resources_compatibility(
     self, mock_get_ov_client
 ):
     oneview_client = mock_get_ov_client()
     with task_manager.acquire(self.context, self.node.uuid) as task:
         common.validate_oneview_resources_compatibility(oneview_client,
                                                         task)
         self.assertTrue(
             oneview_client.validate_node_server_hardware.called)
         self.assertTrue(
             oneview_client.validate_node_server_hardware_type.called)
         self.assertTrue(
             oneview_client.validate_node_enclosure_group.called)
         self.assertTrue(
             oneview_client.validate_node_server_profile_template.called)
         self.assertTrue(
             oneview_client.check_server_profile_is_applied.called)
         self.assertTrue(
             oneview_client.
             is_node_port_mac_compatible_with_server_profile.called)
         self.assertFalse(
             oneview_client.
             is_node_port_mac_compatible_with_server_hardware.called)
         self.assertFalse(
             oneview_client.validate_spt_primary_boot_connection.called)
         self.assertFalse(
             oneview_client.
             validate_server_profile_template_mac_type.called)
コード例 #6
0
ファイル: management.py プロジェクト: bharathshetty4/ironic
    def validate(self, task):
        """Checks required info on 'driver_info' and validates node with OneView

        Validates whether the 'driver_info' property of the supplied
        task's node contains the required info such as server_hardware_uri,
        server_hardware_type, server_profile_template_uri and
        enclosure_group_uri. Also, checks if the server profile of the node is
        applied, if NICs are valid for the server profile of the node, and if
        the server hardware attributes (ram, memory, vcpus count) are
        consistent with OneView.

        :param task: a task from TaskManager.
        :raises: InvalidParameterValue if parameters set are inconsistent with
                 resources in OneView
        """

        common.verify_node_info(task.node)

        try:
            common.validate_oneview_resources_compatibility(
                self.oneview_client, task)

            if not deploy_utils.is_node_in_use_by_ironic(
                self.oneview_client, task.node
            ):
                raise exception.InvalidParameterValue(
                    _("Node %s is not in use by ironic.") % task.node.uuid)
        except exception.OneViewError as oneview_exc:
            raise exception.InvalidParameterValue(oneview_exc)
コード例 #7
0
ファイル: test_common.py プロジェクト: Tehsmash/ironic
    def test_validate_oneview_resources_compatibility(
        self, mock_get_ov_client
    ):
        """Validate compatibility of resources.

        1) Check validate_node_server_profile_template method is called
        2) Check validate_node_server_hardware_type method is called
        3) Check validate_node_enclosure_group method is called
        4) Check validate_node_server_hardware method is called
        5) Check is_node_port_mac_compatible_with_server_hardware method
           is called
        6) Check validate_server_profile_template_mac_type method is called
        """
        oneview_client = mock_get_ov_client()
        with task_manager.acquire(self.context, self.node.uuid) as task:
            common.validate_oneview_resources_compatibility(oneview_client,
                                                            task)
            self.assertTrue(
                oneview_client.validate_node_server_profile_template.called)
            self.assertTrue(
                oneview_client.validate_node_server_hardware_type.called)
            self.assertTrue(
                oneview_client.validate_node_enclosure_group.called)
            self.assertTrue(
                oneview_client.validate_node_server_hardware.called)
            self.assertTrue(
                oneview_client.
                is_node_port_mac_compatible_with_server_hardware.called)
            self.assertTrue(
                oneview_client.
                validate_server_profile_template_mac_type.called)
コード例 #8
0
ファイル: deploy.py プロジェクト: Tehsmash/ironic
 def validate(self, task):
     common.verify_node_info(task.node)
     try:
         common.validate_oneview_resources_compatibility(
             self.oneview_client, task)
     except exception.OneViewError as oneview_exc:
         raise exception.InvalidParameterValue(oneview_exc)
     super(OneViewAgentDeploy, self).validate(task)
コード例 #9
0
ファイル: test_common.py プロジェクト: bestjie/ironic
    def test_validate_oneview_resources_compatibility(
            self, mock_spt_mac_type, mock_port_mac_sh, mock_enclosure,
            mock_sh_type, mock_sp_template, mock_hponeview):
        """Validate compatibility of resources.

        1) Check _validate_node_server_profile_template method is called
        2) Check _validate_node_server_hardware_type method is called
        3) Check _validate_node_enclosure_group method is called
        4) Check _validate_node_port_mac_server_hardware method is called
        5) Check _validate_server_profile_template_mac_type method is called
        """
        oneview_client = mock_hponeview()
        fake_port = db_utils.create_test_port()
        fake_port.address = 'AA:BB:CC:DD:EE'
        fake_device = {
            'physicalPorts': [{
                'type':
                'Ethernet',
                'virtualPorts': [{
                    'portFunction': 'a',
                    'mac': 'AA:BB:CC:DD:EE'
                }]
            }]
        }
        fake_spt = {
            'serverHardwareTypeUri': 'fake_sht_uri',
            'enclosureGroupUri': 'fake_eg_uri',
            'macType': 'Physical',
            'boot': {
                'manageBoot': True
            }
        }
        fake_sh = {
            'serverHardwareTypeUri': 'fake_sht_uri',
            'serverGroupUri': 'fake_eg_uri',
            'processorCoreCount': 4,
            'processorCount': 2,
            'memoryMb': 4096,
            'portMap': {
                'deviceSlots': [fake_device]
            }
        }
        oneview_client.server_profile_templates.get.return_value = fake_spt
        oneview_client.server_hardware.get.return_value = fake_sh

        with task_manager.acquire(self.context, self.node.uuid) as task:
            task.ports = [fake_port]
            common.validate_oneview_resources_compatibility(task)
            self.assertTrue(mock_sp_template.called)
            self.assertTrue(mock_sh_type.called)
            self.assertTrue(mock_enclosure.called)
            self.assertTrue(mock_port_mac_sh.called)
            self.assertTrue(mock_spt_mac_type.called)
コード例 #10
0
    def test_validate_oneview_resources_compatibility_dynamic_allocation(
        self, mock_get_ov_client
    ):
        """Validate compatibility of resources for Dynamic Allocation model.

        1) Set 'dynamic_allocation' flag as True on node's driver_info
        2) Check validate_node_server_profile_template method is called
        3) Check validate_node_server_hardware_type method is called
        4) Check validate_node_enclosure_group method is called
        5) Check validate_node_server_hardware method is called
        6) Check is_node_port_mac_compatible_with_server_hardware method
           is called
        7) Check validate_server_profile_template_mac_type method is called
        8) Check check_server_profile_is_applied method is not called
        9) Check is_node_port_mac_compatible_with_server_profile method is
           not called

        """
        oneview_client = mock_get_ov_client()
        with task_manager.acquire(self.context, self.node.uuid) as task:
            driver_info = task.node.driver_info
            driver_info['dynamic_allocation'] = True
            task.node.driver_info = driver_info

            common.validate_oneview_resources_compatibility(oneview_client,
                                                            task)
            self.assertTrue(
                oneview_client.validate_node_server_profile_template.called)
            self.assertTrue(
                oneview_client.validate_node_server_hardware_type.called)
            self.assertTrue(
                oneview_client.validate_node_enclosure_group.called)
            self.assertTrue(
                oneview_client.validate_node_server_hardware.called)
            self.assertTrue(
                oneview_client.
                is_node_port_mac_compatible_with_server_hardware.called)
            self.assertTrue(
                oneview_client.
                validate_server_profile_template_mac_type.called)
            self.assertFalse(
                oneview_client.check_server_profile_is_applied.called)
            self.assertFalse(
                oneview_client.
                is_node_port_mac_compatible_with_server_profile.called)
コード例 #11
0
ファイル: test_common.py プロジェクト: jumpojoy/ironic
 def test_validate_oneview_resources_compatibility(self,
                                                   mock_get_ov_client):
     oneview_client = mock_get_ov_client()
     with task_manager.acquire(self.context, self.node.uuid) as task:
         common.validate_oneview_resources_compatibility(task)
         self.assertTrue(
             oneview_client.validate_node_server_hardware.called)
         self.assertTrue(
             oneview_client.validate_node_server_hardware_type.called)
         self.assertTrue(
             oneview_client.check_server_profile_is_applied.called)
         self.assertTrue(
             oneview_client.is_node_port_mac_compatible_with_server_profile.
             called)
         self.assertTrue(
             oneview_client.validate_node_enclosure_group.called)
         self.assertTrue(
             oneview_client.validate_node_server_profile_template.called)
コード例 #12
0
ファイル: inspect.py プロジェクト: fellypefca/ironic
    def validate(self, task):
        """Check required info on 'driver_info' and validates node with OneView.

        Validates whether the 'driver_info' property of the supplied
        task's node contains the required info such as server_hardware_uri,
        server_hardware_type, server_profile_template_uri and
        enclosure_group_uri. Also, checks if the server profile of the node is
        applied, if NICs are valid for the server profile of the node.

        :param task: a task from TaskManager.
        :raises: InvalidParameterValue if parameters set are inconsistent with
                 resources in OneView
        """
        common.verify_node_info(task.node)

        try:
            common.validate_oneview_resources_compatibility(task)
        except exception.OneViewError as oneview_exc:
            raise exception.InvalidParameterValue(oneview_exc)
コード例 #13
0
ファイル: test_common.py プロジェクト: bharathshetty4/ironic
    def test_validate_oneview_resources_compatibility_dynamic_allocation(
        self, mock_get_ov_client
    ):
        """Validate compatibility of resources for Dynamic Allocation model.

        1) Set 'dynamic_allocation' flag as True on node's driver_info
        2) Check validate_node_server_hardware_type method is called
        3) Check validate_node_enclosure_group method is called
        4) Check validate_node_server_profile_template method is called
        5) Check is_node_port_mac_compatible_with_server_hardware method
           is called
        6) Check validate_node_server_profile_template method is called
        7) Check check_server_profile_is_applied method is not called
        8) Check is_node_port_mac_compatible_with_server_profile method is
           not called

        """
        oneview_client = mock_get_ov_client()
        with task_manager.acquire(self.context, self.node.uuid) as task:
            driver_info = task.node.driver_info
            driver_info['dynamic_allocation'] = True
            task.node.driver_info = driver_info

            common.validate_oneview_resources_compatibility(oneview_client,
                                                            task)
            self.assertTrue(
                oneview_client.validate_node_server_hardware_type.called)
            self.assertTrue(
                oneview_client.validate_node_enclosure_group.called)
            self.assertTrue(
                oneview_client.validate_node_server_profile_template.called)
            self.assertTrue(
                oneview_client.
                is_node_port_mac_compatible_with_server_hardware.called)
            self.assertTrue(
                oneview_client.validate_node_server_profile_template.called)
            self.assertFalse(
                oneview_client.check_server_profile_is_applied.called)
            self.assertFalse(
                oneview_client.
                is_node_port_mac_compatible_with_server_profile.called)
コード例 #14
0
ファイル: inspect.py プロジェクト: bharathshetty4/ironic
    def validate(self, task):
        """Checks required info on 'driver_info' and validates node with OneView

        Validates whether the 'driver_info' property of the supplied
        task's node contains the required info such as server_hardware_uri,
        server_hardware_type, server_profile_template_uri and
        enclosure_group_uri. Also, checks if the server profile of the node is
        applied, if NICs are valid for the server profile of the node.

        :param task: a task from TaskManager.
        :raises: InvalidParameterValue if parameters set are inconsistent with
                 resources in OneView
        """

        common.verify_node_info(task.node)

        try:
            common.validate_oneview_resources_compatibility(
                self.oneview_client, task)
        except exception.OneViewError as oneview_exc:
            raise exception.InvalidParameterValue(oneview_exc)