diff options
author | Mark McLoughlin <markmc@redhat.com> | 2013-01-08 09:48:03 +0000 |
---|---|---|
committer | Mark McLoughlin <markmc@redhat.com> | 2013-01-09 22:09:17 +0000 |
commit | 7cb17d63f1bd317abc5cacd6d77e7ca810ccc346 (patch) | |
tree | 9c633aafbfe7446be208737232f627c0922d25e4 /nova/config.py | |
parent | 562b5a452db7208b53022aba0e8b6a8f70150587 (diff) | |
download | nova-7cb17d63f1bd317abc5cacd6d77e7ca810ccc346.tar.gz |
Move global service networking opts to new module
The my_ip, host and use_ipv6 options are used all over the codebase
and they're pretty well related to each other. Create a new netconf
module for them to live in.
There are now no options registered globally in nova.config!
blueprint: scope-config-opts
Change-Id: Ifde37839ae6f38e6bf99dff1e80b8e25fd68ed25
Diffstat (limited to 'nova/config.py')
-rw-r--r-- | nova/config.py | 41 |
1 files changed, 0 insertions, 41 deletions
diff --git a/nova/config.py b/nova/config.py index f3fa8d380b..4095dba75d 100644 --- a/nova/config.py +++ b/nova/config.py @@ -17,51 +17,10 @@ # License for the specific language governing permissions and limitations # under the License. -import os -import socket - from nova.openstack.common import cfg from nova.openstack.common import rpc -def _get_my_ip(): - """ - Returns the actual ip of the local machine. - - This code figures out what source address would be used if some traffic - were to be sent out to some well known address on the Internet. In this - case, a Google DNS server is used, but the specific address does not - matter much. No traffic is actually sent. - """ - try: - csock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) - csock.connect(('8.8.8.8', 80)) - (addr, port) = csock.getsockname() - csock.close() - return addr - except socket.error: - return "127.0.0.1" - - -global_opts = [ - cfg.StrOpt('my_ip', - default=_get_my_ip(), - help='ip address of this host'), - cfg.StrOpt('host', - default=socket.getfqdn(), - help='Name of this node. This can be an opaque identifier. ' - 'It is not necessarily a hostname, FQDN, or IP address. ' - 'However, the node name must be valid within ' - 'an AMQP key, and if using ZeroMQ, a valid ' - 'hostname, FQDN, or IP address'), - cfg.BoolOpt('use_ipv6', - default=False, - help='use ipv6'), -] - -cfg.CONF.register_opts(global_opts) - - def parse_args(argv, default_config_files=None): rpc.set_defaults(control_exchange='nova') cfg.CONF(argv[1:], |