Use local.conf instead of localrc

Use actual local.conf file name and format
  instead of deprecated localrc in devstack related
  deployment engines.

  Closes-bug: #1457194

Change-Id: Iba464f33eb9d1598dfa6aabbd167712d573f79da
This commit is contained in:
Oleh Anufriiev
2015-10-19 15:57:09 +03:00
parent e13ab7142f
commit 7550c0373b
8 changed files with 40 additions and 28 deletions

View File

@@ -4,10 +4,11 @@ Installing Rally using devstack
This directory contains the files necessary to integrate Rally with devstack. This directory contains the files necessary to integrate Rally with devstack.
To configure devstack to run rally:: To configure devstack to run rally edit ``${DEVSTACK_DIR}/local.conf`` file and add::
$ cd ${DEVSTACK_DIR} enable_plugin rally https://github.com/openstack/rally master
$ echo "enable_plugin rally https://github.com/openstack/rally master" >> localrc
to the ``[[local|localrc]]`` section.
Run devstack as normal:: Run devstack as normal::

View File

@@ -107,13 +107,15 @@ It is also possible to install Rally with DevStack. First, clone the correspondi
git clone https://git.openstack.org/openstack-dev/devstack git clone https://git.openstack.org/openstack-dev/devstack
git clone https://github.com/openstack/rally git clone https://github.com/openstack/rally
Then, configure DevStack to run Rally: Then, configure DevStack to run Rally. First, create your ``local.conf`` file:
.. code-block:: bash .. code-block:: bash
cd devstack cd devstack
cp samples/local.conf local.conf cp samples/local.conf local.conf
echo "enable_plugin rally https://github.com/openstack/rally master" >> localrc
Next, edit local.conf:
add ``enable_plugin rally https://github.com/openstack/rally master`` to ``[[local|localrc]]`` section.
Finally, run DevStack as usually: Finally, run DevStack as usually:

View File

@@ -52,7 +52,7 @@ class DevstackEngine(engine.Engine):
{ {
"type": "DevstackEngine", "type": "DevstackEngine",
"devstack_repo": "https://example.com/devstack/", "devstack_repo": "https://example.com/devstack/",
"localrc": { "local_conf": {
"ADMIN_PASSWORD": "secret" "ADMIN_PASSWORD": "secret"
}, },
"provider": { "provider": {
@@ -67,6 +67,7 @@ class DevstackEngine(engine.Engine):
"properties": { "properties": {
"type": {"type": "string"}, "type": {"type": "string"},
"provider": {"type": "object"}, "provider": {"type": "object"},
"local_conf": {"type": "object"},
"localrc": {"type": "object"}, "localrc": {"type": "object"},
"devstack_repo": {"type": "string"}, "devstack_repo": {"type": "string"},
"devstack_branch": {"type": "string"}, "devstack_branch": {"type": "string"},
@@ -76,7 +77,7 @@ class DevstackEngine(engine.Engine):
def __init__(self, deployment): def __init__(self, deployment):
super(DevstackEngine, self).__init__(deployment) super(DevstackEngine, self).__init__(deployment)
self.localrc = { self.local_conf = {
"DATABASE_PASSWORD": "rally", "DATABASE_PASSWORD": "rally",
"RABBIT_PASSWORD": "rally", "RABBIT_PASSWORD": "rally",
"SERVICE_TOKEN": "rally", "SERVICE_TOKEN": "rally",
@@ -85,8 +86,15 @@ class DevstackEngine(engine.Engine):
"RECLONE": "yes", "RECLONE": "yes",
"SYSLOG": "yes", "SYSLOG": "yes",
} }
if "localrc" in self.config: if "localrc" in self.config:
self.localrc.update(self.config["localrc"]) LOG.warn("'localrc' parameter is deprecated for deployment config "
"since 0.1.2. Please use 'local_conf' instead.")
if "local_conf" not in self.config:
self.config["local_conf"] = self.config["localrc"]
if "local_conf" in self.config:
self.local_conf.update(self.config["local_conf"])
@utils.log_deploy_wrapper(LOG.info, _("Prepare server for devstack")) @utils.log_deploy_wrapper(LOG.info, _("Prepare server for devstack"))
def prepare_server(self, server): def prepare_server(self, server):
@@ -101,9 +109,9 @@ class DevstackEngine(engine.Engine):
self.servers = self.get_provider().create_servers() self.servers = self.get_provider().create_servers()
devstack_repo = self.config.get("devstack_repo", DEVSTACK_REPO) devstack_repo = self.config.get("devstack_repo", DEVSTACK_REPO)
devstack_branch = self.config.get("devstack_branch", DEVSTACK_BRANCH) devstack_branch = self.config.get("devstack_branch", DEVSTACK_BRANCH)
localrc = "" local_conf = "[[local|localrc]]\n"
for k, v in six.iteritems(self.localrc): for k, v in six.iteritems(self.local_conf):
localrc += "%s=%s\n" % (k, v) local_conf += "%s=%s\n" % (k, v)
for server in self.servers: for server in self.servers:
self.deployment.add_resource(provider_name="DevstackEngine", self.deployment.add_resource(provider_name="DevstackEngine",
@@ -112,12 +120,13 @@ class DevstackEngine(engine.Engine):
cmd = "/bin/sh -e -s %s %s" % (devstack_repo, devstack_branch) cmd = "/bin/sh -e -s %s %s" % (devstack_repo, devstack_branch)
server.ssh.run(cmd, stdin=get_script("install.sh")) server.ssh.run(cmd, stdin=get_script("install.sh"))
devstack_server = get_updated_server(server, user=DEVSTACK_USER) devstack_server = get_updated_server(server, user=DEVSTACK_USER)
devstack_server.ssh.run("cat > ~/devstack/localrc", stdin=localrc) devstack_server.ssh.run("cat > ~/devstack/local.conf",
stdin=local_conf)
devstack_server.ssh.run("~/devstack/stack.sh") devstack_server.ssh.run("~/devstack/stack.sh")
admin_endpoint = objects.Endpoint("http://%s:5000/v2.0/" % admin_endpoint = objects.Endpoint("http://%s:5000/v2.0/" %
self.servers[0].host, "admin", self.servers[0].host, "admin",
self.localrc["ADMIN_PASSWORD"], self.local_conf["ADMIN_PASSWORD"],
"admin", "admin",
consts.EndpointPermission.ADMIN) consts.EndpointPermission.ADMIN)
return {"admin": admin_endpoint} return {"admin": admin_endpoint}

View File

@@ -53,7 +53,7 @@ class MultihostEngine(engine.Engine):
"nodes": [ "nodes": [
{ {
"type": "DevstackEngine", "type": "DevstackEngine",
"localrc": { "local_conf": {
"GLANCE_HOSTPORT": "{controller_ip}:9292", "GLANCE_HOSTPORT": "{controller_ip}:9292",
... ...
""" """

View File

@@ -1,6 +1,6 @@
{ {
"type": "DevstackEngine", "type": "DevstackEngine",
"localrc": { "local_conf": {
"VIRT_DRIVER": "fake" "VIRT_DRIVER": "fake"
}, },
"provider": { "provider": {

View File

@@ -14,14 +14,14 @@ Controller
:: ::
"type": "DevstackEngine", "type": "DevstackEngine",
"localrc": { "local_conf": {
"MULTI_HOST": "1", "MULTI_HOST": "1",
"VIRT_DRIVER": "fake", "VIRT_DRIVER": "fake",
"ENABLED_SERVICES+": ",-n-cpu", "ENABLED_SERVICES+": ",-n-cpu",
}, },
Look carefully at ENABLED_SERVICES. Such syntax is translated to 'ENABLED_SERVICES+=,-n-cpu' Look carefully at ENABLED_SERVICES. Such syntax is translated to 'ENABLED_SERVICES+=,-n-cpu'
in localrc. This means 'remove n-cpu from ENABLED_SERVICES'. in local.conf. This means 'remove n-cpu from ENABLED_SERVICES'.
Please note: VIRT_DRIVER=fake on controller node is mandatory. Please note: VIRT_DRIVER=fake on controller node is mandatory.
@@ -59,7 +59,7 @@ compute instance via the devstack engine, then makes N clones using lxc-clone.
}, },
"engine": { "engine": {
"name": "DevstackEngine", "name": "DevstackEngine",
"localrc": { "local_conf": {
"VIRT_DRIVER": "fake", "VIRT_DRIVER": "fake",
"DATABASE_TYPE": "mysql", "DATABASE_TYPE": "mysql",
"MYSQL_HOST": "{controller_ip}", "MYSQL_HOST": "{controller_ip}",
@@ -98,7 +98,7 @@ Here is an example of a complete configuration file, assembled from the snippets
"type": "MultihostEngine", "type": "MultihostEngine",
"controller": { "controller": {
"type": "DevstackEngine", "type": "DevstackEngine",
"localrc": { "local_conf": {
"MULTI_HOST": "1", "MULTI_HOST": "1",
"VIRT_DRIVER": "fake", "VIRT_DRIVER": "fake",
"API_RATE_LIMIT": "False", "API_RATE_LIMIT": "False",
@@ -128,7 +128,7 @@ Here is an example of a complete configuration file, assembled from the snippets
}, },
"engine": { "engine": {
"name": "DevstackEngine", "name": "DevstackEngine",
"localrc": { "local_conf": {
"VIRT_DRIVER": "fake", "VIRT_DRIVER": "fake",
"DATABASE_TYPE": "mysql", "DATABASE_TYPE": "mysql",
"MYSQL_HOST": "{controller_ip}", "MYSQL_HOST": "{controller_ip}",
@@ -217,7 +217,7 @@ to controller node. So, we add the option "tunnel_to": ["192.168.1.13"]::
}, },
"engine": { "engine": {
"name": "DevstackEngine", "name": "DevstackEngine",
"localrc": { "local_conf": {
"VIRT_DRIVER": "fake", "VIRT_DRIVER": "fake",
"DATABASE_TYPE": "mysql", "DATABASE_TYPE": "mysql",
"MYSQL_HOST": "{controller_ip}", "MYSQL_HOST": "{controller_ip}",

View File

@@ -2,7 +2,7 @@
"type": "MultihostEngine", "type": "MultihostEngine",
"controller": { "controller": {
"type": "DevstackEngine", "type": "DevstackEngine",
"localrc": { "local_conf": {
"ENABLED_SERVICES+": ",-n-cpu,-n-net", "ENABLED_SERVICES+": ",-n-cpu,-n-net",
"MULTI_HOST": "1", "MULTI_HOST": "1",
"SCREEN_LOGDIR": "$DEST/logs/screen" "SCREEN_LOGDIR": "$DEST/logs/screen"
@@ -14,7 +14,7 @@
"nodes": [ "nodes": [
{ {
"type": "DevstackEngine", "type": "DevstackEngine",
"localrc": {"ENABLED_SERVICES": "n-cpu,n-net"}, "local_conf": {"ENABLED_SERVICES": "n-cpu,n-net"},
"provider": { "provider": {
"type": "DummyProvider", "type": "DummyProvider",
"credentials": [{"host": "host-2.net", "credentials": [{"host": "host-2.net",

View File

@@ -26,7 +26,7 @@ SAMPLE_CONFIG = {
"name": "ExistingServers", "name": "ExistingServers",
"credentials": [{"user": "root", "host": "example.com"}], "credentials": [{"user": "root", "host": "example.com"}],
}, },
"localrc": { "local_conf": {
"ADMIN_PASSWORD": "secret", "ADMIN_PASSWORD": "secret",
}, },
} }
@@ -52,7 +52,7 @@ class DevstackEngineTestCase(test.TestCase):
engine.validate) engine.validate)
def test_construct(self): def test_construct(self):
self.assertEqual(self.engine.localrc["ADMIN_PASSWORD"], "secret") self.assertEqual(self.engine.local_conf["ADMIN_PASSWORD"], "secret")
@mock.patch("rally.deployment.engines.devstack.open", create=True) @mock.patch("rally.deployment.engines.devstack.open", create=True)
def test_prepare_server(self, mock_open): def test_prepare_server(self, mock_open):
@@ -99,9 +99,9 @@ class DevstackEngineTestCase(test.TestCase):
cmd = "/bin/sh -e -s %s master" % repo cmd = "/bin/sh -e -s %s master" % repo
server.ssh.run.assert_called_once_with(cmd, stdin="fake_script") server.ssh.run.assert_called_once_with(cmd, stdin="fake_script")
ds_calls = [ ds_calls = [
mock.call.ssh.run("cat > ~/devstack/localrc", stdin=mock.ANY), mock.call.ssh.run("cat > ~/devstack/local.conf", stdin=mock.ANY),
mock.call.ssh.run("~/devstack/stack.sh") mock.call.ssh.run("~/devstack/stack.sh")
] ]
self.assertEqual(ds_calls, ds_server.mock_calls) self.assertEqual(ds_calls, ds_server.mock_calls)
localrc = ds_server.mock_calls[0][2]["stdin"] local_conf = ds_server.mock_calls[0][2]["stdin"]
self.assertIn("ADMIN_PASSWORD=secret", localrc) self.assertIn("ADMIN_PASSWORD=secret", local_conf)