summaryrefslogtreecommitdiff
path: root/nova/service.py
Commit message (Collapse)AuthorAgeFilesLines
* Pass service ref to init_host(), if existsDan Smith2023-01-201-2/+2
| | | | | | | | | | | 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
* Add service version check workaround for FFUDan Smith2022-01-241-1/+7
| | | | | | | | | | | | | | | | | | | | | 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
* Restore retrying the RPC connection to conductorBalazs Gibizer2020-11-131-2/+8
| | | | | | | | | | | | | | | 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
* Prevent starting services with older than N-1 computesBalazs Gibizer2020-11-041-0/+2
| | | | | | | | | 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
* Merge "Remove monotonic usage"Zuul2020-08-171-13/+0
|\
| * Remove monotonic usageSean McGinnis2020-05-041-13/+0
| | | | | | | | | | | | | | | | | | | | 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>
* | trivial: Remove remaining '_LI' instancesStephen Finucane2020-05-181-5/+5
| | | | | | | | | | | | | | | | 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>
* | trivial: Remove remaining '_LW' instancesStephen Finucane2020-05-181-2/+2
| | | | | | | | | | | | | | 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>
* | trivial: Remove remaining '_LE' instancesStephen Finucane2020-05-181-3/+3
|/ | | | | | | | 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>
* Reset the cell cache for database access in Servicemelanie witt2020-04-081-1/+36
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* nova-net: Remove 'MetadataManager'Stephen Finucane2020-01-081-1/+0
| | | | | | | | | 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>
* Remove 'nova-console' service, 'console' RPC APIStephen Finucane2019-11-221-1/+0
| | | | | | | | | | | | | | | | | | | | 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>
* Remove nova-consoleauthStephen Finucane2019-07-051-1/+0
| | | | | | | | | | | | 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
* Remove 'nova-cells' serviceStephen Finucane2019-04-091-1/+0
| | | | | | | | | | 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>
* Move conductor wait_until_ready() delay before manager initDan Smith2018-08-311-3/+3
| | | | | | | | | | | | 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
* Deprecate running API services under eventletMatt Riedemann2018-05-161-0/+4
| | | | | | | | | 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
* remove ec2 in service and cmdjichen2018-04-121-1/+1
| | | | | | | | | ec2 was deprecated in commit f098398a836e3671c49bb884b4a1a1988053f4b2 back to mitaka release, this patch starts to remove ec2 services in nova. Change-Id: I5939ef73904f1bb66ed8453c900bfb50cdb5b8b6
* Merge "Refactor WSGI apps and utils to limit imports"Zuul2018-03-081-1/+2
|\
| * Refactor WSGI apps and utils to limit importsChris Dent2018-03-061-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* | Add check for redundant import aliasesesberglu2018-02-261-1/+1
|/ | | | | | | | | | | 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
* Make eventlet hub use a monotonic clockRoman Podoliaka2017-02-151-0/+13
| | | | | | | | | | | | | | | | | | | | | | | 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
* Enhance doc for nova servicesjichenjc2017-08-311-0/+7
| | | | | | | make some modifications to nova db reference and add some basic information about some functions such as nova.service.start Change-Id: I70c1a5eac91ab61ecd4ebc1c8ed95e4e4ba6b9fc
* Fix comment for API binary name in WSGIServiceMatt Riedemann2017-07-051-1/+1
| | | | | | | | | 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
* service: use restart_method='mutate' for all servicesRoman Podoliaka2017-05-051-1/+2
| | | | | | | | | | | | 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
* Remove nova-certMatthew Treinish2017-04-271-1/+0
| | | | | | | | | | | | 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
* Integrate OSProfiler and NovaDina Belova2017-01-181-0/+17
| | | | | | | | | | | | | | | | | | | | | | | | * 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
* conf: Remove config option compute_ managerChangBo Guo(gcb)2016-12-081-4/+1
| | | | | | | | | | | 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
* conf: Remove deprecated service manager optsChangBo Guo(gcb)2016-12-051-10/+18
| | | | | | | | | | | | | | | | | 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
* Remove conductor local api:s and 'use_local' config optionHans Lindgren2016-10-181-8/+6
| | | | | | | | | This change removes the deprecated conductor local mode and the 'use_local' flag that was used to control it. UpgradeImpact Change-Id: Icc1624606ecb561781a971467443e24b1643f535
* Device tagging API supportArtom Lifshitz2016-06-291-1/+2
| | | | | | | | 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
* Enable mutable config in NovaAlexis Lee2016-06-071-1/+1
| | | | | | | | | | | | | | | | | | | | | | 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
* Fix service version to update the DBBrian Elliott2016-05-101-15/+10
| | | | | | | | | | | | 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
* Config options: Centralize netconf optionsPushkar Umaranikar2016-04-241-1/+0
| | | | | | | | | | | 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
* Add "__repr__" method to class "Service"Markus Zoeller2016-04-081-0/+9
| | | | | | | | | | | | 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
* config options: centralize section "service"Tracy Jones2016-04-041-82/+2
| | | | | | | | 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
* Fix string interpolations at logging callsTakashi NATSUME2016-03-071-6/+8
| | | | | | | | | Skip creating the formatted log message if the message is not going to be emitted because of the log level. TrivialFix Change-Id: Iba9f47163a0ac3aca612818272db6d536b238975
* deprecate manager class optionsSean Dague2016-03-041-6/+19
| | | | | | | | | | 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
* Add annotation to the kill() methodRoman Dobosz2016-02-181-1/+7
| | | | | | | | Description about the kill() method with clearing up its purpose was added. Closes-Bug: #1546433 Change-Id: I8458242d22c0735faf7c95545bca6de9a03081ce
* Remove Deprecated EC2 and ObjectStore impl/testsDavanum Srinivas2016-01-081-11/+0
| | | | | | | | | | | | | | | | | 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
* Nuke EC2 API from api-paste and remove wsgi supportDavanum Srinivas2015-12-211-1/+1
| | | | | | | | | | | | | | | | | | | | | 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
* Reset the compute_rpcapi in Compute manager on SIGHUPDan Smith2015-12-041-0/+3
| | | | | | | | 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
* Add _LE to LOG.error statement in nova/serviceDan Smith2015-11-131-3/+4
| | | | | | This was feedback from the previous patch. Change-Id: I16a2caaed162af6d460966dacedf947a116a354a
* Add service records for nova-api servicesDan Smith2015-11-131-10/+48
| | | | | | | | | | | | | 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
* Use min and max on IntOpt option typesEric Brown2015-08-141-0/+6
| | | | | | | | 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
* Switch to oslo.service libraryDavanum Srinivas2015-07-111-4/+4
| | | | | | | | | | 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
* Fix the little spelling mistake of the comment.heha2015-07-081-1/+1
| | | | | | | In the comment of class Service,the last "it" should be "its". Closes-Bug: #1462266 Change-Id: I9ea09e3610d6d8e14af7c5b21cf9b1ec2368af76
* Convert service and servicegroup to objectsHans Lindgren2015-04-131-27/+14
| | | | | | | | | | | This converts service and servicegroup to use objects instead of proxying through conductor. Adds missing object registration to cert and console scripts. Related to blueprint liberty-objects Change-Id: I87b077699c2ecbc25a83e5844e8c69fe147cec01
* Remove usage of db.service_get_by_argsNikola Dipanov2015-03-061-4/+6
| | | | | | | | | | | | | | | | | | | | | | | | After the change: https://review.openstack.org/#/c/155832 It has become apparent that get_service_by_args method of the DB api does basically the same thing as the newly introduced service_get_by_host_and_binary, with several subtle differences. (whether deleted records are returned, whether disabled services are considered etc.) Leaving this as is is likely to lead to confusion, and introduction of subtle bugs. The proposed solution is to keep only one. Seeing that the subtleties of how get_service_by_args works, and the fact that it is really poorly named, it is deemed better to remove it. This patch makes all the places that used it now use get_service_by_host_and_binary instead. Change-Id: I243236c8feacec5e6edbbbf4cee2ec4e40405bf1
* Use oslo.logDavanum Srinivas2015-02-221-1/+1
| | | | | | | | | | Convert the use of the incubated version of the log module to the new oslo.log library. Sync oslo-incubator modules to update their imports as well. Co-Authored-By: Doug Hellmann <doug@doughellmann.com> Change-Id: Ic4932e3f58191869c30bd07a010a6e9fdcb2a12c
* switch LOG.audit to LOG.infoDavanum Srinivas2015-02-221-2/+2
| | | | | | | | | | | | | | oslo.log does not have AUDIT level. This was a conscious decision documented in blueprint: https://blueprints.launchpad.net/oslo.log/+spec/remove-context-adapter which was implemented in: I10240f8af6c42508124659b3ed62c5ab93552953 So to prep for switching to oslo.log, this changeset removes usage of LOG.audit and replaces it with LOG.info Change-Id: I9cb1293529b2079b8a4778e27d60c6c760dfb622