Commit Graph

73 Commits

Author SHA1 Message Date
Felipe Reyes b915f8e6f8 Use wss protocol when SSL enabled
This patch checks if HTTPS configuration is enabled in Apache to
determine if the websocket protocol should switch from 'ws' to 'wss' or
not.

Change-Id: I738652373604966b6df079e45a0ad26c83e21688
Closes-Bug: #2039490
2023-10-26 18:09:35 -03:00
Alex Kavanagh 3d237a44ec Improve platform mocking
Patch out charmhelpers.osplatform.get_platform() and
charmhelpers.core.host.lsb_release() globally in the unit tests to
insulate the unit tests from the platform that the unit tests are being
run on.

Change-Id: I25df688c9ec07168b825815b1e1c27ecf2673d2b
2023-10-24 14:49:41 +01:00
Zuul f022edc81f Merge "Drop AvailabilityZoneFilter inline with upstream removal" 2023-10-02 21:36:03 +00:00
Corey Bryant 5cf66c87c7 Drop AvailabilityZoneFilter inline with upstream removal
The was removed from upstream nova in the 2023.2 cycle
via commit 5edd805fe2395f35ecdfe5b589a51dc00565852f.

The nova release note states:

The ``AvailabilityZoneFilter`` was deprecated for removal
in 24.0.0 (Xena) and has now been removed.
The functionality of the``AvailabilityZoneFilter`` has been
replaced by the``map_az_to_placement_aggregate`` pre-filter.
The  pre-filter was introduced in 18.0.0 (Rocky) and enabled
by default in 24.0.0 (Xena). This pre-filter is now always
enabled and the ``[scheduler] query_placement_for_availability_zone``
config option has been removed.

This change also syncs the charm-helpers change from:
https://github.com/juju/charm-helpers/pull/850

Closes-Bug: #2037751
Closes-Bug: #2036766
Change-Id: I315900a7e32ec66b27fa69961e9b7dcb9fa1f949
2023-09-29 19:21:36 +00:00
Felipe Reyes 816ee80cd0 Add new interface 'dashboard'
This new interface consumes information exposed by openstack-dashboard
to correctly configure nova-serialproxy and allow requests coming from
the web browser that tries to load the serial console.

Change-Id: I2d82abffb9649f16a792f180806cea36cc5e25df
Closes-Bug: #2030094
2023-09-21 10:17:36 -03:00
Zuul f55776445f Merge "Expose max_local_block_devices as an explicit charm option" 2022-03-11 08:41:05 +00:00
Arif Ali cdaa255120
Add scheduler-max-attempts flag
Using affinity/anti-affinity policies sometimes we get into a race
condition on the resources that are available on the hypervisors.
This flag allows to increase the number of retries and hence hosts
to schedule on and therefore allowing the successful scheduling
of instances.

This option was taken from the following URL, while future work
with placement is done to help with scheduling with affinity

https://docs.openstack.org/nova/latest/admin/troubleshooting/affinity-policy-violated.html

Signed-off-by: Arif Ali <arif.ali@canonical.com>
Change-Id: I353dbaa38eb0526014888ede27702b428eb66afd
2022-02-22 11:15:53 +00:00
Nobuto Murata 0e9136fe1e Expose max_local_block_devices as an explicit charm option
It's useful to force instance creations to fail if ephemeral drives are
requested when cloud admins want users to use persistent volumes always.

Closes-Bug: #1953561
Change-Id: I1c958b4bcf79512c06de6d81fe55c681bb5f38a7
2022-02-21 22:28:40 +09:00
Marcin Wilk 690d1d190c Allow resizing to the same host
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
Change-Id: I13d0c332cd0b110344b7a1645e3e4fd250fce33a
2022-02-11 15:46:56 +00:00
Hervé Beraud 71bc319326 Use unittest.mock instead of mock
The mock third party library was needed for mock support in py2
runtimes. Since we now only support py36 and later, we can use the
standard lib unittest.mock module instead.

Note that https://github.com/openstack/charms.openstack is used during tests
and he need `mock`, unfortunatelly it doesn't declare `mock` in its
requirements so it retrieve mock from other charm project (cross dependency).
So we depend on charms.openstack first and when
Ib1ed5b598a52375e29e247db9ab4786df5b6d142 will be merged then CI
will pass without errors.

Depends-On: Ib1ed5b598a52375e29e247db9ab4786df5b6d142
Change-Id: Id925078c5c04c2f89a570bdf7171c666839f9e40
2021-12-15 14:16:56 +00:00
James Vaughn 6c1efee2d0 Add aggregate filtering and isolation options
Add limit-tenants-to-placement-aggregate,
placement-aggregate-required-for-tenants and
enable-isolated-aggregate-filtering options.

Closes-Bug: #1920982
Change-Id: Ibbb0e412d1a821cdb56e447ca88b91afca50c8c6
2021-11-29 10:34:26 +09:00
Alex Kavanagh 36ef217bc6 Fix SQLite locking issue on unit tests
stestr runs tests in parallel and this can cause issues with locking
when SQLite is not mocked out properly and gets used in a test.  This
patch just switches Storage to use :memory: so that locking does not
occur.

Closes-Bug: #1908282
Change-Id: Iaa1c7b78dee498e0cc6dc6fccf12e74f22225ecd
2021-11-04 10:52:39 +00:00
Alex Kavanagh 51b3383b03 Updates for testing period for 20.01 release
Includes updates to charmhelpers/charms.openstack for cert_utils
and unit-get for the install hook error on Juju 2.9

* charm-helpers sync for classic charms
* rebuild for reactive charms
* ensure tox.ini is from release-tools
* ensure requirements.txt files are from release-tools
* On reactive charms:
  - ensure master branch for charms.openstack
  - ensure master branch for charm-helpers
* Remove unit_get mock from unit tests as not in charmhelpers context

Change-Id: Ic828c8d6dd45148a1684c74d3f2b2157cfe6bbc4
2021-01-18 19:05:18 +00:00
Corey Bryant 2205b650f4 Drop RetryFilter in Victoria inline with upstream
Change-Id: I77a25831efc409ec15aee91a1ca2cbec2a526e39
Closes-Bug: #1897331
2020-09-25 19:04:49 +00:00
Andrea Ieri 1bf5a92832 Make disabling build_failure_weight_multiplier optional.
This commit introduces a new charm option allowing operators to override
the hardcoded 0.0 that disabled hypervisor demotion on build failures
from pike onward.

In certain environments it may be preferable to retain the upstream
behavior of letting the scheduler work around malfunctional computes and
favor instance building reliability at the cost of a potentially uneven
load distribution.

Change-Id: I2faa5ab8cd505a9d61a9fa26e1b08d16b0c795fb
Closes-Bug: 1892934
2020-08-28 09:53:44 -04:00
James Page f0095ffcbb Use public endpoint binding for console cert and key
Ensure that the public endpoint binding is used to resolve the
path to the SSL certificate and key files as the base access
URL for console access is always via this binding.

Add unit tests to cover the InstanceConsoleContext class.

Change-Id: I27de9445d249b0d670543d250bd02f450764a10f
Closes-Bug: 1871428
2020-07-22 10:10:15 +01:00
Hemanth Nakkina b5b6966f6d Add new config option to set [quota].count_usage_from_placement
New config option count_usage_from_placement is added in Nova from
Train release to enable/disable counting of quota usage from placement
service. Corresponding config parameter is required in nova-cloud-controller
charm.

This patch introduces quota-count-usage-from-placement config parameter in
nova-cloud-controller charm. For openstack releases train or above, this
option is rendered in nova.conf for nova-cloud-controller units.

func-test-pr: https://github.com/openstack-charmers/zaza-openstack-tests/pull/250
Change-Id: I57b9335b7b6aecb8610a66a59cb2e4e506e76a5e
Closes-Bug: #1864859
2020-04-28 18:07:21 +05:30
James Page 24531f5c28 Enable hardware offload support
Enable PCI Passthrough Filter if neutron-api charm has enabled
support for hardware offloading.

Change-Id: I0ccb4366b03557b316da1507015112c7f378176e
Depends-On: I1f59012ad2d16af18ca310906f6c6b537bb7ec72
2020-03-18 10:30:17 +00:00
Vladimir Grevtsev ab6398463a Adding support for cross_az_attach config option.
Allow attach between instance and volume in different
availability zones. If False, volumes attached to an
instance must be in the same availability zone
in Cinder as the instance availability zone in Nova.

Change-Id: I21df8e0dfa585133c5ef6a55cdbbc2071c267424
Closes-Bug: #1856776
2020-03-09 14:41:00 +03:00
Sahid Orentino Ferdjaoui 40282e0356 config: allow to create VMs with unique names
This commit introduces option osapi_compute_unique_server_name_scope
which allows operators to ensure VMs are created with unique names per
project or cloud.

Change-Id: Idacb60bb31cd60cb1deaec7cb3ec061f0c04da24
Closes-Bug: #1829782
Signed-off-by: Sahid Orentino Ferdjaoui <sahid.ferdjaoui@canonical.com>
2019-12-20 11:52:56 -03: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
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
Zhang Hua b182ffa7f7 Add the support to customize the console access port
For novnc, need to set novncproxy_port in proxy nodes and
novncproxy_base_url in nova-compute nodes.
For xvpvnc, need to set xvpvncproxy_port in proxy nodes and
xvpvncproxy_base_url in nova-compute nodes.
For spice, need to set spicehtml5proxy_port in proxy nodes and
spicehtml5proxy_base_url in nova-compute nodes.

When release >= Mitaka, novncproxy_port and xvpvncproxy_port
are moved from [default] section into [vnc] section.
spicehtml5proxy_port is renamed to html5proxy_port and moved
to [spice] section.

So eventually the console access port can be customized by:

juju config nova-cloud-controller console-access-protocol=novnc
juju config nova-cloud-controller console-access-port=xx

If console-access-port is not defined, then default port is 6080
for novpc, 6081 for xvpvnc, 6082 for spice.

Change-Id: I4775ad42ba11b0c28163bf7e3718c56d18a2031f
Closes-Bug: #1800753
Signed-off-by: Zhang Hua <joshua.zhang@canonical.com>
2019-03-16 10:46:44 +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
James Page b99d806cf3 Update default scheduler filters
Make the default set of scheduler filters conditional on the release
being deployed; For Pike or later the CoreFilter, RamFilter and
DiskFilter are superfluous to requirements as this filters are in
effect completed by the Placement API.

Add DiskFilter to list of filters for older OpenStack releases.

Change-Id: Iddb4f1f068b982dcd9a70b11b89df1be9f8aaf20
Closes-Bug: 1731302
Closes-Bug: 1732164
2019-03-04 16:20:12 +00:00
Zuul b33397afa8 Merge "Release based management of haproxy context" 2019-02-25 10:13:23 +00:00
James Page aee921b57e Release based management of haproxy context
Ensure that the haproxy context reflects the services associated
with the specific release of OpenStack being deployment.

    < kilo: ec2 and s3 services deployed
    >= ocata: placement service deployed

Change-Id: I0d44aa361595f777df625d3a4a0f2a0cd2f81660
Closes-Bug: 1811398
2019-02-22 10:36:18 +00:00
James Page d746152fb8 Fix formatting of vendordata_providers config
Align formatting of vendordata_providers configuration for nova
with changes in neutron-gateway; values must be strings, delimited
by a comma.

Change-Id: I5293edd77387347f8c012521f4bdeffadc919438
Closes-Bug: 1810953
2019-02-22 10:21:02 +00:00
Andre Ruiz 5f21ea7124 Implement new option: enable_new_services
This change implements a new option in config.yaml that allows
services to come up disabled and be manually enabled later.

Change-Id: I345b56e347b63650ee3df07773ccb2e333610355
Closes-Bug: #1758776
2019-02-19 11:16:21 -03:00
Syed Mohammad Adnan Karim 95cd9bfd10 Add default project quota configuration for compute
Prior to this, the charm config did not support default quota
configurations for compute (ie. instances, compute, ram, etc.).
Default quota configuration changes will not impact existing
projects with modified quotas. Only new projects and projects with
unmodified quotas will adopt the defaults in the configuration file.

The following default quota settings were added:
instances
cores
ram
metadata_items
injected_files
injected_file_content_bytes
injected_file_path_length
key_pairs
server_groups
server_group_members

The functional test added checks that nova.conf quotas are set in
the correct section of the file.

Change-Id: Iae8c84dbfec97e1879d51963125f7674ea20ba22
Closes-Bug: 1386911
2018-12-17 20:29:03 +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
Zuul 7832164cad Merge "Accept lists in pci-alias charm config" 2018-10-10 16:27:54 +00: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 630a07013f Accept lists in pci-alias charm config
Allow json lists to be passed in via the pci-alias charm config
option so that multiple aliases can be set.

Increase amulet timeout due to gate failures

Change-Id: I3b5ea70224536f8d40f9c04482fa676c2b230bdd
Partial-Bug: #1735205
2018-10-05 10:07:51 +00: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
Ryan Beisner 33881c371b Sync charm-helpers
Notable issues resolved:

openstack_upgrade_available() broken for swift
https://bugs.launchpad.net/charm-swift-proxy/+bug/1743847

haproxy context doesn't consider bindings
https://bugs.launchpad.net/charm-helpers/+bug/1735421

regression in haproxy check
https://bugs.launchpad.net/charm-helpers/+bug/1743287

Change-Id: Ifb1d9e71924db6ab8a3d9ee34fcd1b40f910d68a
2018-01-19 16:18:19 +02:00
Edward Hope-Morley 05ea3a13f1 Only use PciPassthroughFilter when sriov enabled
Fixes code that inadvertently interprets strings as
booleans resulting in them always being True.
PciPassthroughFilter will now only be added to
scheduler_default_filters if sriov is enabled.

Change-Id: Ie2c79e98d7880e8172ac7e77febb51af04732bec
Closes-Bug: 1730369
2017-11-06 12:03:27 +00:00
Edward Hope-Morley af5a4ec747 Add disk-allocation-ration config option
We already support configuring ram and cpu overcommit so
this patch adds the ability to control disk overcommit.

Change-Id: Ib172e8b48cb34de4beb9cec1a277dc43ded36eed
Closes-Bug: 1726346
2017-10-23 12:11:35 +01: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 e94f7882cb Avoid shared-db change when using access-network
When the percona-cluster charm sets an access-network but the default
unit-get address is not on that network extra shared-db relations get
executed. This is specifically a problem when running upgrades and
trying to avoid API downtime.

The root cause is that the access-network is not checked until the
SharedDBContext is consulted. But then db_joined function will
change it back to the wrong ip on subsequent runs.

This change adds a check for access-network on the relation during the
db_joined function and pushes IP selection off to get_relation_ip.

Charm helpers sync to pull in changes to get_relation_ip.

Partial-bug: #1677647
Change-Id: Ifd4e975d9abbb9f7a8b0f12c8f0a8cf8f78595b6
2017-04-25 14:32:19 -07:00
James Page 469ef8dced Add support for serial console proxy access
Support access to instances via optionally enabled serial console
feature provided in Nova.

Seria console access is enabled using a new config flag; this flag
plus the required base_url for the nova-serialproxy are also passed
over the cloud-compute relation for use in nova-compute units.

This is only supported in OpenStack Juno or later, and replaces
the standard output to the nova console-log.

Change-Id: I3bfcca88bd6147be337e6d770db7348170b914e6
2016-09-15 12:37:33 +01:00
Felipe Reyes 68b0afed6d Add disable-aws-compat config to disable AWS compatibility layer
For OpenStack >= Liberty EC2 and objectstore services aren't installed and
deprecated, but there is no way to disable it, this patch adds a way to
permanently disable and enable them

Change-Id: Ie78ba5af1d953e8ebed9195202522ff73efcde9f
Closes-Bug: #1533255
2016-09-12 05:46:43 +00:00
Corey Bryant a946731d24 Use os_release() to determine OpenStack release
Use os_release() instead of get_os_codename_install_source() to
determine the OpenStack release in resolve_services(). This is
needed when deploying from source because it checks both
openstack-origin and openstack-origin-git when determining the
release.

Change-Id: I39a61fc4394967bd70af493f6a69fe9d428274b1
2016-08-10 15:31:18 +00:00
Billy Olsen 8d35070586 Change worker-multiplier to float
Change the worker-multiplier to a floating point config option type
instead of integer. This allows users to specify workers to be less
than the number of CPUs, which is useful in deployments with multiple
services deployed into containers on top of bare metal.

The fix is to simply change the config option type and to sync in
the necessary update from lp:charm-helpers.

Partial-Bug: #1602444

Change-Id: I2c846832d24f709a3d019b766f5f23c28c4371f4
Signed-off-by: Billy Olsen <billy.olsen@gmail.com>
2016-07-12 17:39:11 -07:00
James Page c103450dbb Re-license charm as Apache-2.0
All contributors to this charm have agreed to the switch
from GPL v3 to Apache 2.0; switch to Apache-2.0 license
as agreed so we can move forward with official project status.

Change-Id: I20448e0370138e103a00c7fcf0f49949c82d33a9
2016-07-03 16:38:27 +00:00
James Page c2bc02e3ab Drop support for Neutron functionality
Neutron functionality was deprecated last release; remove
direct support for managing the neutron-server process and
associated plugin support from this charm.

All neutron-server support is now provided by the neutron-api
charm.

Change-Id: Iec7bd5ec6d835b573a15f8163fa5f78842bd672b
2016-04-08 11:46:52 +01:00
Edward Hope-Morley 4b98e30307 Add hardening support
Add charmhelpers.contrib.hardening and calls to install,
config-changed, upgrade-charm and update-status hooks.
Also add new config option to allow one or more hardening
modules to be applied at runtime.

Change-Id: Icf48829e010d35d7d7a4ccd547eae6a8c511c04e
2016-03-31 19:30:33 +01:00
James Page 6e8dcf8af8 Drop support for OpenStack releases < Icehouse
Rollup all old configuration file templates, remove any related
to Quantum which was renamed in the Havana release.

Drop references in code to Quantum, refactor unit tests to baseline
on Icehouse rather than anything older.

Drop relation and associated references to nova-volume service;
deprecated in Folsom and removed in Havana.

Drop ml2 migration - this was required when migrating to Icehouse
from older releases.

Change-Id: I6f5d641ffef2599d0dfc8e16a2dce3cc7be88bd4
2016-03-23 12:40:37 +00:00
billy.olsen@canonical.com 19df3b6430 [billy-olsen,r=] Add region information to the conf files, relations.
This change adds the appropriate region information to the conf files
and to the cloud-compute relations in order to ensure that the region
can be configured on all nova components.

Closes-Bug: #1468306
2016-02-12 10:38:21 -07:00
Liam Young 0af9078ed0 [jjo,gnuoy,r=thedac] jjo: only add neutron-server to HAProxyContext if neutron-api relation is not made, fixes lp#1476394. gnuoy: added unit tests 2015-09-29 07:46:46 +01:00