Since OpenStack Train release the 'cpu_models' config option
has superseded the 'cpu_model' config option in the nova.conf.
This patch adds support for the new 'cpu_models' allowing a user
to provide a comma separated list of supported, named CPU models.
This patch also includes a unit test for the cpu_mode='custom'.
Closes-bug: #2025914
Change-Id: I30328abc07d3304f1bfb67c81360fb5229214c97
This change reworks previous changes [1] and [2] that had
been respectively reverted and abandoned.
When using the config libvirt-image-backend=rbd, VMs
created from image have their disk data stored in ceph
instead of the compute node itself.
When performing live-migrations, both nodes need to
access the same ceph credentials to access the VM's
disk in ceph, but this is currently not possible
if the nodes involved pertain to different
nova-compute charm apps.
This patch changes app name sent to ceph to
'nova-compute-ceph-auth-c91ce26f', a unique name common to
all nova-compute apps, allowing all nova-compute apps to
use the same ceph auth.
This change also ensures newly deployed nodes install
the old credentials first on ceph-joined hook,
and then supercedes it with the new credentials
on ceph-changed hook, therefore also retaining
the old credentials.
This patch also includes the charmhelpers sync
from PR: #840
[1] https://review.opendev.org/889642
[2] https://review.opendev.org/896155
Closes-bug: #2028559
Related-bug: #2037003
Func-Test-Pr: https://github.com/openstack-charmers/zaza-openstack-tests/pull/1149
Change-Id: I1ae12d787a1f8e7761ca06b5a80049c1c62e9e90
This reverts commit c3c2cf0349.
Reason for revert: This introduces an undesired behavior when scaling-out that needs to be addressed in a complementary patch.
Change-Id: I21c127aa565e489ba4d93a1efc8ddba63ef32e87
When using the config libvirt-image-backend=rbd, VMs
created from image have their disk data stored in ceph
instead of the compute node itself.
When performing live-migrations, both nodes need to
access the same ceph credentials to access the VM's
disk in ceph, but this is currently not possible
if the nodes involved pertain to different
nova-compute charm apps.
This patch changes app name sent to ceph to 'nova-compute',
allowing all nova-compute apps to use the same ceph auth.
This patch also includes the charmhelpers sync
from PR: #840
Closes-bug: #2028559
Change-Id: I7222661017655fd7225db0c677f1a8f5ebb7984d
After evacuations and revert resizes when using rbd storage backend,
the instance folder is usually left behind and causes issues when
migrating the instance back to the host.
With the config option set, the nova-compute service will cleanup
those folders as part of the periodic checks that run for instances
that have been evacuated/migrated.
Closes-bug: #2019141
Change-Id: I846ccb0a95d04139b41fdad6cbf465d303d6cc09
This patch configures Nova to send a service token along with the
received user token on requests to other services. This can allow those
other services to accept the request even if the user token has been
invalidated since received by Nova. Also with this patch Nova will
accept request from other services with invalid user tokens but valid
service tokens. Service tokens exist since Openstack Queens.
Closes-Bug: #1992840
Change-Id: I78b43ef77dc1d7b5976ec81ecddf63c9e6c8b6c1
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
The nova-cloud-controller charm passes allocation ratio defaults
in the format '{cpu,disk,ram}_allocation_ratio' on the cloud-compute
relation.
Ensure that later OpenStack releases (>= Stein) query using this
key rather than one prefixed with 'initial_' which is used for the
target Nova Compute configuration option.
Closes-Bug: 1961065
Change-Id: I7d3e7f9f5c69f7ad06191a20bdfcfd6b5dca50d3
By default resizing an instance to the same host as the source is
not enabled. This change adds new charm config option that maps
directly to the nova.conf setting which effectively gives a user
possibility to enable/disable this functionality.
Closes-Bug: #1946620
Depends-On: I13d0c332cd0b110344b7a1645e3e4fd250fce33a
Change-Id: I2f2e9e44f6bba48e15621a216539089c7e3abc1d
The upstream has 3 min as the timeout (60 retries at 3-seconds
interval). It should work if an image is in a raw format to leverage
Ceph's copy-on-write or an image is small enough to be copied quickly.
However, there are some cases exeeding the 3 min deadline such as a big
enough image with Qcow2 or other formats like Windows images, or storage
backend doesn't have copy-on-write from Glance.
Let's bump the deadline to 15 min (300 retries at 3-seconds interval) to
cover most of the cases out of the box, and let operators tune it
further by exposing those options.
Co-authored-by: Mark Maglana <mark.maglana@canonical.com>
Closes-Bug: 1758607
Change-Id: I6f6da8e90c6bbcd031ee183ae86d88eccd392230
The config is necessary to calculate available disk space for VMs with
disk-allocation-ratio which is already exposed as a charm option.
Closes-Bug: #1952184
Change-Id: I0ef55987517bded50f855e0dbc5e420cfbff4c1b
Especially with arm64/aarch64, the default value limits the number of
volume attachments to two usually. And when more than two volumes are to
be attached, it will fail with "No more available PCI slots". There is
no one-size-fits-all value here so let operators override the default
value.
Closes-Bug: #1944214
Change-Id: I9b9565873cbaeb575704b94a25d0a8556ab96292
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
The cross_az_attach property needs to be configured on the compute
nodes. The policy is set on the ncc service and is propigated to the
compute nodes on the cloud-compute relation. Update the relevant cinder
config setting based on the value provided.
Note, the default value for cross_az_attach is aligned with the nova
default of True.
Closes-Bug: #1899084
Change-Id: I7d00b50acbfe05dfd943a3511126b507fc570aeb
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
This config option is to enable admin
password injection at instance boot time
* Added unit test to verify the config
is correctly set and nova.config is
updated.
* Updated all of the templates that have
inject-password set
* Moved inject_* options out of
{if libvirt_images_type and rbd_pool}
block as they are irrelevant.
Closes-Bug: #1755696
Change-Id: Ie766a14bfa6b16337aa957bf7adf2d869462f9d7
Enable support for use of Erasure Coded (EC) pools for
nova disks when RBD is used to back ephemeral storage volumes.
Add the standard set of EC based configuration options to the
charm.
Update Ceph broker request to create a replicated pool, an erasure
coding profile and an erasure coded pool (using the profile) when
pool-type == erasure-coded is specified.
Resync charm-helpers to pick changes to the standard ceph.conf
template and associated contexts for rbd default data pool mangle
due to lack for explicit support in OpenStack Services.
Update context to use metadata pool name in nova configuration
when erasure-coding is enabled.
Change-Id: Ida0b9c889ddf9fcc0847a9cee01b3206239d9318
Depends-On: Iec4de19f7b39f0b08158d96c5cc1561b40aefa10
Update pydev project definition to use python 3.
Drop upper bound on flake8.
Tidy misc lint across codebase with newer flake8.
Change-Id: I9637ac603cb3801c9e3ffa8c2b0897968d42ada5
This patch adds a focal-ussuri and bionic-ussuri bundles to the tests
for the charm. The linked bug is concerned with installing
nova-network, which is not available on Ussuri.
Closes-Bug: #1872770
Change-Id: Iea5a682aaebeb6f6941cf9d8f5780473f457e455
Get the DNS domain for the dhcp_domain setting for nova metadata over
the cloud-compute relation from nova-cloud-controller.
Fixes Bug #1805645 when using provider networks with no network node.
Change-Id: Iaba14e6939ab5d488c6299ce5cb33e26f757cf95
Partial-Bug: #1805645
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
spice_agent_enabled is provided by nova-cloud-controller to inform
nova-compute the value that needs to be set in the configuration option
[spice].agent_enabled
Change-Id: I49d6e04a545d4b13f9a65e5fd239aa911e75a3ba
Closes-Bug: #1856602
The per-host config cpu-dedicated-set will provide new flexibility by
adding ability to pack guests vCPUs which need dedicated host CPUs vs
guests vCPUs which can float over a set of host CPUs (see:
cpu-shared-set).
Change-Id: Ia2181ad2bd1894d5c2f91be5df8396bc77555658
Signed-off-by: Sahid Orentino Ferdjaoui <sahid.ferdjaoui@canonical.com>
This commits adds a new extra binding (migration) and
its corresponding fallback configuration flag (libvirt-
migration-network) that allows to specify a space or an
existing CIDR formatted network (if the config flag is pre-
ferred) that will be seleced as the inbound address to be used
as a the live migration target.
For the case of any openstack release >= ocata,
the live_migration_inbound_addr variable will be set
as well as the libvirt_migration_scheme (set to SSH
by default).
For older releases, the behavior remains as before,
as the only remaining option is to setup libvirt
to bind in a insecure tcp connection, so we keep it
as the current live_migration_uri.
The reason of not using an extra-binding exclusively relies
on the back-compability of the change, this needs
to be applied on existing clouds where updating
the bindings on deployed application
isn't possible due to LP: #1796653.
For fresh/new deployments, the migration extra-binding
has been defined and used with precedence over the
libvirt-migration-network variable.
Change-Id: I2f8c0a1e822ad6a90e23cd8009e181b8f86d765a
Closes-Bug: #1680531
Signed-off-by: Jorge Niedbalski <jnr@metaklass.org>
If a new version of the charm is used to install a version of
OpenStack prior to Stein, do not enable the FQDN registration.
Change-Id: Ib86d6a48ee34c9efc42b4455ac669ef0cb8dc3bb
Closes-Bug: #1846781
The change of behaviour will only have affect on newly installed
deployments on OpenStack Train and onwards.
Also set upper constraint for ``python-cinderclient`` in the
functional test requirements as it relies on the v1 client
which has been removed. We will not fix this in Amulet, charm
pending migration to the Zaza framework.
Change-Id: Ia73ed6b76fc7f18014d4fa913397cc069e51ff07
Depends-On: Iee73164358745628a4b8658614608bc872771fd1
Closes-Bug: #1839300
Ensure domain info is in CloudComputeContext. The nova.conf template
is already setup to render the domain if it present.
There is aslo a drive-by fix to two unit tests which were failing
locally due to a missing mock.
Change-Id: I4f2fd2cf7fcfbb009589907ce1f6245f0121ecd9
Cloaes-Bug: 1830536
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
This change implements a new option in config.yaml that sets the
default format for new ephemeral volumes attached to instances.
Closes-Bug: #1693943
Change-Id: Iff9254039fa6f1cef9d80c0d59de8e37b39e30f0
Implement missing configuration options and context to support
configuration of:
live_migration_permit_auto_converge
live_migration_permit_post_copy
in nova.conf. The configuration parameters are only added to the
nova.conf template when live-migration is actually enabled, since they
have no purpose without live-migration enabled. The options are added to
version Newton and upwards as that is the Nova version since they were
first supported.
Change-Id: I1bb3cee4ac532d0867b4297c742707668566a527
Closes-Bug: #1799916