333 Commits

Author SHA1 Message Date
Tiago Pasqualini da Silva
9ad9a8423a Revert "Disable Apache default ports"
This reverts commit 0bf9812bc1bd2fe26d23a49ac972c9fbbc03edcd.

Change-Id: Ia935798994e24910ad23aca24cd777aa21d35561
2019-12-20 02:05:22 +00:00
tpsilva
0bf9812bc1 Disable Apache default ports
Openstack services don't use the default ports (80 and 443), so
change Apache to not open them.

Change-Id: I518465cd2d6f53e229ab81ebd751f311f8627f83
Closes-bug: #1845665
2019-11-27 12:51:56 +00:00
Alex Kavanagh
8eca771d02 Ignore ssh-keyscan errors on hosts
The linked bug is due to a computed shorthost name that is taken as the
first 'word' in a dotted fqdn provided by rDNS when resolving the IP
address of a nova-compute host.  However, depending on the DNS server,
this shorthost may not actually exist in the DNS server.  This patchset
ignores ssh-keyscans where effectively the host can't be reached and so
the shorthost is not added.

Change-Id: I9ca82e00a79a3eecf37231620f648683edc0bc95
Closes-Bug: #1849501
2019-10-31 14:13:07 +00:00
Corey Bryant
45988df1ed Make placement a required interface as of train
Make placement a required interface for train and above as
placement is required in order to schedule instances.

Change-Id: If2472ec24df4c3d90b14189f8c4d3cceee5edc97
Closes-Bug: #1849893
2019-10-25 21:23:00 +00:00
Corey Bryant
2cfb795490 Ensure placement charm related before Train upgrade
As of OpenStack Train, the placement charm manages the placement API, and it
is no longer managed by nova-cloud-controller. This requires the placement
charm to be deployed and related to nova-cloud-controller prior to upgrading
nova-cloud-controller to Train.

This patch ensures that if an attempt is made to upgrade nova-cloud-controller
from Stein to Train, and placement is not yet related, it will block and
prevent the upgrade.

Change-Id: I217adfb59aed2e509a56b6559a528ae4c0adaa48
Closes-Bug: 1848529
2019-10-18 13:52:15 +00:00
Frode Nordahl
bf2cd49829
Remove `nova-consoleauth` package as of Train
The Nova console authorization has been moved to the database
backend and the separate service and package is no longer
necessary.

Change-Id: I672ae9538dc687a1c868bf99001041a54241ec24
Closes-Bug: #1848478
2019-10-17 12:29:40 +02:00
Corey Bryant
81860afeca Disable nova placement API
The placement project has split from nova into its own project
in Train. This patch disables the nova placement API as of Stein
when the placement charm relatation joins, and discontinues
nova placement installation as of Train for new installs.

Change-Id: If7c37ef8936e418b5afd21d83c9322563348cbcf
Needed-By: https://review.opendev.org/#/c/687915/
Partial-Bug: 1811681
2019-10-11 20:00:38 +00:00
James Page
3c806a23f6 stein: install python3-mysqldb for sqlalchemy dialect change
At Stein, the default mysql dialect in SQLAlchemy switched back
to MySQLDB in Ubuntu; as a result the db connection URL's stored
in the nova_api database for Nova cells are stale and need to
prefixed mysql+pymysql:// to work with the pymysql dialect.

However at this point in time there is no way to update the DB
URL for Nova Cell 0.

This fix works around this problem by installing python3-mysqldb
which provides the default dialect needed when using mysql://
prefixed DB connection URI's.

Change-Id: I3f74f18f649786fefa113fc3d8fa7c24010a185d
Related-Bug: 1835037
2019-07-23 16:47:06 +01:00
Alex Kavanagh
fe65e12b31 Add caching for knownhost private-address lookups
This change adds caching for the host look ups associated with a
private-address of a unit.  This cache is maintained across hook
invocations, and is designed to reduce the time spent in
cloud-compute-relation-changed hooks (which occur as nova-compute units
join and update on the cloud-compute relation).

The feature has been added under an EXPERIMENTAL config flag (with the
default being "don't use the cached values") in case there are any
corner cases around DNS resolution in the deploying cloud during
deployment.

An action is included to allow clearing of the cache at unit,
application and whole relation level.  This clears the cache and
re-triggers the host resolution, and relation updates.  This is in case
of either 1) DNS changed during the deployment, 2) DNS has been altered
during the running of the cloud.

Change-Id: I5a68bf4c30bf1591184d660d50559c969822ddcf
2019-07-16 14:27:30 +01:00
Alex Kavanagh
4d9b4a2600 Refactor compute hostname resolving functionality
The main driver here is to separate the concerns of resolving host names
and adding them to service/user related files.  This is to enable the
(eventual) resolution of the feature to allow migrations across
relation ids (i.e. between nova-compute applications) and to enable
caching of hostname look ups.

Change-Id: I406d1daacbcc74eb6f3e090f9a46e01dd3e19cc8
2019-07-15 21:39:16 +01:00
Alex Kavanagh
afa3c9a58e Refactor ssh_known_hosts_lines() and ssh_authorized_keys_lines()
Refactor ssh_known_hosts_lines() and ssh_authorized_keys_lines to be
easier to maintain and only call rstrip() once (per function).

Change-Id: Id2774bb1551e4826a2fd71d1a371d65ab2439a7d
2019-07-03 14:18:16 +01:00
Zuul
7d10e5d942 Merge "Refactor ssh_compute_remove() in nova" 2019-06-25 09:21:42 +00:00
Alex Kavanagh
a0edc83109 Remove the nova-api handling functions
The nova-api (commit 962790239b550be61b8eabcc5987aaf50c4f35c1)
introduced a 'nova-api' ready relation, but it was never added to the
metadata.yaml and it has never been used.  This commit removes it, as
there is no need for it after 3 years, and it therefore has a
maintenance burden, even if not being used.

Change-Id: I6b13e2639b808fd640a6f8d892d1e3dd58215361
2019-06-24 20:48:20 +01:00
Alex Kavanagh
978e29012f Refactor ssh_compute_remove() in nova
This removes one loop, but also changes the unit test so that it is not
dependent on the implementation of the function, specifically w.r.t. the
number of writes to the output file (which can now be changed in the
future).

Change-Id: Ieb0a373ed55971af0c357fa89c199fb781e772ab
2019-06-24 10:58:49 +01:00
Rodrigo Barbieri
a51efaf640 Propagate vendor_data from nova-cloud-controller
When using DVR and L3HA neutron deployment options,
Nova API Metadata requests are served from compute nodes,
instead of from neutron-gateway nodes.

This change allows nova-cloud-controller to send vendor_data
configuration values to nova-compute charm relation so it
can write to nova-compute's nova.conf appropriately.

Replaced the existing context logic with inheritance
from a new context created in charm-helpers, so the
logic can be shared across several charms that write
vendor metadata to nova.conf and vendor_data.json.

Also, small fix in the vendor-data and vendor-data-url
descriptions, where it was incorrectly stating that such
configuration would be effective in nova-cloud-controller
on Queens release.

The values set in vendor-data and vendor-data-url config
options will always be propagated to nova-compute regardless
of the OpenStack release. Those values will continue to only
be effective in nova-cloud-controller nodes on Rocky release
or later.

Included sync of charm-helpers code in order to inherit
the refactored vendor metadata contexts.

Change-Id: If8373fc6b2d04dbc29ed07896d385ac920cae3f4
Depends-On: I0c79e1bfac9fbe7009a7e862ad010cfa2de8cfda
Closes-Bug: #1777714
2019-06-05 10:22:56 -03:00
Liam Young
822daf2794 Check Apache ssl dir when determining restart map
If the certificates change then services needs to be restarted. This
change adds the SSL directory to the restart map to ensure any
certificate changes trigger a restart.

Also, if the certificates change we need to pass those on to
nova-compute.

Change-Id: I4cb2f760c26f0804d3cb7466c8aa741d5e0ec314
Closes-Bug: 1828530
2019-05-10 15:01:04 +00:00
Liam Young
ba19f921c5 Check console enabled before starting console svc
Check if console is enabled in this deploy before trying to start
console service. As part of this add a functions to determine whether
console is enabled and change existing methods to use them.

Change-Id: I91e2654bb0c5f89f51c703330ae2bd0a64cc84f3
Closes-Bug: #1820266
2019-03-15 14:29:54 +00:00
James Page
b6e314077f Drop support for single-nova-consoleauth
Remove support for single-nova-consoleauth operation; this option
managed a single instance of the nova-consoleauth process across
a cluster nova-cloud-controller application using the hacluster
charm.  This proves somewhat racey on deployment as the ocf resource
deep checks the operation of nova-consoleauth including connectivity
to AMQP etc..  If the clustering of the service occurs before
other principle relations have been completed, the resource will
fail to start and the hook execution will spin, never returning.

HA deployments should always use memcached to share tokens between
instances of the nova-consolauth daemon; If the 'ha' relation is
detected, then ensure that a memcache relation is then required
for charm operation.

To support evaluation of the memcache relation completeness
the memcache specific code in InstanceConsoleContext was split out
into a new memcache specific class RemoteMemcacheContext.

Existing pacemaker resources will be deleted on upgrade; units will
move into a blocked state until a relation is added to memcached.

The nova-consoleauth service is resumed on upgrade to ensure that
instances run on all nova-cloud-controller units.

Change-Id: I2ac91b2bd92269b761befeb7563ad01cc5431151
Closes-Bug: 1781620
2019-03-06 12:36:06 +00:00
Sahid Orentino Ferdjaoui
13eca55803 service: updates nova-api-os-compute service to use apache wsgi
Due to an issue in python3 oslo_cache+eventlet when using
memcached. As workaroud for Rocky it has been decided to run service
nova-api-os-compute from systemd to apache2.

Closes-Bug: #1812672
Depends-On: https://review.openstack.org/#/c/633218
Depends-On: https://review.openstack.org/#/c/633482
Change-Id: I3bf279638c5decf1020345f3d2e876e379144997
Signed-off-by: Sahid Orentino Ferdjaoui <sahid.ferdjaoui@canonical.com>
2019-02-01 16:32:28 -05:00
Sahid Orentino Ferdjaoui
fc68571c51 context: extend HAProxyContext for placement API
Since we will have to generate a HAProxyContext for
nova-compute-os-api, this change add new class
PlacementAPIHAProxyContext which extends HAProxyContext.

Partial-Bug: #1812672
Change-Id: I56920e3d9c5216cdd5a8ea8b83714e65b777a78b
Signed-off-by: Sahid Orentino Ferdjaoui <sahid.ferdjaoui@canonical.com>
2019-02-01 15:02:30 -05:00
Sahid Orentino Ferdjaoui
131497868f template: update conf template for placement-api
Currently we directly use the one provided by charmhelper which does
not allow to reuse it for an other service. In this commit we symlink
a new template called wsgi-placement-api.conf to
charmhelper/../wsgi-openstack-api.conf.

The disable_package_apache2_site() call has been added in
do_openstack_upgrade() since previously it was not necessary to have
it during this step.

The disable_package_apache2_site() call has been added in
upgrade-charm to ensure that we remove old wsgi config for users which
are already using bionic-rocky and are upgrading their charm.

Partial-Bug: #1812672
Change-Id: Idc3cad9304eaf9b610db20650c32cd754f016358
Signed-off-by: Sahid Orentino Ferdjaoui <sahid.ferdjaoui@canonical.com>
2019-02-01 15:00:14 -05:00
David Ames
e245c0bad4 Receive dns-domain over neutron-api relation
In order to have nova-metadata-api use the same dns-domain as neutron
when nova-metadata-api runs on nova-cloud-controller we must recieve
the dns-domain on the neutron-api relation.

Change-Id: I22c88a6fea87c56efdb5d93474a5ec7d2a6432d0
Partial-Bug: #1805645
2018-11-28 11:32:57 -08:00
Alex Kavanagh
50a7253b80 Fix guardmap as a function object issue in service_guard()
The issue was the original commit had a bug (using the wrong variable),
and also that there were no tests to verify the functionality.  This
patchset fixes the bug and adds tests to verify the contract.

Change-Id: Ia8b5580132c5a592461a57fb514994ab64a9ed42
Closes-Bug: #1805128
2018-11-26 12:44:01 +00:00
Liam Young
c88155d17a Purge old packages on upgrade-charm
On charm upgrade the charm may switch to py3 packages. If so, ensure
the old py2 packages are purged. If the purge occurs then restart
services.

Change-Id: I984a227b3fe12a0086c926ae69c27d6e4d9741d3
Closes-Bug: 1803451
2018-11-15 12:52:44 +00:00
Liam Young
314aff9e53 Fix type error when encoding certificate
The keystone_ca_cert_b64 function retrieved the CA cert from a file
before encoding it but it was passing a str to the b64encode which
requires a bytes-like object.

Change-Id: Iafaf5916b04746eb045fcd3dfe9676a80c88b464
2018-10-30 17:13:50 +00:00
Zuul
40ef19e78e Merge "Switch the charm to support py3" 2018-10-23 16:35:53 +00:00
Alex Kavanagh
9c12812735 Switch the charm to support py3
Some major changes:
* the charm has been rebased (from a Python perspective) to be rooted in
  the charm directory.  This is a single root.
* Imports have been changed so that the don't add lots of imports to the
  namespace of the module doing the import.
* The code that used to run at module import time has been made lazy
  such that it only has to run if the relevant functions are called.
  This includes restart_on_change parameters, the harden function and
  the parameters to the guard_map.  Appropriate changes will be
  submitted to charm-helpers.
* Several tests had to be re-written as (incorrect) mocking meant that
  text fixtures didn't actually match what the code was doing.  Thus,
  the tests were meaningless.
* This has had a net positive impact on the unit tests wrt to importing
  modules and mocking.

Change-Id: Id07d9d1caaa9b29453a63c2e49ba831071e9457f
2018-10-18 15:43:03 +01:00
James Page
1d8946151a py3: Don't purge or install python-six
Drop python-six from the list of packages to install/purge on
upgrade to py3 workload execution.

This was a legacy requirement in obsolete packaging versions
of Nova.

Purging six has the side effect of removing crmsh from the unit
in clustered deployments.

Change-Id: I9dfe7b031562c8f3e85445486ba16b3c7b2465ca
2018-10-15 14:45:01 +01:00
Liam Young
0f9ada1713 Fix assess status for super-conductor
In a cells deployment its possible that the top-level
nova-cloud-controller will have no compute nodes associated with it.
This change fixes the work load status in that scenario.

There is also a drive by fix to return empty contexts for the cell
db and amqp contexts if the relation do not yet exists.

Change-Id: Ia8eeccb6794dd016185eb0cfb05339b76cef9348
2018-10-09 10:32:51 +00:00
Liam Young
6695d79c95 Add support for cells v2
This change adds relations necessary for registering a compute cell
with the superconductor. For a cell to be registered this charm
must have relations with the compute cells conductor, database and
message queue. Only when all these relations are complete can the
registration happen. Below are major changes included in this PR.

* Add nova-cell-api relation for communicating with the
  nova-cell-conductor
* Add shared-db-cell relation for communicating with the
  a compute cells database.
* Add amqp-cell relation for communicating with the
  a compute cells message queue.
* Add methods for registering cells with the
  superconductors database.
* Charm helper sync

Change-Id: Ic6ddc29426319b98b147c29031f60485fccc513f
2018-10-05 11:50:21 +00:00
Corey Bryant
d5c5cccb0a py3: Switch to using Python 3 for rocky or later
Switch package install to Python 3 for OpenStack Rocky or later.

When upgrading, remove any python-* packages that were explicitly
installated and then autoremove --purge any dependencies that are
no longer required.

Change-Id: I87ee4a0a854f88b931093f6245a3a1057bf56c57
2018-10-04 11:19:06 +01:00
Liam Young
e20db83c7d Add nova-metadata service
Add a service for handling nova metadata api services. This was
previously handled by the neutron-gateway and still is for
deployemnts up to and including Pike, For the neutron metadata
service and the nova service to communicate they need a shared
secret. To achieve this, the change includes:

* A charmhelper sync to get support for multiple wsgi vhosts
* Rendering new wsgi vhost and corresponding haproxy config.
* Setting a shared-secret down the relation with the neutron
  gateway.
* Remove fragile keystone authtoken checks as they are failing
  after a ch sync and any issues will be caught by the instance
  launch functional test.

Change-Id: I5ad15ba782cb87b6fdb3c0941a6482d201670bff
2018-10-03 07:24:05 +00:00
James Page
935d30571c Use v2.1 API for >= Queens
Switch to using the v2.1 API endpoint for OpenStack Queens or later.

Closes-Bug: 1794271

Change-Id: Ia21b3a6782ab944b7c41564e889e6b12d264b731
2018-09-27 15:08:17 +01:00
James Page
36ccf4ee97 Use lowercase hostnames for SSH know hosts
OpenSSH will lowercase any hostname; ensure that hostnames
for known_host entries are also lower case avoiding any
authenticity of host type issues during live migration and
resize operators.

Change-Id: Ie5ab0774b49fc0d753ff1c26eb041f1ceb35e8fb
Closes-Bug: 1628216
2018-07-13 15:55:54 +01:00
Liam Young
21b17020d8 Remove support for nova cells v1
This change removes support for nova cells v1.

Change-Id: Id86697b6a2e893e023769ea214671e958e7166ca
2018-06-15 05:57:52 +00:00
Frode Nordahl
edc18d4937
Make charm agnostic of underlying init system
Replace charm custom init control functions with `service_pause`
and `service_resume` functions from charm-helpers.

Change-Id: I235af30a19294316f65fba0e13fe10ae50164a42
Closes-Bug: #1765215
2018-04-20 19:10:59 +02:00
Billy Olsen
d43e264d02 Sync charm-helpers and use VolumeAPIContext
Sync in the charm-helpers to use the new VolumeAPIContext object
in order to determine the volume catalog info to use in the
configuration file.

This is simply an alternative implementation for commit 16ae06bf
which separates the concerns for volume endpoint context and
internal endpoint context.

Change-Id: I187bc8ef5644a59dc5a0b5f7ad66774812a78b78
Related-Bug: #1733566
2018-02-08 19:01:44 -07:00
Liam Young
a0778a5304 Only run map_instances for Ocata
map_instances only needs to be run during the transition from
Newton to Ocata to map existing instances into a cell. All
new Ocata instances will be automatically mapped to a call.
This change limits the slow running map_instances command to
just run for upgrades to Ocata

Change-Id: Ic2e2df530504284d28cfcab26a71d211342203fa
Closes-Bug: #1743357
2018-01-23 13:27:00 +00:00
Liam Young
c276dfdb96 Batch up map_instances call
nova-manage map_instances maps all instances into a cell in batches
of 50 if max-count is not set. Setting max-count causes the script
to run a single batch of size max-count. The return code of the
script shows if there are still more to do. This change runs
map_instances repeatedly with a batch size of 50000 while rc is 1
and then exists cleanly when a rc 0 is recieved.

Change-Id: Id1184778a5ae94bb3b57348b10d12077b093d6dd
Partial-Bug: #1742115
2018-01-17 14:43:10 +00:00
Liam Young
edd9b1face Add action for running archive-deleted-rows
Add an action for moving stale data to shadow tables using
nova-manage *1. This will speed up other operations such as
map_instances which no longer need to work against stale
data.

*1 https://docs.openstack.org/nova/pike/cli/nova-manage.html

Change-Id: I03f3d641b50cfc6f02262edb0f714ba6e9566775
Partial-Bug: #1742115
2018-01-12 14:11:16 +00:00
James Page
0f14eac672 Remove deploy from source support
Drop support for deployment from Git repositories, as deprecated
in the 17.02 charm release.  This feature is unmaintained and has
no known users.

Change-Id: I2fe15b648d485e5b03965a00dee6324669ebe9fa
2018-01-12 10:42:50 +00:00
James Page
5c79af1bd1 Drop postgresql support
Remove postgresql DB support; This feature is untested as part
of the charms, is not in use and was deprecated as part of
the 1708 charms release.

Change-Id: I866559f519ace3476e0cc85661d99e5f5491227d
2017-12-21 12:01:58 +00:00
James Page
0196625084 Drop zeromq support
Support for the ZeroMQ messaging driver has bit-rotted over
the last few years across the OpenStack charms; drop support
for ZMQ inline with deprecation notices issued in 17.02 charm
release.

Change-Id: I39e464b289c9df842ca73e64c7576ba0531963ae
2017-12-15 17:27:01 +00:00
Edward Hope-Morley
16ae06bf42 Use volumev3 for internal endpoint in >= Pike
volumev2 api is deprecated for >= Pike so switch
internal endpoint to v3 for Pike onwards.

Change-Id: Icb9861efbd650b079f507ca585818e95921dc42a
Partial-Bug: 1733566
2017-12-08 10:06:49 +00:00
Corey Bryant
3b873932be Add nova-manage failure verbosity and clean up Cells V2 code
Update all nova-manage commands to use subprocess.check_output()
and log subprocess.CalledProcessError.output on failure. This
will help capture nova-manage error details on first failure.

Specify cell1 uuid on discover_hosts call. This doesn't change
behavior, it is just more explicit and useful if we move to
multiple cells in the future.

Introduce an is_cellv2_init_ready() function that uses contexts to
check if cells_v2 is ready to initialize. This cleans up the
corresponding TODOs.

Move checks for cell v2 init readiness to update_cell_db_if_ready(),
also cleaning up corresponding TODOs.

Change-Id: I313edce84d3d249031e020a4fbb4baf216c01ddb
Related-Bug: 1720846
2017-10-16 12:19:55 +00:00
David Ames
0161dde796 Resolve OS upgrade bugs
Ensure that the os_release cache is cleared during the openstack
upgrade process, ensuring that package list and configuration
options are correctly set for the new OpenStack version.

Ensure that map_instances gets run on upgrade. This updates the
nova_api.instance_mappings table with pre-existing instances.

Change-Id: Idfcdc48c25b24d0cc9ded3eda2bc4d13d3b04f6d
Closes-Bug: 1715624
2017-09-07 14:34:55 -07:00
David Ames
0681179aa3 Reset os_release after an upgrade
determine_endpoints was failing to recognize the new OS release after an
upgrade. Specifically newton --> ocata failed to register the
placement api.

Reset os_release after an upgrade.

Change-Id: I04ae30aea435c8c39f58d1a814d070a057bb5ce0
Closes-Bug: #1715505
2017-09-06 15:56:27 -07:00
Felipe Reyes
eacd234ed5 Run nova-manage db online_data_migrations on upgrades
In mitaka an extra operation called online_data_migrations was added to
assist rolling upgrades.

This patch runs this before and after, this is to make sure the old
upgrades where this migration was not being performed are run before
installing a newer release.

References:
- https://git.openstack.org/cgit/openstack/nova/commit/?id=7d5069ce20ec0d792a3974b2c53d01ae005cde98
- https://docs.openstack.org/nova/latest/user/upgrade.html

Change-Id: Ic4bc2c5ae86c99c3af2a1d0ee08badb09835d932
Closes-Bug: 1711209
2017-09-01 17:45:47 -03:00
Jenkins
f185d001a3 Merge "Drop nova-cert >= newton" 2017-06-26 14:08:24 +00:00
James Page
e8f5341034 Drop nova-cert >= newton
nova-cert was deprecated @ newton, and only supports ec2 services
which we dropped in the charms @ liberty so remove installation
and configuration of this service for >= newton.

Change-Id: I6d0ed6a1e058f38cb5d556a34b6f4299bf6d2055
2017-06-23 13:59:24 +01:00