Commit Graph

46 Commits

Author SHA1 Message Date
Luigi Toscano 15e02fec78 Add GRENADE_USE_EXTERNAL_DEVSTACK to skip part of the setup
When GRENADE_USE_EXTERNAL_DEVSTACK is set to True,
the initial steps performed by grenade are skipped, namely:
- grabbing and configuring the base and the target devstacks;
- running devstacks on the base target.

This change is required to allow a native Zuul v3 job to use
the existing workflow to setup and run devstack.

Change-Id: I232db8de05141849c81851dd29440959cb0d8533
2020-03-02 18:20:36 +01:00
Tom Barron d5dc033a2e Determine PYTHON3_VERSION when necessary
When grenade.sh is invoked by devstack-gate, PYTHON3_VERSION
is not set so grenadrc defaults it to 3.5, which breaks grenade
on nodes where python 3.5 does not exist, such as ubuntu bionic.

One solution is to set PYTHON3_VERSION in devstack-gate [1].
Alternatively, this change uses a bit of code borrowed from
stackrc in devstack to determine the version of python
within grenade if it was not set by the caller.

Closes-bug: #1812208
[1] https://review.openstack.org/#/c/607379/

Change-Id: I0349de2026c49279ba7f262d5e86d37018d66326
2019-03-03 17:49:11 +00:00
Matthew Treinish 0965bc0dce
Leverage systemd for service running check
With the switch to uwsgi (for most services) just doing a ps and
grepping for the process name isn't as simple as it was when each
binary command was unique. When using uwsgi the command is 'uwsgi'
which isn't unique between processes. Luckily we've also switched
everything to run under systemd which gives us an easy alternative
to check if the service is running. This commit pivots the checking
to leverage systemd to check the status of the process instead of
using ps. If the unit file can't be found it will fallback to using
ps. Moving forward we'll delete that path once everything is updated.

Change-Id: I2bc2674c1c29f8970983a12d75ccb3d05fdb9103
2017-08-30 15:57:10 -04:00
Matthew Treinish 5451c45577 Fix save_mysql_dbs for missing dbs
In change I075eb5a88113acfa36519e2c6e2aab87836be065 to workaround the
potentially missing dbs in a cells environment it turned off exiting on
error. This is a bad idea since it will mask real failures. This commmit
fixes the function to check if the db exists before trying to do a
mysqldump and report whether it's missing or not.

Change-Id: I54aac82e412a298cd1d2066a0fa51131a6da2af0
2017-08-16 20:45:54 +00:00
Davanum Srinivas 377780e774 Do not fail when saving databases
Nova now has multiple databases, let's add them to the list
nova-api nova_cell0 nova_cell1

Since it's hard to detect which set of databases are present,
we should disable bailing out when trying to save these.

Change-Id: I075eb5a88113acfa36519e2c6e2aab87836be065
2017-08-12 17:36:01 -04:00
Jenkins 11dd94308e Merge "Display additional phase detail in summary if present" 2017-04-07 13:44:07 +00:00
Jenkins b615ee9831 Merge "Initialize ERROR_ON_CLONE flag in grenaderc" 2017-04-07 13:43:55 +00:00
John L. Villalovos 8457291224 Use dsconf to add lines to devstack localrc
In some situations there are additional sections in the devstack
localrc file and they may be at the end of the file. This caused
errors as the desired changes would not be placed in the
'[[local|localrc]]' section of the file.

Using 'dsconf setlc_raw' solves that issue.

Change-Id: If4bc197d685e20fadbc5ffbd2151cae9d8129135
2017-02-16 16:00:58 -08:00
Castulo J. Martinez 648521324c Making is_ubuntu func available to fetch_devstacks
When the fetch_devstacks function runs as part of grenade.sh
it tries to install devstack tools. As part of the devstack tools
installation, python3 gets installed through a function called
install_python3 which uses a function called is_ubuntu to
determine if the system is ubuntu. However this is_ubuntu
function is not available at that moment, so the script fails.

This commit sources functions-common from the devstack directory
which includes is_ubuntu so the grenade.sh script does not break.

Change-Id: I92b9f731e99df0840be296bfa8ce6a70e02a1f91
Closes-bug: 1659081
2017-01-27 12:07:49 -08:00
Steve Heyman 6846c59845 Initialize ERROR_ON_CLONE flag in grenaderc
A user can set ERROR_ON_CLONE to yes (true) to fail a run if a git
clone fails.  This patch will document that behavior in grenaderc
and set the flag to its default value of no (unless a user overrides).

Change-Id: I1b1f80b00b4a4838ef10241306d9190520a93701
2017-01-26 14:57:22 -06:00
Sean Dague 489202bd70 attempt to use devstack-tools for local.conf merging
Add DSTOOLS_VERSION setting here. Eventually devstack-gate will set
this, but for now we can move forward without it.

Change-Id: I9bf5ac24dc87404e054068d7ed643e0bf0fac311
2017-01-20 08:17:22 -05:00
Sean Dague 63f30f29eb local.conf support
This attempts to provide local.conf support by making it possible to
have local.conf files during initial processing and concattenating
them to the end of the final local.conf.

This is not fool proof, but given the limited ways that we currently
use configs in devstack-gate, it's good enough to start the
transition.

Depends-On: Ia19d64ba240adc642284e4b942f6ce12310f862b

Change-Id: I3347c0886b1c2c8c56c902f485f45fb126446451
2017-01-11 09:44:12 -05:00
John L. Villalovos a2a1d60c5f Display additional phase detail in summary if present
Some of the phases, for example 'verify', have an additional
component, for example 'pre-upgrade'. Show that detail in the summary
line generated.

Change-Id: Icfc346bfd0aa432a3c01f70bfc98c7e0b6790c88
2016-10-11 10:10:42 -07:00
Patricia Domingues 6d3e6cfbfb Load DATABASE_USER from stackrc
mariadb does not use DATABASE_USER = 'root' by default.
New versions of MySQL flavor MariaDB do not allow remote access for
'root' user by default.
This patch enables non-root users by loading DATABASE_USER variable
from stackrc (which is loaded by MYSQL_USER in localrc). It keeps 'root'
user as default for MySQL.

Change-Id: I15f5f7ca1fe91d97b3f5bf268982b133513e5e3c
2016-09-09 14:10:52 +00:00
Dan Smith a3874c58d4 Indicate to plugin resource verification where we are
This makes the resource verify commands take a second argument that
indicates if we are pre-upgrade or post-upgrade. This may be needed
in order to validate things that will not be true before, but must
be true after an upgrade.

Change-Id: I6383c5f641bb8eb7fee6f1fbd41bca3a281d9636
2016-08-12 12:46:15 -07:00
John L. Villalovos 514c210893 Make output a bit nicer
Previously output would say:
 Running resource phase SOME_PHASE

Change it to:
 Running resource phase: SOME_PHASE

Change-Id: Ie60195e35c42af34a2fdf5aff478766318a5e638
2016-05-17 11:19:15 -07:00
Swapnil Kulkarni (coolsvap) 41202d7756 Correct typos
Change-Id: Ib313bda04ffc003b498e10148ea8d3ff78c0e08f
2016-03-08 10:37:27 +05:30
Jenkins 22ee7f82df Merge "Destroy Nova resource before Neutron" 2016-01-29 18:51:51 +00:00
Yongfeng Du 33e7ce0961 Destroy Nova resource before Neutron
Net delete will fail if there are still instances on this network,
destroy the resources reversely.

Change-Id: Ib0976352ae81ac94d8b31ebaed93758ca4210ec5
Closes-bug: #1488757
2015-12-15 14:04:24 +08:00
Jenkins 77adf18d69 Merge "export DATABASES_TO_SAVE for save-state" 2015-12-10 00:40:43 +00:00
Sean Dague 8dca033c30 remove partial upgrade support for nova
Partial upgrade support was a very hacky hybrid state of no stopping
some services so not everything is upgraded to new code levels. Now
that we have a multinode upgrade model in the gate we don't need this
any more, and we should burn this with fire so that more folks don't
go down this path.

Change-Id: I2b1b440aa3cccfb2b72e65e41809c359438024be
2015-11-16 11:50:42 -05:00
Ian Wienand 3882039083 export DATABASES_TO_SAVE for save-state
I noticed this in I45894911c0ee9cd6c9b142d6192350269873d82f where the
"old" database isn't dumped.  This seems to be because "save-state"
calls inc/upgrade:save_mysql_dbs, but it doesn't have access to
DATABASES_TO_SAVE because it's not exported.  An additional trick is
that save-state includes inc/upgrade, so be sure not to overwrite the
variable as blank.

Depends-On: I45894911c0ee9cd6c9b142d6192350269873d82f
Change-Id: I49626dcc277497eaf66d4d998ba8b2655293d28f
2015-10-28 11:04:57 +11:00
Ian Wienand d7e0a24bcc Namespace XTRACE calls
As a follow-on to Iba7739eada5711d9c269cb4127fa712e9f961695 in
devstack, where we rename the XTRACE storage calls to not conflict, do
the same in grenade

Also some minor turning-down of tracing when importing stackrc; it
floods the logs with irrelevant stuff.  And now we're tracing
properly, cleanup "echo_summary" output in the logs.

Change-Id: Ibb67a6454e4465a8d0493461e32dbae96c6a03e7
2015-10-28 11:04:25 +11:00
Jenkins b7c1bc500f Merge "Make DATABASES_TO_SAVE available to sub process" 2015-10-23 12:29:32 +00:00
Sean Dague 9f84a0c516 remove additional service checks for upgrading
Even though you've told grenade to UPGRADE a project, we still go and
check to see if it's enabled in devstack before we believe you. For
components that are fully implemented in the grenade and devstack
trees, this is fine. However for plugins this is weird, because
stackrc doesn't provide enough information to figure this out.

We should not do this second check, just trust your grenade config is
correct. This code was probably vestigial to getting the refactor
working correctly before the kilo release.

Change-Id: I01d00f95d602b9b159b3b64ff46a7cd3e23c3983
2015-10-05 08:46:35 -04:00
Sean Dague a70641034a make SERVICE_TIMEOUT variable
This allows us to set SERVICE_TIMEOUT per job to handle services which
might take longer to stop / start. We'll default to 30 as a reasonably
safe value.

Change-Id: I306a9ddfb957a947915eecc2d3121a15909f54d3
2015-10-02 12:01:29 -04:00
Julien Danjou df6824e9ca Fix whitespace handling in ensure_services_stopped
If there are whitespaces in the process names (such as a complete args
list), the current code does not work as it breaks on spaces. This fixes
it.

Change-Id: I4a2a982d4153a31971a5f1a1b504b96ce29236f9
Closes-Bug: #1484528
2015-09-02 00:49:50 +02:00
Yongfeng Du 5c24a87171 Make DATABASES_TO_SAVE available to sub process
grenade/save-state need DATABASES_TO_SAVE to save the base release databases.
The DATABASES_TO_SAVE is updated by load_settings.

Change-Id: I023248e6416fa0e8163883226bc74a7db6f7919e
Closes-bug: #1487287
2015-08-24 14:40:39 +08:00
Ian Wienand cc69365a5a Reduce duplicate imports of functions & stackrc
In devstack openrc -> stackrc -> functions

I think it's fair to say nobody is really thinking about idempotency
when they write these rc files; it's assumed they're sourced once
per-run.  I3ca4e576aa3fb8992c08ca44900a8c53dd4b4163 is an example of
this.

Reduce some of the duplicate imports here by just importing the
top-level (either openrc if that's wanted, or stackrc)

Change-Id: I6fbae12f950a03afab39f341132746d3db9f788c
2015-08-07 10:10:29 +10:00
Sean Dague 818c69bb7a add worlddump at moments of success to compare in failures
We still have an intermittent connectivity problem in grenade, doing
dumps during normal runs at points of success might help us figure out
what went horribly wrong.

Change-Id: I835071d04d3fa463a9c710c80850ae35f40f7aa5
2015-06-22 14:07:55 -04:00
Sean Dague 634345b08a have echo_summary also print to normal logs
Make the echo_summary code also print to the normal logs which makes
for easier understanding of what's going on.

Change-Id: I2fb7d7eba9912ca90988fc05c9353a918007f1cf
2015-06-22 11:31:20 -04:00
Sean Dague 2923b056b8 implement external plugin mechanism for grenade
Implement an external plugin mechanism for grenade in the spirit of
devstack plugins. This assumes that external plugins will live in the
devstack/upgrade tree in their respective repository.

External plugins are enabled by adding

enable_grenade_plugin <name> <giturl> [branch]

to ``pluginrc`` at the top of the grenade directory. (``localrc``
could not be used due to timing issues on parsing)

a new ``devstack_localrc <base|target> ...`` is also added to grenade
that allows settings files to add content to base and target devstack
localrcs. This is quite critical for out of tree support, because for
upgrade testing there will often be a need to add services to the
localrc.

Partially tested on the existing Heat plugin implemented in
I0847004a8ac023a113cabaee46896abc823a01da, though that doesn't yet
fully pass due to conflicts in it's upgrade process.

Include documentation for out of tree best practices.

Change-Id: I02a777077d40408766204b05ed284fe98efbce8e
2015-06-09 13:09:40 -04:00
Sean Dague 8ee1af8f3b clean up upgrade scripts
The upgrade scripts have a *ton* of historical cruft in them. This is
a bulk clean up patch that does the following things:

 - ensures we source grenaderc before functions, we need this for
   devstack dir definitions.

 - moves xtraces until after sources to trim down irrelevant output

 - removes as many variables and library sources as possible to ensure
   that we include the minimum possible code in these scripts (for
   sanity and readability).

This skips the neutron upgrade script, much like in devstack, the
neutron code has so many extra variables it's not clear what's really
needed.

Change-Id: Idac9190fd33478a479f7c7dd5cb1be894bb03444
2015-05-07 17:51:44 +00:00
Sean Dague cbf26ea241 fix die functions
die requires the second param be $LINENO, there were 2 calling points
where that was wrong.

Change-Id: I0484270d7140be8863dd0c9521e868b393f27dd7
2015-05-06 14:20:57 -04:00
Sean Dague e78a3357a6 make the ss debug include all services
When things fail to shut down look for open sockets to all services
not just keystone, this seems to be a problem with more projects.

Change-Id: I003115e72a29e4c7f201ef2017795ace6a885ead
2015-04-23 17:49:45 -04:00
Sean Dague 584e3ea28e add process debugging when things fail
This adds additional debug information to try to catch artifacts
for keystone-all failing to shut down. In future we'll generalize
it into worlddump, but right now it's good debug to keep around.

Change-Id: Id62fb2ddeae2001313e98e567f5c227a8f2fadc6
2015-04-22 20:34:21 +00:00
Sean Dague 9bf1482680 ensure that grenade db is fresh on each run
The grenade db is really just an ini file, but there is no reason why
it should persist in a second run of grenade, and it actually causes
issues if it does. Blank it out in the init phase to ensure we're
starting with a blank store.

Change-Id: I22a2b53739153011f5c250739278719259ad7860
2015-04-16 16:17:44 -04:00
Sean Dague a88dd83270 Comment function files
This provides global variable comments for various function files, as
well as license info and the #!/bin/bash lines so that gerrit will
syntax highlight correctly.

Change-Id: Ice55aff1e39084a55e1a3da6d6418a103df4d04f
2015-04-16 16:17:44 -04:00
Sean Dague 2c48491897 remove javelin1 & javelin2
javelin is obsoleted for direct use in grenade by the resource plugin
scripts, so remove the coupling and reference to it.

Change-Id: Ieaf63f0162f8d87a96058e941fb5b1f3e750dd2b
2015-04-16 11:43:40 -04:00
Sean Dague 621ce5ca05 modular resource checking infrastructure
This provides the infrastructure for modular resource checking, as
well as an example implementation for keystone.

The infrastructure includes:

- the resource script dispatcher, including the ability to disable
  using it all together via config.

- resource_save / resource_get scripts for our grenadedb registry
  (wrapper on ini files, but abstracted so we could do something
  different in the future)

- keystone resource script.

Change-Id: I8666a96a817cfc333e50eed3b9aeffa5ac4aeec6
2015-04-13 15:37:18 -04:00
Sean Dague 2f3bfe1332 cleanup and document where we stand
This is a smorgasbord cleanup patch which does the following:

- moves all the inline function definitions in grenade.sh out to
  either bootstrap or upgrade libraries.

- gets rid of grenaderc.settings, this is handled by modular shutdown
  / upgrade service checking.

- consolidates all settings into grenaderc

- removes all variables that were extraneous, and came from very very
  early history of grenade.

- Documents the current flow and assumptions in grenade.sh as much as
  possible.

Change-Id: I3d2fa30240247690e3f45dcb0be93672808914f6
2015-04-11 13:40:22 -04:00
Sean Dague 3e50570ebb module upgrade service tests
Move the logic of check-sanity, which looks for services that should
be started and logs that should exist, into the per service upgrade
scripts.

Change-Id: I3e5a90a3d2c47b8224a7e7ce3a45a19837872252
2015-04-11 13:13:33 -04:00
Sean Dague 35968c9945 modularize shutdown
This breaks the content out of stop-base into a set of modular
shutdown.sh scripts so that every service can control it's own
shutdown. Services are shut down in reverse order under the theory
that will prevent services from calling services they depend on and
blocking their shutdown. Keystone had a habit of not going down if it
was first in the list.

We also need to manage TOP_DIR because many devstack scripts source
other devstack scripts by TOP_DIR. In the base case we make it
TARGET_DEVSTACK_DIR, however when we run shutdown we reference the
BASE_DEVSTACK_DIR instead.

This also moves all the stop-base service checks into the modular
shutdown scripts.

Depends-On: I9138a8370be06e6c9d2dacbec1b0ffd4928e603d

... as apparently stop_neutron does do anything useful in juno, and
the neutron project was relying on global pkills to make their
services actually shut down.

Change-Id: I02599b95bde61ade34220251e896f6d4c4122c22
2015-04-11 13:13:33 -04:00
Sean Dague 7546f56cce modularize mysql db saving
let projects declare that they will have a database to be saved, and
we'll do it for them, in the mysql case. Eventually other saving
issues should be left to per project save-state.sh scripts.

services which aren't always enabled in grenade jobs have their
settings files guarded with conditionals. Eventually we'll do
conditional loading of these settings files, however for now this lets
the rest of the infrastructure around running actions based on
PLUGIN_DIRS and UPGRADE_SERVICES be *non* conditional, which
simplifies them.

Change-Id: I06cad95ca319e4403772e5fb394c0f8965e0bf9d
2015-04-10 08:15:57 -04:00
Sean Dague b8c64e0de2 restructure upgrades into per project directories
This moves all the project specific upgrade code into project specific
directories. This forshadows how we might break out this code into
external plugins. It happens all at once to keep a working grenade
environment on both sides of this change.

Change-Id: If47395c796bdb0ae2b8fe65bfe4b4556a6487c7a
2015-04-09 08:27:40 -04:00
Sean Dague 6bb23b443f refactor to remove functions-common
This refactor's the grenade code to remove the copy/pasted
functions-common from devstack and instead use the functions from
TARGET_DEVSTACK. In order to accomplish this we need to refactor when
the devstack trees are pulled, so that we always pull both the base
and target devstack trees *extremely* early.

We also need to include a small number of functions (mostly related to
git) in grenade to be able to bootstrap these trees. This is done in
the inc/bootstrap tree.

There are some slightly unrelated function moves into inc/upgrade to
consolidate all the upgrade functions which were scattered through the
codebase for clarity. inc/* will be the contract library interfaces
out of grenade (mirroring devstack).

To do this grenaderc has to be split between variables which can be
set without devstack functions, and variables we compute later. These
later variables will be moved into project specific directories based
on the plugin plan.

Change-Id: I1a2d1a1fed7858c4f3b51a19be2d12cc2d260a24
2015-04-08 07:24:39 -04:00