Example #1
0
    def get_server_capabilities(self):
        """Get hardware properties which can be used for scheduling

        :return: a dictionary of server capabilities.
        :raises: IloError, on an error from iLO.
        :raises: IloCommandNotSupportedError, if the command is not supported
                 on the server.
        """
        capabilities = self._call_method('get_server_capabilities')
        # TODO(nisha): Assumption is that Redfish always see the pci_device
        # member name field populated similarly to IPMI.
        # If redfish is not able to get nic_capacity, we can fall back to
        # IPMI way of retrieving nic_capacity in the future. As of now
        # the IPMI is not tested on Gen10, hence assuming that
        # Redfish will always be able to give the data.
        if ('Gen10' not in self.model):
            major_minor = (
                self._call_method('get_ilo_firmware_version_as_major_minor'))

            # NOTE(vmud213): Even if it is None, pass it on to get_nic_capacity
            # as we still want to try getting nic capacity through ipmitool
            # irrespective of what firmware we are using.
            nic_capacity = ipmi.get_nic_capacity(self.info, major_minor)
            if nic_capacity:
                capabilities.update({'nic_capacity': nic_capacity})

        if capabilities:
            return capabilities
 def test_get_nic_capacity_fw_lt_suggested_in_range_check(
         self, ipmi_mock, parse_mock):
     fw_rev = constants.LESSER_THAN_MIN_SUGGESTED_FW_STR
     actual_out = ipmi.get_nic_capacity(self.info, fw_rev)
     format_call_args = map(lambda x: x[0][1], ipmi_mock.call_args_list)
     self.assertIn("fru print 0xef", format_call_args)
     self.assertEqual(actual_out, None)
 def test_get_nic_capacity_fw_suggested_none(self, ipmi_mock, parse_mock):
     fw_rev = constants.MIN_SUGGESTED_FW_STR
     ipmi_mock.return_value = constants.NIC_FRU_OUT_ALL
     parse_mock.return_value = None
     actual_out = ipmi.get_nic_capacity(self.info, fw_rev)
     self.assertIsNone(actual_out)
     self.assertEqual(ipmi_mock.call_count, 1)
 def test_get_nic_capacity_fw_lt_suggested(self, ipmi_mock, parse_mock):
     fw_rev = constants.LESSER_THAN_MIN_SUGGESTED_FW_STR
     ipmi_mock.return_value = constants.NIC_FRU_OUT
     parse_mock.return_value = "1Gb"
     expected_out = "1Gb"
     actual_out = ipmi.get_nic_capacity(self.info, fw_rev)
     self.assertEqual(expected_out, actual_out)
     ipmi_mock.assert_called_once_with(mock.ANY, "fru print 0x0")
Example #5
0
 def test_get_nic_capacity_loop_N_times(self, ipmi_mock, parse_mock):
     ipmi_mock.side_effect = ["Device not present", "Device not present",
                              "Device not present", "Device not present",
                              "Device not present", "Device not present",
                              "Device not present", "Device not present",
                              constants.NIC_FRU_OUT]
     parse_mock.return_value = "1Gb"
     expected_out = "1Gb"
     actual_out = ipmi.get_nic_capacity(self.info)
     self.assertEqual(ipmi_mock.call_count, 9)
     self.assertEqual(expected_out, actual_out)
Example #6
0
 def test_get_nic_capacity_loop_N_times(self, ipmi_mock, parse_mock):
     ipmi_mock.side_effect = [
         "Device not present", "Device not present", "Device not present",
         "Device not present", "Device not present", "Device not present",
         "Device not present", "Device not present", constants.NIC_FRU_OUT
     ]
     parse_mock.return_value = "1Gb"
     expected_out = "1Gb"
     actual_out = ipmi.get_nic_capacity(self.info)
     self.assertEqual(ipmi_mock.call_count, 9)
     self.assertEqual(expected_out, actual_out)
 def test_get_nic_capacity_fw_lt_suggested_loop_N_times(
         self, ipmi_mock, parse_mock):
     fw_rev = constants.LESSER_THAN_MIN_SUGGESTED_FW_STR
     ipmi_mock.side_effect = [
         "Device not present", "Device not present", "Device not present",
         "Device not present", "Device not present", "Device not present",
         "Device not present", "Device not present", constants.NIC_FRU_OUT
     ]
     parse_mock.return_value = "1Gb"
     expected_out = "1Gb"
     actual_out = ipmi.get_nic_capacity(self.info, fw_rev)
     self.assertEqual(ipmi_mock.call_count, 9)
     self.assertEqual(expected_out, actual_out)
Example #8
0
    def get_server_capabilities(self):
        """Get hardware properties which can be used for scheduling

        :return: a dictionary of server capabilities.
        :raises: IloError, on an error from iLO.
        :raises: IloCommandNotSupportedError, if the command is not supported
                 on the server.
        """
        capabilities = self._call_method('get_server_capabilities')
        major_minor = (
            self._call_method('get_ilo_firmware_version_as_major_minor'))

        # NOTE(vmud213): Even if it is None, pass it on to get_nic_capacity
        # as we still want to try getting nic capacity through ipmitool
        # irrespective of what firmware we are using.
        nic_capacity = ipmi.get_nic_capacity(self.info, major_minor)
        if nic_capacity:
            capabilities.update({'nic_capacity': nic_capacity})
        if capabilities:
            return capabilities
Example #9
0
    def get_server_capabilities(self):
        """Get hardware properties which can be used for scheduling

        :return: a dictionary of server capabilities.
        :raises: IloError, on an error from iLO.
        :raises: IloCommandNotSupportedError, if the command is not supported
                 on the server.
        """
        capabilities = {}
        if 'Gen9' in self.model:
            capabilities = self.ris.get_server_capabilities()
            data = self.ribcl.get_host_health_data()
            gpu = self.ribcl._get_number_of_gpu_devices_connected(data)
            capabilities.update(gpu)
        else:
            capabilities = self.ribcl.get_server_capabilities()
        nic_capacity = ipmi.get_nic_capacity(self.info)
        if nic_capacity:
            capabilities.update({'nic_capacity': nic_capacity})
        if capabilities:
            return capabilities
Example #10
0
    def get_server_capabilities(self):
        """Get hardware properties which can be used for scheduling

        :return: a dictionary of server capabilities.
        :raises: IloError, on an error from iLO.
        :raises: IloCommandNotSupportedError, if the command is not supported
                 on the server.
        """
        capabilities = {}
        if 'Gen9' in self.model:
            capabilities = self.ris.get_server_capabilities()
            data = self.ribcl.get_host_health_data()
            gpu = self.ribcl._get_number_of_gpu_devices_connected(data)
            capabilities.update(gpu)
        else:
            capabilities = self.ribcl.get_server_capabilities()
        nic_capacity = ipmi.get_nic_capacity(self.info)
        if nic_capacity:
            capabilities.update({'nic_capacity': nic_capacity})
        if capabilities:
            return capabilities
Example #11
0
 def test_get_nic_capacity_none(self, ipmi_mock, parse_mock):
     ipmi_mock.return_value = constants.NIC_FRU_OUT
     parse_mock.return_value = None
     actual_out = ipmi.get_nic_capacity(self.info)
     self.assertIsNone(actual_out)
     self.assertEqual(ipmi_mock.call_count, 255)
Example #12
0
 def test_get_nic_capacity(self, ipmi_mock, parse_mock):
     ipmi_mock.return_value = constants.NIC_FRU_OUT
     parse_mock.return_value = "1Gb"
     expected_out = "1Gb"
     actual_out = ipmi.get_nic_capacity(self.info)
     self.assertEqual(expected_out, actual_out)
Example #13
0
 def test_get_nic_capacity_none(self, ipmi_mock, parse_mock):
     ipmi_mock.return_value = constants.NIC_FRU_OUT
     parse_mock.return_value = None
     actual_out = ipmi.get_nic_capacity(self.info)
     self.assertIsNone(actual_out)
     self.assertEqual(ipmi_mock.call_count, 255)
Example #14
0
 def test_get_nic_capacity(self, ipmi_mock, parse_mock):
     ipmi_mock.return_value = constants.NIC_FRU_OUT
     parse_mock.return_value = "1Gb"
     expected_out = "1Gb"
     actual_out = ipmi.get_nic_capacity(self.info)
     self.assertEqual(expected_out, actual_out)