summaryrefslogtreecommitdiff
path: root/ironic_python_agent/cmd
diff options
context:
space:
mode:
authorEllen Hui <ellenfkh@gmail.com>2014-05-30 23:55:34 +0000
committerEllen Hui <ellenfkh@gmail.com>2014-06-10 20:54:34 +0000
commitb4f1a0b2d32fc21ede9460540128a2129dc733ea (patch)
treeda6e0c442b62c9bba626a0410864b988acd81bf3 /ironic_python_agent/cmd
parent263f97c0e0fe4792c5aca1ac107bc2d5bb38115d (diff)
downloadironic-python-agent-b4f1a0b2d32fc21ede9460540128a2129dc733ea.tar.gz
Tries to advertise valid default IP
During the first heartbeat, the heartbeater asks the agent to check its advertised address; if the advertised IP is still the default (None), the agent tries to replace it with the IP of the first network interface it finds. If it fails to find either a network interface or an IP address, the agent raises an exception. Change-Id: I6d435d39e99ed0ff5c8b4883b6aa0b356f6cb4ae Closes-Bug: #1309110
Diffstat (limited to 'ironic_python_agent/cmd')
-rw-r--r--ironic_python_agent/cmd/agent.py20
1 files changed, 19 insertions, 1 deletions
diff --git a/ironic_python_agent/cmd/agent.py b/ironic_python_agent/cmd/agent.py
index 553a9ef3..61a92072 100644
--- a/ironic_python_agent/cmd/agent.py
+++ b/ironic_python_agent/cmd/agent.py
@@ -51,7 +51,7 @@ cli_opts = [
help='The port to listen on'),
cfg.StrOpt('advertise-host',
- default=KPARAMS.get('ipa-advertise-host', '0.0.0.0'),
+ default=KPARAMS.get('ipa-advertise-host', None),
help='The host to tell Ironic to reply and send '
'commands to.'),
@@ -60,6 +60,21 @@ cli_opts = [
help='The port to tell Ironic to reply and send '
'commands to.'),
+ cfg.IntOpt('ip-lookup-attempts',
+ default=int(KPARAMS.get('ipa-ip-lookup-attempts', 3)),
+ help='The number of times to try and automatically'
+ 'determine the agent IPv4 address.'),
+
+ cfg.IntOpt('ip-lookup-sleep',
+ default=int(KPARAMS.get('ipa-ip-lookup-timeout', 10)),
+ help='The amaount of time to sleep between attempts'
+ 'to determine IP address.'),
+
+ cfg.StrOpt('network-interface',
+ default=KPARAMS.get('ipa-network-interface', None),
+ help='The interface to use when looking for an IP'
+ 'address.'),
+
cfg.IntOpt('lookup-timeout',
default=int(KPARAMS.get('ipa-lookup-timeout', 300)),
help='The amount of time to retry the initial lookup '
@@ -88,6 +103,9 @@ def run():
agent.IronicPythonAgent(CONF.api_url,
(CONF.advertise_host, CONF.advertise_port),
(CONF.listen_host, CONF.listen_port),
+ CONF.ip_lookup_attempts,
+ CONF.ip_lookup_sleep,
+ CONF.network_interface,
CONF.lookup_timeout,
CONF.lookup_interval,
CONF.driver_name).run()