def cache_image(self, image_info=None, force=False): device = hardware.get_manager().get_os_install_device() if self.cached_image_id != image_info['id'] or force: _download_image(image_info) _write_image(image_info, device) self.cached_image_id = image_info['id']
def __init__(self, api_url, advertise_address, listen_address, ip_lookup_attempts, ip_lookup_sleep, network_interface, lookup_timeout, lookup_interval, driver_name): super(IronicPythonAgent, self).__init__() self.ext_mgr = extension.ExtensionManager( namespace='ironic_python_agent.extensions', invoke_on_load=True, propagate_map_exceptions=True, invoke_kwds={'agent': self}, ) self.api_url = api_url self.driver_name = driver_name self.api_client = ironic_api_client.APIClient(self.api_url, self.driver_name) self.listen_address = listen_address self.advertise_address = advertise_address self.version = pkg_resources.get_distribution('ironic-python-agent')\ .version self.api = app.VersionSelectorApplication(self) self.heartbeater = IronicPythonAgentHeartbeater(self) self.heartbeat_timeout = None self.hardware = hardware.get_manager() self.log = log.getLogger(__name__) self.started_at = None self.node = None # lookup timeout in seconds self.lookup_timeout = lookup_timeout self.lookup_interval = lookup_interval self.ip_lookup_attempts = ip_lookup_attempts self.ip_lookup_sleep = ip_lookup_sleep self.network_interface = network_interface
def __init__(self, api_url, advertise_address, listen_address, ip_lookup_attempts, ip_lookup_sleep, network_interface, lookup_timeout, lookup_interval, driver_name): super(IronicPythonAgent, self).__init__() self.ext_mgr = extension.ExtensionManager( namespace='ironic_python_agent.extensions', invoke_on_load=True, propagate_map_exceptions=True, ) self.api_url = api_url self.driver_name = driver_name self.api_client = ironic_api_client.APIClient(self.api_url, self.driver_name) self.listen_address = listen_address self.advertise_address = advertise_address self.version = pkg_resources.get_distribution('ironic-python-agent')\ .version self.api = app.VersionSelectorApplication(self) self.heartbeater = IronicPythonAgentHeartbeater(self) self.heartbeat_timeout = None self.hardware = hardware.get_manager() self.log = log.getLogger(__name__) self.started_at = None self.node = None # lookup timeout in seconds self.lookup_timeout = lookup_timeout self.lookup_interval = lookup_interval self.ip_lookup_attempts = ip_lookup_attempts self.ip_lookup_sleep = ip_lookup_sleep self.network_interface = network_interface
def cache_image(self, command_name, image_info=None, force=False): device = hardware.get_manager().get_os_install_device() if self.cached_image_id != image_info['id'] or force: _download_image(image_info) _write_image(image_info, device) self.cached_image_id = image_info['id']
def __init__(self, agent): super(IronicPythonAgentHeartbeater, self).__init__() self.agent = agent self.hardware = hardware.get_manager() self.api = ironic_api_client.APIClient(agent.api_url) self.log = log.getLogger(__name__) self.stop_event = threading.Event() self.error_delay = self.initial_delay
def test_hardware_manager_loading(self, mocked_extension_mgr_constructor): hardware._global_manager = None mocked_extension_mgr_constructor.return_value = self.fake_ext_mgr preferred_hw_manager = hardware.get_manager() mocked_extension_mgr_constructor.assert_called_once_with( namespace='ironic_python_agent.hardware_managers', invoke_on_load=True) self.assertEqual(self.correct_hw_manager, preferred_hw_manager)
def __init__(self, agent): super(IronicPythonAgentHeartbeater, self).__init__() self.agent = agent self.hardware = hardware.get_manager() self.api = ironic_api_client.APIClient(agent.api_url, agent.driver_name) self.log = log.getLogger(__name__) self.stop_event = threading.Event() self.error_delay = self.initial_delay
def prepare_image(self, image_info=None, configdrive=None): device = hardware.get_manager().get_os_install_device() # don't write image again if already cached if self.cached_image_id != image_info['id']: _download_image(image_info) _write_image(image_info, device) self.cached_image_id = image_info['id'] if configdrive is not None: _write_configdrive_to_partition(configdrive, device)
def __init__(self, agent): """Initialize the heartbeat thread. :param agent: an :class:`ironic_python_agent.agent.IronicPythonAgent` instance. """ super(IronicPythonAgentHeartbeater, self).__init__() self.agent = agent self.hardware = hardware.get_manager() self.api = ironic_api_client.APIClient(agent.api_url, agent.driver_name) self.log = log.getLogger(__name__) self.stop_event = threading.Event() self.error_delay = self.initial_delay
def prepare_image(self, command_name, image_info=None, metadata=None, files=None): location = _configdrive_location() device = hardware.get_manager().get_os_install_device() # don't write image again if already cached if self.cached_image_id != image_info['id']: _download_image(image_info) _write_image(image_info, device) self.cached_image_id = image_info['id'] LOG.debug('Writing configdrive to {0}'.format(location)) configdrive.write_configdrive(location, metadata, files) _copy_configdrive_to_disk(location, device)
def __init__(self, api_url, advertise_address, listen_address): self.api_url = api_url self.api_client = ironic_api_client.APIClient(self.api_url) self.listen_address = listen_address self.advertise_address = advertise_address self.mode_implementation = None self.version = pkg_resources.get_distribution('ironic-python-agent')\ .version self.api = app.VersionSelectorApplication(self) self.command_results = utils.get_ordereddict() self.heartbeater = IronicPythonAgentHeartbeater(self) self.heartbeat_timeout = None self.hardware = hardware.get_manager() self.command_lock = threading.Lock() self.log = log.getLogger(__name__) self.started_at = None self.node = None
def erase_hardware(self): hardware.get_manager().erase_devices()