From 27ced7a09be5f8192de3aa2771af54fb7a8b8e4a Mon Sep 17 00:00:00 2001 From: Mehdi Abaakouk Date: Thu, 17 Oct 2013 15:08:51 +0200 Subject: [PATCH] Set a sane default for state_path This change sets a sane default to state_path and puts the previous state_path for tests only. Because the default value of state_path changed, if this one isn't set in the configuration file, pybasedir is not more used as replacement but /var/lib/nova is used instead. UpgradeImpact DocImpact Closes bug: #1240879 Change-Id: I94502bcfac8b372271acd0dbc1710c0e3009b8e1 --- etc/nova/nova.conf.sample | 2 +- nova/paths.py | 2 +- nova/tests/conf_fixture.py | 4 ++++ 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/etc/nova/nova.conf.sample b/etc/nova/nova.conf.sample index ddaf4727303d..da09517be70d 100644 --- a/etc/nova/nova.conf.sample +++ b/etc/nova/nova.conf.sample @@ -97,7 +97,7 @@ # Top-level directory for maintaining nova's state (string # value) -#state_path=$pybasedir +#state_path=/var/lib/nova # diff --git a/nova/paths.py b/nova/paths.py index 8d8a632c07cf..2ef829a0018a 100644 --- a/nova/paths.py +++ b/nova/paths.py @@ -31,7 +31,7 @@ path_opts = [ default=os.path.join(sys.prefix, 'local', 'bin'), help='Directory where nova binaries are installed'), cfg.StrOpt('state_path', - default='$pybasedir', + default='/var/lib/nova', help="Top-level directory for maintaining nova's state"), ] diff --git a/nova/tests/conf_fixture.py b/nova/tests/conf_fixture.py index 3c3170c31f08..c4cdbbf12c09 100644 --- a/nova/tests/conf_fixture.py +++ b/nova/tests/conf_fixture.py @@ -16,6 +16,8 @@ # License for the specific language governing permissions and limitations # under the License. +import os + from oslo.config import cfg @@ -43,6 +45,8 @@ class ConfFixture(config_fixture.Config): """Fixture to manage global conf settings.""" def setUp(self): super(ConfFixture, self).setUp() + self.conf.set_default('state_path', os.path.abspath( + os.path.join(os.path.dirname(__file__), '..', '..'))) self.conf.set_default('api_paste_config', paths.state_path_def('etc/nova/api-paste.ini')) self.conf.set_default('host', 'fake-mini')