コード例 #1
0
    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']
コード例 #2
0
 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
コード例 #3
0
ファイル: agent.py プロジェクト: savi-dev/ironic-python-agent
 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
コード例 #4
0
ファイル: standby.py プロジェクト: rackerlabs/teeth-agent
    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']
コード例 #5
0
ファイル: agent.py プロジェクト: rackerlabs/teeth-agent
 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
コード例 #6
0
    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)
コード例 #7
0
    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)
コード例 #8
0
 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
コード例 #9
0
    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)
コード例 #10
0
    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)
コード例 #11
0
ファイル: agent.py プロジェクト: savi-dev/ironic-python-agent
    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
コード例 #12
0
ファイル: agent.py プロジェクト: comstud/ironic-python-agent
    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
コード例 #13
0
ファイル: standby.py プロジェクト: rackerlabs/teeth-agent
    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)
コード例 #14
0
ファイル: agent.py プロジェクト: rackerlabs/teeth-agent
 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
コード例 #15
0
ファイル: decom.py プロジェクト: savi-dev/ironic-python-agent
 def erase_hardware(self):
     hardware.get_manager().erase_devices()