Commit Graph

299 Commits

Author SHA1 Message Date
Zuul 818f0cd4a3 Merge "Remove nova.wsgi module" 2024-03-19 19:42:00 +00:00
Stephen Finucane 4e182a664e Remove nova.wsgi module
We want this module for use elsewhere. Given there's only a single
caller (nova.service) we can simply move the code to the caller.

Change-Id: I2c3887db8b3f6833bf24f5114fd955e1af590d03
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
2023-12-06 09:50:58 +00:00
Sean Mooney 7402822f0b [codespell] start fixing all the typos
this is the inital patch of applying codespell to nova.
codespell is a programing focused spellchecker that
looks for common typos and corrects them.

i am breaking this into multiple commits to make it simpler
to read and will automate the execution of codespell
at the end of the series.

Change-Id: If24a6c0a890f713545faa2d44b069c352655274e
2023-10-03 00:51:35 +01:00
Dan Smith afad847e4d Populate ComputeNode.service_id
The ComputeNode object already has a service_id field that we stopped
using a while ago. This moves us back to the point where we set it when
creating new ComputeNode records, and also migrates existing records
when they are loaded.

The resource tracker is created before we may have created the
service record, but is updated afterwards in the pre_start_hook().
So this adds a way for us to pass the service_ref to the resource
tracker during that hook so that it is present before the first time
we update all of our ComputeNode records. It also makes sure to pass
the Service through from the actual Service manager instead of looking
it up again to make sure we maintain the tight relationship and avoid
any name-based ambiguity.

Related to blueprint compute-object-ids

Change-Id: I5e060d674b6145c9797c2251a2822106fc6d4a71
2023-05-31 07:06:34 -07:00
Dan Smith cf111d1001 Pass service ref to init_host(), if exists
This just adds the service ref to init_host() so that we can pass it
(if it exists) at startup. On the first run, this will be None, so
we know that we don't have an existing service record and thus do not
need to do any migration.

Related to blueprint stable-compute-uuid

Change-Id: I1491c9b234ef0c262b5ed01d4c138eba8dedff77
2023-01-20 07:22:02 -08:00
Dan Smith 7d2e481589 Add service version check workaround for FFU
We recently added a hard failure to nova service startup for the case
where computes were more than one version old (as indicated by their
service record). This helps to prevent starting up new control
services when a very old compute is still running. However, during an
FFU, control services that have skipped multiple versions will be
started and find the older compute records (which could not be updated
yet due to their reliance on the control services being up) and refuse
to start. This creates a cross-dependency which is not resolvable
without hacking the database.

This patch adds a workaround flag to allow turning that hard fail into
a warning to proceed past the issue. This less-than-ideal solution
is simple and backportable, but perhaps a better solution can be
implemented for the future.

Related-Bug: #1958883

Change-Id: Iddbc9b2a13f19cea9a996aeadfe891f4ef3b0264
2022-01-24 08:45:58 -08:00
Balazs Gibizer 433bee58bc Restore retrying the RPC connection to conductor
Before Ie15ec8299ae52ae8f5334d591ed3944e9585cf71 if the compute was
started before the conductor then the compute retried the connection
until the conductor was up. The Ie15ec8299ae52ae8f5334d591ed3944e9585cf71
break this behavior as the service version check runs before this RPC
retry mechanism and therefore the compute simply fails to start without
a retry if no conductor is started.

This patch moves the service version check after the RPC connection
retry mechanism.

Change-Id: Iad0ba1a02868eebc2f43b1ac843fcc5096cd5c47
Closes-Bug: #1904181
2020-11-13 18:02:00 +01:00
Balazs Gibizer aa7c6f8769 Prevent starting services with older than N-1 computes
Nova services only support computes that are not older than
the previous major release. This patch introduces a check in the
service startup that prevents staring the service if too old computes
are detected.

Change-Id: Ie15ec8299ae52ae8f5334d591ed3944e9585cf71
2020-11-04 14:05:52 +01:00
Zuul f269bb98d8 Merge "Remove monotonic usage" 2020-08-17 15:29:46 +00:00
Stephen Finucane d565e7a092 trivial: Remove remaining '_LI' instances
Once again, do what we did for '_LE' and '_LW' and remove the final
remnants of the log translation effort.

Change-Id: Id6cf7a9bfbe69d6d3e65303e62403d1db9188a84
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
2020-05-18 17:00:57 +01:00
Stephen Finucane 3a28b0e771 trivial: Remove remaining '_LW' instances
There are only a few of these remaining in the code base. Remove them.

Change-Id: I33725e2439b0f39c1e9bec9e33a37bf3e24944fb
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
2020-05-18 17:00:41 +01:00
Stephen Finucane eee57f2380 trivial: Remove remaining '_LE' instances
We've been slowly removing these as we go. Remove the final few '_LE'
occurrences now.

Change-Id: I75ebd2e95a0c77585d7b4329ca01e4bacc1dd7c4
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
2020-05-18 16:52:20 +01:00
Sean McGinnis 5af9ad4e54
Remove monotonic usage
The monotonic package was needed for monotonic time operations when
running under Python runtimes older than 3.3. Since we now only support
versions higher than this, this third party package requirement can now
be removed.

Change-Id: I955117b838cdd8a1858cfccbc3caa33ba6ad59f7
Signed-off-by: Sean McGinnis <sean.mcginnis@gmail.com>
2020-05-04 17:34:00 -05:00
melanie witt 941559042f Reset the cell cache for database access in Service
We have had a gate bug for a long time where occasionally the scheduler
service gets into a state where many requests fail in it with
CellTimeout errors. Example:

  Timed out waiting for response from cell <cell uuid>

Through the use of much DNM patch debug logging in oslo.db, it was
revealed that service child processes (workers) were sometimes starting
off with already locked internal oslo.db locks. This is a known issue
in python [1] where if a parent process forks a child process while a
lock is held, the child will inherit the held lock which can never be
acquired.

The python issue is not considered a bug and the recommended way to
handle it is by making use of the os.register_at_fork() in the oslo.db
to reinitialize its lock. The method is new in python 3.7, so as long
as we still support python 3.6, we must handle the situation outside of
oslo.db.

We can do this by clearing the cell cache that holds oslo.db database
transaction context manager objects during service start(). This way,
we get fresh oslo.db locks that are in an unlocked state when a child
process begins.

We can also take this opportunity to resolve part of a TODO to clear
the same cell cache during service reset() (SIGHUP) since it is another
case where we intended to clear it. The rest of the TODO related to
periodic clearing of the cache is removed after discussion on the
review, as such clearing would be unsynchronized among multiple
services and for periods of time each service might have a different
view of cached cells than another.

Closes-Bug: #1844929

[1] https://bugs.python.org/issue6721

Change-Id: Id233f673a57461cc312e304873a41442d732c051
2020-04-08 17:48:18 +00:00
Stephen Finucane da51a34f7b nova-net: Remove 'MetadataManager'
This was only applying some iptables rules when running under
nova-network. Since that's no longer possible, we don't need to keep the
manager around. So don't!

Change-Id: I4350b6f3ca3fd7de1bc6db3e14fe261f2746b002
Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
2020-01-08 13:54:12 +00:00
Stephen Finucane 6537a537f9 Remove 'nova-console' service, 'console' RPC API
This legacy service was only compatible with the XenServer driver and
has effectively been replaced by the noVNC console proxy service. Remove
the service. The API that provided remote access to this service,
'os-consoles', was removed in a previous change. Note that
'os-remote-consoles' is unrelated and therefore is not removed, though
it will now reject requests for XVP VNC consoles.

This was previously discussed and agreed on openstack-dev [1] and
openstack-discuss [1].

Part of blueprint remove-xvpvncproxy

[1] http://lists.openstack.org/pipermail/openstack-dev/2018-October/135413.html
[2] http://lists.openstack.org/pipermail/openstack-discuss/2019-April/005369.html

Change-Id: Ib1ff32f04b16af7981471f67c8e0bf04e6ecb6be
Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
2019-11-22 16:09:38 +00:00
Stephen Finucane 2398b78df5 Remove nova-consoleauth
Obliterate all references to the aforementioned service. This mostly
consists of removing the core service and any references to the now
removed '[workarounds] enable_consoleauth' configuration option.

Part of blueprint remove-consoleauth

Change-Id: I0498599fd636aa9e30df932f0d893db5efa23260
Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
Depends-On: Icfc175c49a1fc650d1c9ad06b77209a70c6386db
2019-07-05 15:04:47 +00:00
Stephen Finucane a4743f982a Remove 'nova-cells' service
We're going to start unpicking this stuff from the top down. Start with
the 'nova-cells' executable itself.

Part of blueprint remove-cells-v1

Change-Id: I5bd1dd9f1bbae7a977ab9e032c4f4d200c35e193
Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
2019-04-09 17:15:37 +01:00
Dan Smith df05872043 Move conductor wait_until_ready() delay before manager init
The Service base class already waits for conductor to be responsive
before allowing service startup to continue. However, it does this
after the manager __init__, which could do some things expecting
conductor to be up (and does now in compute). This moves the check
and wait loop above the manager init so we don't start anything in
the manager until we know conductor is alive.

Change-Id: Ib56fdb38839434d504fadccbeda65ab2e267b514
Closes-Bug: #1789484
2018-08-31 12:50:10 -07:00
Matt Riedemann b53d81b03c Deprecate running API services under eventlet
This sets the timer on removing support for running
API services under eventlet. Nova has supported running
under WSGI since Pike, and does run with Apache by default
in the gate.

Change-Id: I83d6c100d0d2628f38a029cffa22d0c2bc15d667
2018-05-16 03:48:32 +00:00
jichen 6db94dae98 remove ec2 in service and cmd
ec2 was deprecated in commit
f098398a83
back to mitaka release, this patch
starts to remove ec2 services in nova.

Change-Id: I5939ef73904f1bb66ed8453c900bfb50cdb5b8b6
2018-04-12 13:10:23 +08:00
Zuul 2b9c7970fc Merge "Refactor WSGI apps and utils to limit imports" 2018-03-08 15:16:56 +00:00
Chris Dent ef6f4e4c8e Refactor WSGI apps and utils to limit imports
The file nova/api/openstack/__init__.py had imported a lot of
modules, notably nova.utils. This means that any code which
runs within that package, notably the placement service, imports
all those modules, even if it is not going to use them. This
results in scripts/binaries that are heavier than they need
to be and in some cases including modules, like eventlet, that
it would feel safe to not have in the stack.

Unfortunately we cannot sinply rename nova/api/openstack/__init__.py
to another name because it contains FaultWrapper and FaultWrapper
is referred to, by package path, from the paste.ini file and that
file is out there in config land, and something we prefer not to
change. Therefore alternate methods of cleaning up were explored
and this has led to some useful changes:

Fault wrapper is the only consumer of walk_class_hierarchy so
there is no reason for it it to be in nova.utils.

nova.wsgi contains a mismash of WSGI middleware and applications,
which need only a small number of imports, and Server classes
which are more complex and not required by the WSGI wares.

Therefore nova.wsgi was split into nova.wsgi and nova.api.wsgi.
The name choices may not be ideal, but they were chosen to limit
the cascades of changes that are needed across code and tests.

Where utils.utf8 was used it has been replaced with the similar (but not
exactly equivalient) method from oslo_utils.encodeutils.

Change-Id: I297f30aa6eb01fe3b53fd8c9b7853949be31156d
Partial-Bug: #1743120
2018-03-06 22:05:12 +00:00
esberglu b5f38fb40a Add check for redundant import aliases
This adds a pep8 function that will check for redundant import aliases.
Any imports of the forms below will not be allowed.

from x import y as y
import x as x
import x.y as y

Change-Id: Iff90f0172d97bd1d49d54c811a70c8af11776da4
2018-02-26 14:32:22 +00:00
Roman Podoliaka a7505ee648 Make eventlet hub use a monotonic clock
If system time is adjusted first forward and then backward while a
nova service is running (e.g. nova-compute), then there is a high
probability, that periodic tasks will stop for the duration of time
the system clock was adjusted backward.

This was supposed to be fixed by the following patch to oslo.service
https://review.openstack.org/#/c/286838/ , but the order of imports
in unit tests and production code is different, so nova services
end up starting with the default eventlet hub, that does not use a
monotonic clock and, thus, is affected by changes of system time.

Testing this is problematic, as it's a subject of imports order and
is not reproduced in functional or unit tests (oslo_service is always
imported earlier than eventlet hub is initialized, so it just does
"the right thing"). The alternative is to make an assertion when
services start.

Closes-Bug: #1510234

Change-Id: I110cf31ad2a0c74a0cf30ec08bd94d3a56727b39
2017-02-15 16:47:42 +02:00
jichenjc 73b6598d41 Enhance doc for nova services
make some modifications to nova db reference and add some
basic information about some functions such as nova.service.start

Change-Id: I70c1a5eac91ab61ecd4ebc1c8ed95e4e4ba6b9fc
2017-08-31 08:30:48 +08:00
Matt Riedemann 4ae65b386c Fix comment for API binary name in WSGIService
The compute API binary service name is a constant source of
confusion, sometimes called nova-api or nova-os_compute, which are
both wrong, since it's actually nova-osapi_compute. It comes from
nova.cmd.api.

Change-Id: I50befc34730296d3908b6dd25536394608bae0ec
2017-07-05 11:32:22 -04:00
Roman Podoliaka 8854a24c58 service: use restart_method='mutate' for all services
I8f09f9482736b496e3ad7117f170e476e92c2b7d changed the way SIGHUP is
handled by nova-api by telling oslo_service to reload config files
and run 'mutation' hooks for a set of supported options.

Make sure we use the very same mechanism for other service like
nova-compute, that do not use process_launcher() directly, but rely
on launch() helper from oslo_service instead.

Change-Id: Ie4e7c06814310f661d054d2181340418fd0df7bc
2017-05-05 10:54:40 +03:00
Matthew Treinish 2bcee77e3b
Remove nova-cert
This commit removes nova-cert which has been deprecated since change
Id7a1fc943cbe6d860a50d3cc776717b55351004b. The APIs have been hard coded
to return a 410 whenever they're called now. For the API ref a new
section for obsolete apis is added to the bottom of the page and the
certificates api ref is moved there.

Implements bp remove-nova-cert

Change-Id: I2c78a0c6599b92040146cf9f0042cff8fd2509c3
2017-04-27 22:28:01 -04:00
Dina Belova ecc8de8d6c Integrate OSProfiler and Nova
* Add osprofiler wsgi middleware. This middleware is used for 2 things:
  1) It checks that person who want to trace is trusted and knows
     secret HMAC key.
  2) It starts tracing in case of proper trace headers
     and adds the first wsgi trace point with info about the HTTP request

* Add initialization of osprofiler on start of a service
  Currently that includes oslo.messaging notifier instance creation
  to send Ceilometer backend notifications.

oslo-spec: https://review.openstack.org/#/c/103825/
python-novaclient change: https://review.openstack.org/#/c/254699/
based on: https://review.openstack.org/#/c/105096/

Co-Authored-By: Boris Pavlovic <boris@pavlovic.me>
Co-Authored-By: Munoz, Obed N <obed.n.munoz@intel.com>
Co-Authored-By: Roman Podoliaka <rpodolyaka@mirantis.com>
Co-Authored-By: Tovin Seven <vinhnt@vn.fujitsu.com>

Implements: blueprint osprofiler-support-in-nova
Change-Id: I82d2badc8c1fcec27c3fce7c3c20e0f3b76414f1
2017-01-18 15:00:14 +07:00
ChangBo Guo(gcb) d9a7c16c30 conf: Remove config option compute_ manager
compute_manager config options were deprecated in
13.0.0, we can remove it now.

Depends-On: I93b62372e357db4f7c39992c244b2ec9e594ad9c

Implements: bp centralize-config-options-ocata

Change-Id: I84503655bd9675ff441073e51059202142db22ab
2016-12-08 20:05:52 +08:00
ChangBo Guo(gcb) 694fee938d conf: Remove deprecated service manager opts
The following service manager config options were deprecated in
13.0.0 and remove them now:

- metadata_manager
- console_manager
- consoleauth_manager
- cert_manager
- scheduler_manager
- conductor.manager

Implements: bp centralize-config-options-ocata

Co-Authored-By: Stephen Finucane <sfinucan@redhat.com>
Change-Id: Ia50d18c350dbc4ca88da9543e1236e3398ea28ee
2016-12-05 23:28:49 +08:00
Hans Lindgren c36dbe1f72 Remove conductor local api:s and 'use_local' config option
This change removes the deprecated conductor local mode and the
'use_local' flag that was used to control it.

UpgradeImpact

Change-Id: Icc1624606ecb561781a971467443e24b1643f535
2016-10-18 14:26:06 +02:00
Artom Lifshitz e83e114e1b Device tagging API support
This patch allows the user to specify a tag for a virtual network
interface and/or block device mapping when booting an instance.

Implements: blueprint bp/virt-device-role-tagging
Change-Id: I89247200f4cf1f644daf476727b4a6acb22b0cf6
2016-06-29 20:55:16 -07:00
Alexis Lee 48aa5f2baf Enable mutable config in Nova
New releases of oslo.config support a 'mutable' parameter to Opts.
This is only respected when the new method mutate_config_files is
called instead of reload_config_files. Nova delegates making this call
to oslo.service, so how do we switch?
Icec3e664f3fe72614e373b2938e8dee53cf8bc5e allows services to tell
oslo.service they want mutate_config_files to be called by passing a
parameter, which this patch does.

This allows Nova to benefit from
I1e7a69de169cc85f4c09954b2f46ce2da7106d90, where the 'debug' option
(owned by oslo.log) is made mutable. IE when all these patches merge,
we should be able to turn debug logging on and off by changing the
config and sending SIGHUP.

Further patches will make selected Nova options mutable.

Part of bp:mutable-config

Change-Id: I8f09f9482736b496e3ad7117f170e476e92c2b7d
2016-06-07 18:01:27 +00:00
Brian Elliott 854c39e26d Fix service version to update the DB
When new code is installed with a newer service version, the version in
the DB should get updated.

The fix here is to:
1) eliminate the special case for 'version' in save()
2) cause version to be saved on startup

Change-Id: I96fa9dabfb9b7a5f1703baf80534d8b104dab4e6
Closes-Bug: 1579839
2016-05-10 20:43:26 +00:00
Pushkar Umaranikar d619ad6ba1 Config options: Centralize netconf options
The config options of the section
"nova/netconf" got moved to the
new central location
"nova/conf/netconf.py"

Change-Id: I8a17b6f00b15e03de55385fc0206bdc82441304a
Depends-On: I0da2ad7daa942b85c3395dc4861c6e18368ece88
Implements: blueprint centralize-config-options-newton
2016-04-24 18:15:05 +00:00
Markus Zoeller e42ff5e5ca Add "__repr__" method to class "Service"
The class "Service" doesn't have a "__repr__" method which results
in log outputs like:

    DEBUG [...] service = <nova.service.Service object at 0x56eb890>

This is not helpful when analyzing logs. Therefore this change adds a
"__repr__" method.

Change-Id: I49c8b7f0dde298de780808c988e4b50278eed665
2016-04-08 15:19:59 +02:00
Tracy Jones 185e00ee74 config options: centralize section "service"
Move options from 'service' to 'conf/service.py'.

Change-Id: I621481590d93b806ea17d498a562da87207001f3
Co-Authored-By: Stephen Finucane <stephen.finucane@intel.com>
Implements: blueprint centralize-config-options-newton
2016-04-04 16:39:02 +00:00
Takashi NATSUME 897cb7c2d3 Fix string interpolations at logging calls
Skip creating the formatted log message
if the message is not going to be emitted
because of the log level.

TrivialFix
Change-Id: Iba9f47163a0ac3aca612818272db6d536b238975
2016-03-07 12:05:58 +09:00
Sean Dague 0fcec69a23 deprecate manager class options
We should deprecate the manager classes used for all of our
services. This is not a thing we actually expect or want to support
people replacing. If we want modular plug points at any of these all
the options should be in tree and specified by constants to switch
between.

Change-Id: Id25bd4870c6e2fda08dc0177b7ed61a8a6091838
2016-03-04 06:35:44 -05:00
Roman Dobosz 487a6259f9 Add annotation to the kill() method
Description about the kill() method with clearing up its purpose was added.

Closes-Bug: #1546433

Change-Id: I8458242d22c0735faf7c95545bca6de9a03081ce
2016-02-18 09:23:41 +01:00
Davanum Srinivas 4140eb4004 Remove Deprecated EC2 and ObjectStore impl/tests
In Id7936be290b6febd18deb4c2db8ea4d678d4d9b1, we removed
entries from api-paste.ini for EC2 API service. In this
review we remove all the unnecessary code, docs and tests
associated with objectstore and ec2 service. Note that this
does not cleanup the Instance object or change any of the
versioned objects. We just drop any code associated with
testing the REST endpoint(s) that are no longer needed.
Also added shims such that the api-paste.ini from liberty
will still work (grenade job) and added logs and response
messages for prompting administrators to cleanup their
old api-paste.ini and switching to the stand alone EC2 API
project for their needs.

Change-Id: I8bf7cbaa7015bb61656ab90ccc8f944aaeebb095
2016-01-08 06:30:20 -05:00
Davanum Srinivas eec7a55319 Nuke EC2 API from api-paste and remove wsgi support
Tempest has already removed the EC2 API tests in:
Ib5e24e19bcba9808a9f49fe7f328668df77fe4f9

We have a review in devstack below that removes EC2
API service by default.

In this review, we are removing support for the really
old EC2 API support in Nova. Anyone who needs EC2 support
should use the new EC2-API project:
http://git.openstack.org/cgit/openstack/ec2-api/

The necessary changes in Tempest and DevStack are
already merged.  In a follow on review, will remove
the EC2 specific options, code and tests from Nova.

DocImpact

Change-Id: Id7936be290b6febd18deb4c2db8ea4d678d4d9b1
2015-12-21 18:48:15 -05:00
Dan Smith c4ca1abb4a Reset the compute_rpcapi in Compute manager on SIGHUP
This links Service.reset() to the manager, which for compute will
rebuild the compute_rpcapi and thus re-determine the appropriate
RPC versions.

Change-Id: Ifec7f6ff604d1e5f3663633065e9a55baacffec8
2015-12-04 13:13:23 -08:00
Dan Smith 86e9f88ace Add _LE to LOG.error statement in nova/service
This was feedback from the previous patch.

Change-Id: I16a2caaed162af6d460966dacedf947a116a354a
2015-11-13 09:09:33 -08:00
Dan Smith 6bc1da04c7 Add service records for nova-api services
This adds service records for the API services for the purpose of
version-tracking. Unlike other services, these records are not periodically
updated, so this adds no additional runtime database burden. The API
services update the version (if necessary) of their record at startup.

This also adds filtering in three places to prevent us from exposing
API service records out of the hosts and availability-zone APIs.

Related to blueprint service-version-behavior
Change-Id: I66becb14788de42bee35064d1155dd919059bcb7
2015-11-13 09:09:30 -08:00
Eric Brown ec59ea8db7 Use min and max on IntOpt option types
The latest oslo.config supports a minimum and maximum value for
IntOpt options.  This patch utilizes this for a number of options
with well known ranges.

Change-Id: I897d8870fdf67a095915c8fcdf239024b092e9e3
2015-08-14 04:37:21 +00:00
Davanum Srinivas 79b280479c Switch to oslo.service library
Modules eventlet_backdoor, loopingcall, periodic_task,
service, sslutils, systemd, threadgroup were removed
from nova. These modules were imported from oslo.service
library.

Co-Authored-By: Marian Horban <mhorban@mirantis.com>
Depends-On: I305cf53bad6213c151395e93d656b53a8a28e1db
Change-Id: Iaef67e16af3d69f845742f7bdcb43667bf1576ee
2015-07-11 02:54:42 +00:00
heha 2ef8761189 Fix the little spelling mistake of the comment.
In the comment of class Service,the last "it" should be "its".

Closes-Bug: #1462266

Change-Id: I9ea09e3610d6d8e14af7c5b21cf9b1ec2368af76
2015-07-08 04:11:28 +00:00