def setUp(self): super(TestGenericHardwareManager, self).setUp() self.hardware = hardware.GenericHardwareManager() self.node = { 'uuid': 'dda135fb-732d-4742-8e72-df8f3199d244', 'driver_internal_info': {} }
def config_raid(data): # server_type = raid_utils.get_type_by_properties(data) # if server_type not in raid_utils.VALID_TYPE: # LOG.error('Unknown server type, and can not configure RAID default.') # return sn = data.get('inventory').get('system_vendor').serial_number verify, cert = utils.get_ssl_client_options(CONF) # retrieve raid configuration info from arobot server raid_get_url = CONF.arobot_callback_url + ('/raid_conf/%s' % sn) resp = requests.get(raid_get_url, cert=cert, verify=verify) config = resp.json() if resp.status_code >= 400: LOG.error('error fetching raid configuration') return if config is None: LOG.error('configuration should never be None') return if config['is_ok']: LOG.info('sn: %s has been already been configured. Pass' % config.get('sn', '')) return # start configuring if raid has not been configured properly LOG.info("Start configuring RAID") raid_config = raid_utils.config_raid() # call back and save raid configurations raid_post_url = CONF.arobot_callback_url + '/raid_conf' json = { 'sn': sn, 'config': raid_config } # update contents of inventory.disks # because hardware.GenericHardwareManager will always # be loaded before raid properly configured data['inventory']['disks'] = hardware.GenericHardwareManager().list_block_devices() # call back to ironic-inspector LOG.info("Posting RAID configuration back to %s", raid_post_url) while True: try: resp = requests.post(raid_post_url, json=json, cert=cert, verify=verify) if resp.status_code >= 400: LOG.error("arobot raid error %d: %s", resp.status_code, resp.content.decode('utf-8')) except Exception as e: LOG.error(e) time.sleep(5) continue LOG.info('request ok') break
def setUp(self): super(TestGenericHardwareManager, self).setUp() self.hardware = hardware.GenericHardwareManager()