- other_bmcs = []
- first_controller = None
- for hw in sorted(self._uc['hosts']):
- logging.info('HW node name is %s', hw)
-
- if not first_controller:
- if 'controller' in self._uc['hosts'][hw]['service_profiles'] or \
- 'caas_master' in self._uc['hosts'][hw]['service_profiles']:
- first_controller = hw
- logging.info('HW is first controller')
-
- host = self._uc['hosts'][hw]['hwmgmt']['address']
- user = self._uc['hosts'][hw]['hwmgmt']['user']
- passwd = self._uc['hosts'][hw]['hwmgmt']['password']
-
- bmc_log_path = '{}/{}.log'.format(self._logdir, hw)
-
- try:
- hw_data = hw_detect.get_hw_data(host, user, passwd, False)
- except HWException as e:
- error = "Harware not detected for {}: {}".format(hw, str(e))
- logging.error(error)
- raise BMCException(error)
-
- logging.info("Hardware belongs to %s product family", (hw_data['product_family']))
- if 'Unknown' in hw_data['product_family']:
- error = "Hardware not detected for %s" % hw
- logging.error(error)
- raise BMCException(error)
-
- bmc_mod_name = 'remoteinstaller.installer.bmc_management.{}'.format(hw_data['product_family'].lower())
- bmc_mod = importlib.import_module(bmc_mod_name)
- bmc_class = getattr(bmc_mod, hw_data['product_family'])
- bmc = bmc_class(host, user, passwd, bmc_log_path)
- bmc.set_host_name(hw)
-
- bmc.setup_sol()
-
- if hw != first_controller:
- other_bmcs.append(bmc)
- bmc.power('off')
- else:
- self._first_controller_bmc = bmc
-
- logging.debug('First controller: %s', first_controller)
-
- if not self._disable_bmc_initial_reset:
- self._first_controller_bmc.reset()
- time_after_reset = int(time.time())
-
- if not self._disable_other_bmc_reset:
- for bmc in other_bmcs:
- bmc.reset()
-
- if not self._disable_bmc_initial_reset:
- # Make sure we sleep at least 6min after the first controller BMC reset
- sleep_time = 6*60-int(time.time())-time_after_reset
- if sleep_time > 0:
- logging.debug('Waiting for first controller BMC to stabilize \
- (%s sec) after reset', sleep_time)
- time.sleep(sleep_time)
-
- config_file_names = self._create_cloud_config(first_controller)