def update_warpdrive_firmware(self, node, ports): driver_info = node.get('driver_info', {}) LOG.info('Update Warpdrive called with %s' % driver_info) devices = self._list_lsi_devices() for device in devices: # Don't reflash the same firmware if device['version'] != LSI_FIRMWARE_VERSION: preflash_path = os.path.join(LSI_WARPDRIVE_DIR, LSI_FIRMWARE_PREFLASH) firmware_path = os.path.join(LSI_WARPDRIVE_DIR, LSI_FIRMWARE_PACKAGE) # note(JayF): New firmware requires us to flash a new firmware # flasher before flashing the update package precmd = [DDOEMCLI, '-c', device['id'], '-f', preflash_path] cmd = [DDOEMCLI, '-c', device['id'], '-updatepkg', firmware_path] with metrics.instrument_context( __name__, 'upgrade_warpdrive_firmware_preflash'): utils.execute(*precmd, check_exit_code=[0]) with metrics.instrument_context( __name__, 'upgrade_warpdrive_firmware_package'): utils.execute(*cmd, check_exit_code=[0]) else: LOG.info('Device %(id)s already version %(version)s, ' 'not upgrading.' % { 'id': device['id'], 'version': device['version'] })
def _erase_lsi_warpdrive(self, block_device): if not self._is_warpdrive(block_device): return False # NOTE(JayF): Start timing here, so any devices short circuited # don't produce invalidly-short metrics. with metrics.instrument_context(__name__, 'erase_lsi_warpdrive'): device = self._get_warpdrive_card(block_device) result = utils.execute(DDOEMCLI, '-c', device['id'], '-format', '-op', '-level', 'nom', '-s') if 'WarpDrive format successfully completed.' not in result[0]: raise errors.BlockDeviceEraseError(('Erasing LSI card failed: ' '{0}').format(result[0])) return True