Six is unused in the code, and generally unused in all of
Openstack, so remove it.
Removed setuptools pin in test-requirements.txt since it
was causing an older pkg_resources to be used, which was
trying to import six.
Fixed some invalid assertion statements in unit tests.
Change-Id: Id8c182a9aec5e25a8078b33127095ab8dce9dc33
Implement initial support for container-scoped storage-backend
relation to integrate nova-compute with storage providers.
Transition to blocked state if multiple storage backend
relations are connected
Change-Id: I03e67731df0263887d2d0f671750f420d6e62c1c
The subordinate charms should manage the services that
they deploys and configure, not the principle they are related to.
This change switches the approach for restarting services
from having the nova-compute charm doing it directly to having
nova-compute triggering the restart by request a restart down
the existing relations.
Closes-Bug: #1947585
Change-Id: I7419e39d68c70d21a11d03deeff9699421b0571e
OVS introduced a new service called ovs-record-hostname.service which
records the hostname on the first start in the ovs database to identify
the ovn chassis, this is how it achieved a stable hostname and be
resilient to the changes in the FQDN when the DNS gets available.
This change introduces the same approach for nova-compute charm. In the
first run of the NovaComputeHostInfoContext the value passed in the
context as host_fqdn is stored in the unit's kv db, and re-used on every
subsequent call.
This change affects only new installs since the hint to store (or not)
the host fqdn is set in the install hook.
Change-Id: I2aa74442ec25b21201a47070077df27899465814
Closes-Bug: #1896630
It was found that the modules test_actions_openstack_upgrade and
test_actions_package_upgrade were mocking different classes and
functions right before importing the modules under test
(openstack_upgrade and package_upgrade respectively), although these
mocks weren't being reset making tests executions coming after them to
get benefitted (or impacted) by the mocks in memory.
This patch takes advantage of mock.patch() decorator at the class level
and importlib.reload() to make sure the mocks don't outsurvive the
module.
When the teardown was in place it was found a different set of functions
that were relying on that mocking, so they were patched to allow the
tests run in the expected (mock'ed) environment.
Summary of changes:
- Move get_availability_zone() to contexts module, nova_compute_utils
depends on nova_compute_context, the latter shouldn't be importing
code from the former since it breaks the layering, even when the
import is being done within a function's body.
- Mock env variable JUJU_UNIT_NAME per test case, the tests defined
in the test_nova_compute_utils and test_nova_compute_contexts were
relying on the leakage of mocks set by other test modules, this
makes them run in an isolated fashion.
- Move update_nrpe_config testing to its own class, the main class
NovaComputeRelationsTests mocks the function update_nrpe_config()
making it difficult to test it in a test method, hence making the
test part of its own class it's posible to not mock the function
and correctly runs its implementation.
- Teardown mocks made at import level.
Func-Test-Pr: https://github.com/openstack-charmers/zaza-openstack-tests/pull/997
Change-Id: I4468ef1a0619befc75c6af2bad8df316125a7cf5
Enable vTPM support in nova-compute charm. This adds new packages to be
installed swtpm and swtpm-tools as well as updates the nova-compute.conf
file and the qemu.conf file to set appropriate user/groups for swtpm.
func-test-pr: https://github.com/openstack-charmers/zaza-openstack-tests/pull/696
Change-Id: Idf0d19d75b9231f029fa6a7dc557d2a9ee04915b
Ubuntu OpenStack Rocky migrated from python2 to python3, the package
python-oslo.privsep provides the privsep-helper program as an
alternative, when having it installed next to python3-oslo.privsep the
first installed will stay as a default.
This change add python-oslo.privsep to the list of packages that need to
be purged on OpenStack>=rocky.
Change-Id: Ib64dfa30b6705a45f82051dfc3634740a5f3a661
Closes-Bug: #1822763
os-brick upstream made some changes and started to use lsscsi for
discovering iSCSI devices. Make sure lsscsi is installed by the charm
until the os-brick package in Ubuntu pulls it as a dependency.
Closes-Bug: #1939390
Change-Id: I509d5edb3c6e3a4c35b7252b567a1672cf5e0bbe
Services have interdependencies and the order in which
we attempt to resume them is important, otherwise the
resume action may fail.
Uncovered while and validated by running the
openstack-upgrade tests. [1]
[1]: https://github.com/openstack-charmers/charmed-openstack-tester
Change-Id: I12218b47dc56b502ecc8578c6ab13acbd321bf26
Related-Bug: #1927277
Related-Bug: #1952882
For principal - subordinate plugin type relations where the
principal Python payload imports code from packages managed by a
subordinate, upgrades can be problematic.
This change will allow a subordinate charm that have opted into the
feature to inform its principal about all implemented release -
packages combinations ahead of time. With this information in place
the principal can do the upgrade in one operation without risk of
charm relation RPC type processing at a critical moment.
This makes use of
https://github.com/juju/charm-helpers/pull/643
This is similar to
https://review.opendev.org/c/openstack/charm-keystone/+/781822
Also fixed broken link to charm-guide.
Change-Id: Iaf5b44be70ee108cbe88b4a26f0f15f915d507fe
Closes-Bug: #1927277
Fix use of ephemeral-device with instances-path to ensure that
the configured block device is mounted in the desired location.
Ensure instances-path directory actually exists.
Change-Id: I81725f602ba3086bc142d59104e4bfc80918d8cf
Closes-Bug: 1909141
If an ephemeral-device storage configuration has been provided,
ensure that the nova-compute service will not start until the
mountpoint (currently /var/lib/nova/instances) has actually
been mounted. If this does not happen the nova-compute service
will fail to start in a failsafe condition.
Change-Id: Ic16691e119e430faec9994f6e207596629e47bb6
Closes-Bug: 1863358
When creating an instance with uefi support it is looking for various
files that are typically provided by ovmf package. This is automatically
installed from train and above, but is lacking in queens. This will
solve it for any deployment.
Change-Id: I7665a596112d673624ea5edd7438b915834918df
Nova supports setting allocation ratios at the nova-compute level from
Liberty onwards. Prior to this allocation ratios were set at the
nova-scheduler level.
Newton introduced the Placement API, and Ocata introduced the ability to
have compute resources (Core/RAM/Disk) precomputed before passing
candidates to the FilterScheduler [0]. Pike removed CoreFilter,
RAMFilter and DiskFilter scheduler filters.
From Pike onwards valid methods for settings these allocation ratios are via:
- A call to the Placement API [1].
- Config values to supplied to nova-compute (xxx_allocation_ratio).
Stein introduced initial_xxx_allocation_ratio in response to the runtime
behaviour of the ResourceTracker [2].
Currently, the precedence of resource ratio values are:
xxx_allocation_ratio > Placement API call > initial_xxx_allocation_ratio
That is a (compute) resource provider's allocation ratios will default
to initial_xxx_allocation_ratio which may be overridden at run time by a
call to the Placement API. If xxx_allocation_ratio is set it will
override all configurations for that provider.
When not otherwise configured, we set initial_xxx_allocation_ratio to
the values provided by ncc to maintain backwards compatibility. Where
initial_xxx_allocation_ratio is not available we set
xxx_allocation_ratio.
[0] https://specs.openstack.org/openstack/nova-specs/specs/ocata/implemented/resource-providers-scheduler-db-filters.html
[1] https://docs.openstack.org/api-ref/placement/#update-resource-provider-inventories
[2] https://specs.openstack.org/openstack/nova-specs/specs/stein/implemented/initial-allocation-ratios.html
Change-Id: Ifa314e9e23e0ae5d16113cd91a7507e61f9de704
Closes-Bug: #1677223
List of added actions:
* disable
* enable
* remove-from-cloud
* register-to-cloud
More detailed explanation of the process added to the README.md
Closes-Bug: #1691998
Change-Id: I45d1def2ca0b1289f6fcce06c5f8949ef2a4a69e
func-test-pr: https://github.com/openstack-charmers/zaza-openstack-tests/pull/470
A change landed to charm helpers to mark the
SubordinateConfigContext as incomplete if the subordinate supplied
no data *1. But the neutron-plugin subordinate may legitimately
supply no data if no special config is needed. This restores the
previous behaviour of marking the subordinate context for the
neutron-plugin relation as complete even if not data was supplied.
*1 https://github.com/juju/charm-helpers/pull/519
Change-Id: I34fa2d39171132e4fe7d0b7e5fd29162161a5060
Closes-Bug: #1912187
Update pydev project definition to use python 3.
Drop upper bound on flake8.
Tidy misc lint across codebase with newer flake8.
Change-Id: I9637ac603cb3801c9e3ffa8c2b0897968d42ada5
The current implementations use of a specific interface to build
FQDN from has the undesired side effect of the ``nova-compute`` and
``neutron-openvswitch`` charms ending up with using different
hostnames in some situations. It may also lead to use of a
identifier that is mutable throughout the lifetime of a deployment.
Use of a specific interface was chosen due to ``socket.getfqdn()``
not giving reliable results (https://bugs.python.org/issue5004).
This patch gets the FQDN by mimickingthe behaviour of a call to
``hostname -f`` with fallback to shortname on failure.
Add relevant update from c-h.
Needed-By: Ic8f8742261b773484687985aa0a366391cd2737a
Change-Id: I82db81937e5a46dc6bd222b7160ca1fa5b190c10
Closes-Bug: #1839300
A recent change (commit ceab1e91dc2e3948f6ba7c121c1801ad1641643c)
removed libvirt from the pause/resume list of services. This affected
series upgrade. Libvirt stayed down and did not start back up on resume.
This change checks the hook being executed and if it is
post-series-upgrade it includes libvirt as a service to start on resume.
Closes-Bug: #1839495
Change-Id: Ibfa24b678c1077b441464da8c38114ce23d14963
The main change is to fetch all of the relation_data() at once, and then
iterate through the python dictionary. This speeds up processing of
potentially hundreds of hosts and authorized_keys.
Change-Id: I095104f535c1eae1554f842502ae93ebb92e44fe
Related-Bug: #1833420
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-compute to receive vendor_data
configuration values from nova-cloud-controller charm
relation and write to nova-compute's nova.conf
appropriately.
This will be effictive for Queens and later OpenStack
releases.
Synced charm-helpers in order to import new context
for writing the vendor_data.json file.
Change-Id: I0c79e1bfac9fbe7009a7e862ad010cfa2de8cfda
Closes-Bug: #1777714
Ensure subordinate py3 packages are installed if their py2
counter-parts are currently installed for neutron-openvswitch.
In this case we had missed python(3)-neutron-fwaas.
Change-Id: I9d5e7c2ad034cd7bdf9cbf292b9107577860dac1
Closes-Bug: #1828259
Currently, the charm does not verify if iscsid is installed or
running. This patch adds those verifications on install and
update hooks.
Closes-bug: #1816435
Change-Id: I23992832a82557f406999427fe8d151f6a2b63af
Cinder volumes which are provisioned via nfs need to be mounted on
the compute nodes. For this to work the nfs-common package is needed.
Closes-Bug: #1816820
Change-Id: I5d536817b2098698cecd4627408a82321bf7fb9b
Ensure subordinate py3 packages are installed if their py2
counter-parts are currently installed for neutron-openvswitch
and ceilometer-agent.
Change-Id: I940fb2ce9d671e919c817cee7adda2ac22ecb3fb
Closes-Bug: #1816299
This change ensures that the multipath dependencies are installed
on the compute node when the use-multipath config flag is enabled.
Change-Id: I39b017398b95f5901d9bc57ffa0c59ff59f3a359
Closes-Bug: #1806830
libvirt needs to be running even when the pause action runs, this allows
commands like "virsh secret-list" run and having it running is safe
enough from a nova-compute unit point of view, because it won't touch
the already running instances.
Change-Id: Idec9e2b7c6275c4c5485942574120289552f2955
Closes-Bug: 1802917
Only write the libvirt-bin.override file if /etc/init actually
exists; This is really present to support upstart based deployments
so is not required on Ubuntu Xenial or later.
If nova-compute is deployed in a LXD container, this directory is
unlikely to be present in a pristine container image.
Change-Id: Ie68be0f3e7ca610478159f5f1dd491b8b755e82e
Closes-Bug: 1805191
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: I17abef16afbb8c62dae1b725c74c39cec414f4f8
Closes-Bug: 1803451
As well as destroying the network we should also undefine it
to ensure it does not return.
Change-Id: I57738856adb25c190357b1b23dd8a1245798cb14
Closes-Bug: #1800160
Switch to marking non-leaf python-* packages as automatically
installed so that they will be purged once the last remaining
package that depends on them that was manually installed is
removed.
Force install of python3-nova-lxd for Rocky and above to ensure
that py versions are matched with python3-nova.
Change-Id: I79d528bfb7732490aa42da2158244350c03dfa59
Closes-Bug: 1797879