diff options
author | Mark McLoughlin <markmc@redhat.com> | 2013-01-04 17:32:36 +0000 |
---|---|---|
committer | Mark McLoughlin <markmc@redhat.com> | 2013-01-04 17:32:36 +0000 |
commit | 2553b4a22175d9a00a36fd9d20f3c646fd3fab1f (patch) | |
tree | 6e5893a9e9ee7cf4d3a4800eed6d25b62aa70340 | |
parent | 904814e51f4f24a704d98c3d13a8cce2a5bddc7e (diff) | |
download | nova-2553b4a22175d9a00a36fd9d20f3c646fd3fab1f.tar.gz nova-2553b4a22175d9a00a36fd9d20f3c646fd3fab1f.tar.xz nova-2553b4a22175d9a00a36fd9d20f3c646fd3fab1f.zip |
Move global path opts in nova.paths
Move the global path config options (i.e. state_path, pybasedir and
bindir) into a new nova.paths module. A new module may seem like
overkill but some utility methods associated with these options follow
in a later commit.
Moving them to nova.paths means they are no longer globally defined
and it's more obvious which modules require these options.
Change-Id: I381d23f1bbe36dc6967a38a65062b0983e1661aa
-rw-r--r-- | nova/cloudpipe/pipelib.py | 2 | ||||
-rw-r--r-- | nova/compute/manager.py | 2 | ||||
-rw-r--r-- | nova/config.py | 15 | ||||
-rw-r--r-- | nova/console/xvp.py | 2 | ||||
-rw-r--r-- | nova/crypto.py | 2 | ||||
-rw-r--r-- | nova/db/sqlalchemy/session.py | 2 | ||||
-rw-r--r-- | nova/network/linux_net.py | 4 | ||||
-rw-r--r-- | nova/objectstore/s3server.py | 2 | ||||
-rw-r--r-- | nova/paths.py | 38 | ||||
-rw-r--r-- | nova/test.py | 2 | ||||
-rw-r--r-- | nova/tests/conf_fixture.py | 2 | ||||
-rw-r--r-- | nova/virt/baremetal/db/sqlalchemy/session.py | 2 | ||||
-rw-r--r-- | nova/virt/baremetal/driver.py | 1 | ||||
-rw-r--r-- | nova/virt/baremetal/ipmi.py | 1 | ||||
-rw-r--r-- | nova/virt/disk/api.py | 2 | ||||
-rw-r--r-- | nova/virt/libvirt/volume_nfs.py | 2 |
16 files changed, 53 insertions, 28 deletions
diff --git a/nova/cloudpipe/pipelib.py b/nova/cloudpipe/pipelib.py index 8b8ae00c6..05b2aee2e 100644 --- a/nova/cloudpipe/pipelib.py +++ b/nova/cloudpipe/pipelib.py @@ -58,7 +58,7 @@ CONF.import_opt('ec2_dmz_host', 'nova.api.ec2.cloud') CONF.import_opt('ec2_port', 'nova.api.ec2.cloud') CONF.import_opt('vpn_image_id', 'nova.config') CONF.import_opt('vpn_key_suffix', 'nova.config') -CONF.import_opt('pybasedir', 'nova.config') +CONF.import_opt('pybasedir', 'nova.paths') CONF.import_opt('cnt_vpn_clients', 'nova.network.manager') LOG = logging.getLogger(__name__) diff --git a/nova/compute/manager.py b/nova/compute/manager.py index 9e4ac301e..65ecff1d6 100644 --- a/nova/compute/manager.py +++ b/nova/compute/manager.py @@ -177,7 +177,7 @@ CONF.import_opt('network_manager', 'nova.config') CONF.import_opt('reclaim_instance_interval', 'nova.config') CONF.import_opt('vpn_image_id', 'nova.config') CONF.import_opt('my_ip', 'nova.config') -CONF.import_opt('state_path', 'nova.config') +CONF.import_opt('state_path', 'nova.paths') QUOTAS = quota.QUOTAS diff --git a/nova/config.py b/nova/config.py index d32f9549f..c84725b84 100644 --- a/nova/config.py +++ b/nova/config.py @@ -43,21 +43,6 @@ def _get_my_ip(): return "127.0.0.1" -core_opts = [ - cfg.StrOpt('pybasedir', - default=os.path.abspath(os.path.join(os.path.dirname(__file__), - '../')), - help='Directory where the nova python module is installed'), - cfg.StrOpt('bindir', - default='$pybasedir/bin', - help='Directory where nova binaries are installed'), - cfg.StrOpt('state_path', - default='$pybasedir', - help="Top-level directory for maintaining nova's state"), - ] - -cfg.CONF.register_cli_opts(core_opts) - global_opts = [ cfg.StrOpt('my_ip', default=_get_my_ip(), diff --git a/nova/console/xvp.py b/nova/console/xvp.py index 4a23e0891..ec9207975 100644 --- a/nova/console/xvp.py +++ b/nova/console/xvp.py @@ -51,7 +51,7 @@ xvp_opts = [ CONF = cfg.CONF CONF.register_opts(xvp_opts) CONF.import_opt('host', 'nova.config') -CONF.import_opt('pybasedir', 'nova.config') +CONF.import_opt('pybasedir', 'nova.paths') LOG = logging.getLogger(__name__) diff --git a/nova/crypto.py b/nova/crypto.py index 807df8702..621ee8e5f 100644 --- a/nova/crypto.py +++ b/nova/crypto.py @@ -73,7 +73,7 @@ crypto_opts = [ CONF = cfg.CONF CONF.register_opts(crypto_opts) -CONF.import_opt('state_path', 'nova.config') +CONF.import_opt('state_path', 'nova.paths') def ca_folder(project_id=None): diff --git a/nova/db/sqlalchemy/session.py b/nova/db/sqlalchemy/session.py index ae8fec32d..6d4edd5af 100644 --- a/nova/db/sqlalchemy/session.py +++ b/nova/db/sqlalchemy/session.py @@ -290,7 +290,7 @@ sql_opts = [ CONF = cfg.CONF CONF.register_opts(sql_opts) -CONF.import_opt('state_path', 'nova.config') +CONF.import_opt('state_path', 'nova.paths') LOG = logging.getLogger(__name__) _ENGINE = None diff --git a/nova/network/linux_net.py b/nova/network/linux_net.py index e803488d2..5320fd0ef 100644 --- a/nova/network/linux_net.py +++ b/nova/network/linux_net.py @@ -94,12 +94,12 @@ linux_net_opts = [ CONF = cfg.CONF CONF.register_opts(linux_net_opts) -CONF.import_opt('bindir', 'nova.config') CONF.import_opt('fake_network', 'nova.network.manager') CONF.import_opt('host', 'nova.config') CONF.import_opt('use_ipv6', 'nova.config') CONF.import_opt('my_ip', 'nova.config') -CONF.import_opt('state_path', 'nova.config') +CONF.import_opt('bindir', 'nova.paths') +CONF.import_opt('state_path', 'nova.paths') # NOTE(vish): Iptables supports chain names of up to 28 characters, and we diff --git a/nova/objectstore/s3server.py b/nova/objectstore/s3server.py index 9c816f85b..d6a8dd930 100644 --- a/nova/objectstore/s3server.py +++ b/nova/objectstore/s3server.py @@ -64,7 +64,7 @@ s3_opts = [ CONF = cfg.CONF CONF.register_opts(s3_opts) -CONF.import_opt('state_path', 'nova.config') +CONF.import_opt('state_path', 'nova.paths') def get_wsgi_server(): diff --git a/nova/paths.py b/nova/paths.py new file mode 100644 index 000000000..bc17817b0 --- /dev/null +++ b/nova/paths.py @@ -0,0 +1,38 @@ +# vim: tabstop=4 shiftwidth=4 softtabstop=4 + +# Copyright 2010 United States Government as represented by the +# Administrator of the National Aeronautics and Space Administration. +# All Rights Reserved. +# Copyright 2012 Red Hat, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. + +import os + +from nova.openstack.common import cfg + +path_opts = [ + cfg.StrOpt('pybasedir', + default=os.path.abspath(os.path.join(os.path.dirname(__file__), + '../')), + help='Directory where the nova python module is installed'), + cfg.StrOpt('bindir', + default='$pybasedir/bin', + help='Directory where nova binaries are installed'), + cfg.StrOpt('state_path', + default='$pybasedir', + help="Top-level directory for maintaining nova's state"), +] + +CONF = cfg.CONF +CONF.register_opts(path_opts) diff --git a/nova/test.py b/nova/test.py index 3ba38eef4..8114561e4 100644 --- a/nova/test.py +++ b/nova/test.py @@ -57,7 +57,7 @@ CONF = cfg.CONF CONF.register_opts(test_opts) CONF.import_opt('sql_connection', 'nova.db.sqlalchemy.session') CONF.import_opt('sqlite_db', 'nova.db.sqlalchemy.session') -CONF.import_opt('state_path', 'nova.config') +CONF.import_opt('state_path', 'nova.paths') CONF.set_override('use_stderr', False) logging.setup('nova') diff --git a/nova/tests/conf_fixture.py b/nova/tests/conf_fixture.py index 4ec1bf8fb..1a6f80331 100644 --- a/nova/tests/conf_fixture.py +++ b/nova/tests/conf_fixture.py @@ -24,7 +24,7 @@ from nova.openstack.common import cfg from nova.tests.utils import cleanup_dns_managers CONF = cfg.CONF -CONF.import_opt('state_path', 'nova.config') +CONF.import_opt('state_path', 'nova.paths') CONF.import_opt('scheduler_driver', 'nova.scheduler.manager') CONF.import_opt('fake_network', 'nova.network.manager') CONF.import_opt('network_size', 'nova.network.manager') diff --git a/nova/virt/baremetal/db/sqlalchemy/session.py b/nova/virt/baremetal/db/sqlalchemy/session.py index d6e2a533d..7b9c3d20d 100644 --- a/nova/virt/baremetal/db/sqlalchemy/session.py +++ b/nova/virt/baremetal/db/sqlalchemy/session.py @@ -37,7 +37,7 @@ CONF.register_group(baremetal_group) CONF.register_opts(opts, baremetal_group) CONF.import_opt('sqlite_db', 'nova.db.sqlalchemy.session') -CONF.import_opt('state_path', 'nova.config') +CONF.import_opt('state_path', 'nova.paths') _ENGINE = None _MAKER = None diff --git a/nova/virt/baremetal/driver.py b/nova/virt/baremetal/driver.py index 0bc9fec63..7fd25a6c6 100644 --- a/nova/virt/baremetal/driver.py +++ b/nova/virt/baremetal/driver.py @@ -72,6 +72,7 @@ baremetal_group = cfg.OptGroup(name='baremetal', CONF = cfg.CONF CONF.register_group(baremetal_group) CONF.register_opts(opts, baremetal_group) +CONF.import_opt('pybasedir', 'nova.paths') DEFAULT_FIREWALL_DRIVER = "%s.%s" % ( firewall.__name__, diff --git a/nova/virt/baremetal/ipmi.py b/nova/virt/baremetal/ipmi.py index 58899ebef..8796b16f5 100644 --- a/nova/virt/baremetal/ipmi.py +++ b/nova/virt/baremetal/ipmi.py @@ -54,6 +54,7 @@ baremetal_group = cfg.OptGroup(name='baremetal', CONF = cfg.CONF CONF.register_group(baremetal_group) CONF.register_opts(opts, baremetal_group) +CONF.import_opt('state_path', 'nova.paths') LOG = logging.getLogger(__name__) diff --git a/nova/virt/disk/api.py b/nova/virt/disk/api.py index f663515cd..f7a682e3c 100644 --- a/nova/virt/disk/api.py +++ b/nova/virt/disk/api.py @@ -73,7 +73,7 @@ disk_opts = [ CONF = cfg.CONF CONF.register_opts(disk_opts) -CONF.import_opt('pybasedir', 'nova.config') +CONF.import_opt('pybasedir', 'nova.paths') _MKFS_COMMAND = {} _DEFAULT_MKFS_COMMAND = None diff --git a/nova/virt/libvirt/volume_nfs.py b/nova/virt/libvirt/volume_nfs.py index 722760f0a..edd7e5b27 100644 --- a/nova/virt/libvirt/volume_nfs.py +++ b/nova/virt/libvirt/volume_nfs.py @@ -35,7 +35,7 @@ volume_opts = [ ] CONF = cfg.CONF CONF.register_opts(volume_opts) -CONF.import_opt('state_path', 'nova.config') +CONF.import_opt('state_path', 'nova.paths') class NfsVolumeDriver(volume.LibvirtVolumeDriver): |