summaryrefslogtreecommitdiff
path: root/ironic/common/service.py
Commit message (Collapse)AuthorAgeFilesLines
* Add "none" RPC transport that disables the RPC busDmitry Tantsur2021-12-071-0/+8
| | | | | | | | | | When using the new combined executable in a single-conductor scenario, it may make sense to completely disable the remote RPC. The new ``rpc_transport`` value ``none`` achieves that. Change-Id: I6a83358c65b3ed213c8a991d42660ca51fc3a8ec Story: #2009676 Task: #44104
* Refactor common configuration bits from service commandsDmitry Tantsur2021-12-011-1/+33
| | | | | | | | The prepare_service call from ironic.common.service is changed to also configure guru meditation and profiler. A new call prepare_command is provided for the cases it's not required. Change-Id: I5b9b7b7bc827c8bcda06e9a967deae8577ad87f4
* reloads mutable config values on SIGHUPRuby Loo2018-02-281-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | This changes the ironic (ironic-api and ironic-conductor) services so that when a SIGHUP signal is issued, the service reloads (and uses) the values of mutable configuration options. The mutable configuration options (set by oslo.config Opts' mutable=True) are: - [DEFAULT]/pin_release_version - [DEFAULT]/debug - [DEFAULT]/log_config_append and are indicated as such in ironic's sample config (https://docs.openstack.org/ironic/latest/configuration/sample-config.html) by "# Note: This option can be changed without restarting.". Configuration options are mutable if their oslo.config Opt's mutable=True is set. This mutable setting is respected when the oslo method mutate_config_files is called instead of reload_config_files. Icec3e664f3fe72614e373b2938e8dee53cf8bc5e allows services to tell oslo.service they want mutate_config_files to be called by specifying the 'restart_method=mutate' parameter, which this patch does. Change-Id: I0df46bb21dda035b25daad17737dbfedb861e868 Closes-Bug: #1585595
* Make config generator aware of 'default_log_levels' overrideVladyslav Drok2017-04-131-17/+2
| | | | | | | | | | | The way it is done in this patch is recommended by the oslo.config documentation in [0], so that the updated default_log_levels value is correctly reflected in the generated ironic.conf.sample file. An oslo.config.opts.defaults entry point is added. [0] https://docs.openstack.org/developer/oslo.config/generator.html Change-Id: Ic200e8d0d721a6c94bd17068a6e5000db930eefd
* Revert the move of the logger setupVladyslav Drok2017-03-221-0/+23
| | | | | | | | | | As part of the commit 7fd26bf8031041a0e6df261c71101e29e8bf9610, logging was moved to ironic.conf.__init__.py. This seems to be the reason of the config options not being logged anymore. Closes-Bug: #1674707 Change-Id: I566c9383a3979ad8f6373fb5ef918d0e06e3a53f
* Fix usage of various deprecated methodsVladyslav Drok2017-03-171-19/+0
| | | | | | | | | | | | | | | Our unittest output complains about some of the codebase, described in more detail in the referred bug. This change fixes all of those places. static_root is now set only if debug=True is set in pecan configuration. Logging is now setup as part of the conf module import, so that unittests can use it. Closes-Bug: #1668240 Change-Id: I2536bd2b174e0d224ddf6806f1be37bd29017669
* Remove unused logging importAnh Tran2017-02-171-2/+0
| | | | Change-Id: I7f55eececc6079e0473a6f3bceedf1350b36d229
* Separate WSGIService from RPCServiceRuby Loo2016-09-151-127/+0
| | | | | | | | | | | | | | | | | | | | | | This patch fixes a problem which prevented Ironic from honoring the interval values configuration for the periodic tasks. Since the interval values are passed to a decorator, the configuration options should be evaluated prior to importing the module which contains the periodic tasks. In our case this was not happening due to the chain of imports going from ironic.cmd.conductor -> ironic.common.service -> ironic.api.app -> ... -> ironic.conductor.manager. This caused the @periodic decorators to be evaluated before the configuration options were loaded. This patch breaks that chain of imports by separating the WSGIService and RPCService classes into two separate files. The conductor uses the RPCService, and since it is now in a separate file from WSGIService, it no longer pulls in ironic.api.app, ..., and ironic.conductor.manager. (ironic.api.app was being imported because WSGIService needed it.) Change-Id: Ie318e7bb2d2c2d971a796ab8960be33fccbd88f3 Closes-Bug: #1562258 Co-Authored-By: Lucas Alvares Gomes <lucasagomes@gmail.com>
* Merge imports in codeNguyen Hung Phuong2016-08-241-3/+1
| | | | | | | | This patch merges all lines importing i18n into 1 line: http://docs.openstack.org/developer/hacking/#imports Change-Id: I828542a62cc577065f3bef9223d25cfe7a939785
* Migrate to using keystoneauth SessionsPavlo Shchelokovskyy2016-08-031-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We currently construct Keystone client objects directly, which is no longer the preferred way. Instead, we should be using Sessions which allows use of different auth plugins. This change attempts to migrate our Keystone usage to this model. Additionally, we currently rely on the imported keystonemiddleware auth_token's configuration for all of the Keystone credentials used by the Ironic service user. This is bad, as that config is internal to that library and may change at any time. Also, the service user may be using different credentials than the token validator. This refactors the keystone module to use Sessions. It attempts to provide some backward compat for users who have not yet updated their config, by falling back to the authtoken config section when required. Operators impact: - Authentification parameters for each service now should specified in the corresponding config section for this service ([glance], [neutron] [swift], [inspector]). This includes providing both Keystone session-related options (timeout, SSL-related ones) and authentification options (`auth_type`, `auth_url` and proper options for the auth plugin). - New config section `service_catalog` for Ironic service user credentials, used to resolve Ironic API URL from Keystone catalog. - If loading from the service config section fails, an attempt is made to use respective options from [keystone_authtoken] section as a fall-back for backward compatibility. Implementation details: - using keystoneauth1 library instead of keystoneclient - For each service the keystone session is created only once and is reused further. This lowers the number of authentification requests made to Keystone but implies that only auth plugins that can re-authentificate themselves can be used (so no *Token plugins). This patch does not update the DevStack plugin, in order to test backwards compatibility with old config options. DevStack plugin will be modified in a subsequent patch. Change-Id: I166eebefc1e1335a1a7b632149cf6441512e9d5e Closes-Bug: #1422632 Related-Bug: #1418341 Related-Bug: #1494776 Co-Authored-By: Adam Gandelman <adamg@ubuntu.com>
* Centralize config options - [DEFAULT]Ramamani Yeleswarapu2016-07-151-17/+1
| | | | | | | Nova style refactor of config options in Ironic. Change-Id: I6baebf1bbc829238441ddd1399f6487fad33a15e Partial-Bug: #1561100
* Removes the use of mutables as default argsGary Kotton2016-06-191-1/+2
| | | | | | | | | | Passing mutable objects as default args is a known Python pitfall. We'd better avoid this. This commit changes mutable default args with None, 'arg = [] if arg is None else arg'. TrivialFix Change-Id: I2909b111266c696bcdcd26db167d3ad5e0603e45
* Make use of oslo-config-generatorLin Tan2016-05-251-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | oslo_config provide a utility for generating sample config files, which provide more detail about opts, like Minimum/Maximum value and Allowed values. So drop Ironic's "generate_sample.sh" which was copied from oslo-incubator long time ago. Add a new entry point "ironic" under oslo.config.opts namespace to explore config options to oslo-config-generator. After this patch, new config options of Ironic code should register with ironic/conf/opts.py. New external libraries should register with tools/config/ironic-config-generator.conf There is a bug #1554657 with oslo-config about deprecated_group. This bug have impact of some configs from keystonemiddleware and oslo.messaging in ironic.conf.sample So currently, deprecated option should always add the deprecated_group even it didn't alter the group, otherwise the deprecated group value will be 'DEFAULT'. Update etc/ironic/ironic.conf.sample via running 'tox -egenconfig'. Closes-Bug: #1564195 Change-Id: If7721e98e69b6f54f1ee04a07477396b86583371
* Remove "periodic_interval" config optionJim Rollenhagen2016-05-171-5/+0
| | | | | | This was deprecated February 24, 2016. It's time to remove it. Change-Id: If82a6a2c94b22ddcd8707bc8bd7f73ecaa24e021
* Merge "Use get_admin_context() to create the context object"Jenkins2016-04-141-1/+1
|\
| * Use get_admin_context() to create the context objectNisha Agarwal2016-04-051-1/+1
| | | | | | | | | | | | | | | | | | | | The current code uses RequestContext() call directly to create a context object. Now this is changed to use get_admin_context() to create the object. Closes-bug: #1516812 Co-Authored-By: Vladyslav Drok <vdrok@mirantis.com> Change-Id: I1235fe5feac4a9aa224599ca70def1434a3b9bcb
* | Merge "Adopt Ironic's own context"Jenkins2016-04-141-1/+1
|\ \ | |/
| * Adopt Ironic's own contextLin Tan2016-04-011-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | Adopt Ironic's own context in Ironic and add tests. Refactor ensure_thread_contain_context to Ironic's own context class, this will be more generical and not bind to TaskManager anymore. Explicitly call ensure_thread_contain_context() in Inspector driver for inspect hardware action. Change-Id: Ic2bb16a2deb02054b4fca795d431c965e30a246f Closes-Bug: #1560264
* | Reduce amount of unhelpful debug logging in the API serviceDmitry Tantsur2016-04-071-3/+4
|/ | | | | | | | | | * Ignore DEBUG logging from keystone{auth,middleware} * Log eventlet.wsgi events with a proper (default) logger name, so that DEBUG messages are also ignored * Enable INFO logging for eventlet.wsgi.server, so that we still see summary of every request Change-Id: I954a2b37bcedefb2c2b653b8ba26a030ffd7c5b7
* Follow up nits of 3429e3824c060071e59a117c19c95659c78e4c8bZhenguo Niu2016-03-011-1/+2
| | | | | | | Explicitly point out the 'periodic_interval' option is in seconds, which will be more clear. Change-Id: I890752606721071016328bc4b036ada9afd9eac5
* Switch to Futurist library for asynchronous execution and periodic tasksDmitry Tantsur2016-02-241-6/+3
| | | | | | | | | | | | | | | | | | | | | This change switches the conductor to using Futurist library executor and periodic tasks worker instead of oslo.service periodic tasks. This allows running periodic tasks in parallel and relying on more standard interfaces (futures, executors) when dealing with asynchronous execution. A green thread executor is used instead of using an eventlet green pool directly. The maximum number of workers is taken from the existing workers_pool_size configuration option, and no tasks are allowed to be enqueued to mimic the previous behaviour (might be lifted later). The periodic tasks worker is using the same executor, and its main loop thread is also running on it. For this reason minimum value for workers_pool_size is now 3: periodic task main loop, keep alive thread and at least one thread for other tasks. A special decorator for driver-periodic tasks is now deprecated, as the generic decorator can be used there as well. Closes-Bug: #1526277 Change-Id: I57bf7cebfb6db805b6c521bacfef2993b16ce1ee
* API service logs access requests againDevananda van der Veen2016-01-221-1/+2
| | | | | | | | | | | | | | | The API service used to log access requests, as is customary for API services. However, commit c4bd20ebd4b42201bf40e00d4f0a1b2c69d2e931 unintentionally changed this behavior when changing over to use oslo_service. This commit causes ironic-api to resume logging access requests, now with all the additional information that oslo_service provides, by changing the logger_name to the service name (instead of the default, which was being filtered out). Change-Id: I5855d4d2bd9eb70bf5f77fb2dc8c712f74304a07 Closes-bug: #1536828
* Refactor objects into a magic registryJim Rollenhagen2016-01-041-0/+2
| | | | | | | | | | | | | | This adds a register hook to the objects base class that allows us to late-import objects classes into ironic.objects. This is useful to allow object classes to depend on other objects. For example, this will allow us to do the Port.node_uuid munging that we currently do in the API layer, in the objects layer instead. This is completely taken from Nova, much thanks to comstud and dansmith and whoever else worked on that. Change-Id: Ic655e7af533497bda5e8e72d3bd90c27394681a7
* Use imageutils from oslo.utilsChangBo Guo(gcb)2015-12-161-1/+0
| | | | | | | | | We clean up oslo-incubator in 90ae25e38915cc502d9e9c52d59e8fb668a72ae1, and sync imageutils to oslo.utis with unittest in version 3.1. openstack/common/imageutils.py exists without unittest. Let's switch to use oslo.utils' imageutils. Change-Id: I0adf2c23b1e5a5ab6274a6aa53ed46720e3aa05e
* Remove extra space in 'host' config commentLin Tan2015-12-101-1/+1
| | | | Change-Id: I9e3ba346950baf0c1d9c7a4a8d5a29b43bc4b038
* Numerous debug messages due to iso8601 log levelBertrand Lallau2015-12-081-0/+1
| | | | | | | | | iso8601 is indirectly used by keystone client and removing the log level iso8601=WARNING results in numerous debug messages. This patch reverts iso8601=WARNING log level removal introduced in 37816a0e63ed48ed3763e8c312fbb42c14b92167 commit. Change-Id: I9367cc0f39e6f08b0cf437c02100c74c9bc126d2
* Move iso8601 as a test dependency onlyBertrand Lallau2015-11-261-1/+0
| | | | | | | | | Ironic does not import and use this module directly, no need to list it in the requirements and no need to set log level. Instead it was moved to test-requirements.txt file because it is explicitly imported for unit tests. Change-Id: I791be24289f620a4227ec6514d77c37a5f8d920e
* Add SSL support to the Ironic APIAnton Arefiev2015-11-181-2/+4
| | | | | | | | | | | | | | | Add posibility to configure the API to service requests via HTTPS instead of HTTP using native ssl from oslo.service wsgi. New options was added: * enable_ssl_api - turn on ssl support; Options defined in oslo.service for configure certs: * ca_file - ca certificate file to use to verify connecting clients; * cert_file - certificate file to use when starting the server securely; * key_file - private key file to use when starting the server securely; Closes-bug: #1430213 Change-Id: Id4b84d83f9aa6c7f898b3b9b59158d5b1a00e159
* Use wsgi from oslo.service for Ironic APIAnton Arefiev2015-11-171-5/+65
| | | | | | | | | oslo.service provides a wsgi functionality for defining new long-running services using by OpenStack applications. It might usefull for working with SSL for example. Ironic has started migrate to oslo.service, this change continue this work, and consumes wsgi from it. Change-Id: Ic7865709cd87c45e6b7d49f15ce73354aa15401e Closes-Bug: #1484044
* Fix oslo namespace in default log levelAnton Arefiev2015-11-131-12/+12
| | | | | | | | | | | Default log level setup is broken for oslo.messaging since old oslo namespace is used, oslo_messaging namespace should be used instead. Also replace deprecated WARN log level with new WARNING for default log level set. Change-Id: Idd6ace4176fe6fd1148f1b4fcc1fa29dc966b61e Closes-Bug: #1515908
* Enable translation for config option help messagesstephane2015-07-061-6/+7
| | | | | | | | Several OpenStack projects wrap help messages for translation. Follow suit by wrapping the help messages. Change-Id: I38572dfa40b3cb10b1c58d9b555985c58afd70aa Closes-Bug: #1413830
* Switch to oslo.serviceSergey Vilgelm2015-06-291-1/+1
| | | | | | | oslo.service has graduated, so ironic should consume it. Change-Id: Iaa1ca0d97b92b9a6858b2c2d50eb514cc2118762 Closes-Bug: #1466851
* Enforce flake8 E123/6/7/8 in ironicSam Betts2015-06-041-3/+3
| | | | | | | | | | | | | | | | | This patch enforces the rules E123, E126, E127, and E128 in the ironic code base: E123 - closing bracket does not match indentation of opening bracket’s line E126 - continuation line over-indented for hanging indent E127 - continuation line over-indented for visual indent E128 - continuation line under-indented for visual indent This fixes any parts of the current code which fails these rules and removes these rules from the tox.ini flake8 ignore list. Change-Id: Ia96582b5e9abc088d6c1694afc93c59be4a4065c Closes-Bug: 1421522
* Prepare for hacking 0.10.xAndreas Jaeger2015-05-211-2/+0
| | | | | | | | | | Fix new warning that are introduced with hacking 0.10.x. The failure messages fixed are: H238 old style class declaration, use new style (inherit from `object`) H105 Don't use author tags H501 Do not use self.__dict__ for string formatting Change-Id: Ia070d60754dfd85966178eadbf82a4d98b64407a
* Drop use of 'oslo' namespace packageDoug Hellmann2015-05-061-1/+1
| | | | | | | | | | | | | | | | | | | | | The Oslo libraries have moved all of their code out of the 'oslo' namespace package into per-library packages. The namespace package was retained during kilo for backwards compatibility, but will be removed by the liberty-2 milestone. This change removes the use of the namespace package, replacing it with the new package names. The patches in the libraries will be put on hold until application patches have landed, or L2, whichever comes first. At that point, new versions of the libraries without namespace packages will be released as a major version update. Please merge this patch, or an equivalent, before L2 to avoid problems with those library releases. Blueprint: remove-namespace-packages https://blueprints.launchpad.net/oslo-incubator/+spec/remove-namespace-packages Change-Id: I695d2141c00a5ee36e042efbb9bac4e2803c1948
* Use oslo_log libGhe Rivero2015-05-051-5/+5
| | | | | | Module 'log' from oslo-incubator was removed after release of oslo_log library. Change-Id: I4261083dae076cea66c42ad16eb82a5faaeb1a65
* Suppress urllib3.connection INFO level loggingDevananda van der Veen2015-03-181-0/+1
| | | | | | | | The urllib3.connection library is generating INFO level log messages for every HTTP connection made to other openstack services. This is not helpful, so let's suppress them. Change-Id: I00ba5fadf459a2e3b112f440ea0616c64758a8ad
* Use oslo_context packageGhe Rivero2015-03-121-1/+1
| | | | | | | Use graduated library oslo_context and remove any reference to the context module from oslo.incubator Change-Id: I590f033c4b164cea9022cd951ded393b7406381e
* Merge "Use oslo_utils replace oslo.utils"Jenkins2015-02-191-1/+1
|\
| * Use oslo_utils replace oslo.utilsjiangfei2015-02-191-1/+1
| | | | | | | | | | | | | | | | | | oslo.utils 1.2.0 has changed its namespace from oslo.utils to oslo_utils. Co-Authored-By: Victor Sergeyev <vsergeyev@mirantis.com> Change-Id: I07ce4791cfe3b32efb02be60f792bd1c4f03d82f
* | Avoid deregistering conductor following SIGUSR1Mark Goddard2015-02-191-1/+18
|/ | | | | | | | | | | | | | Allow the conductor to avoid deregistering itself on shutdown, after receiving a SIGUSR1 signal. The registration will time out after a period defined by the conductor.heartbeat_timeout configuration setting (defaults to 60 seconds). If the conductor is restarted within this period, the unnecessary thrash caused by two ring rebalances will be avoided. This is useful in situations where the downtime is negligible, such as an upgrade. DocImpact Closes-bug: #1418474 Change-Id: Ie40a7f878c2845dc9cb8fc8082df5d88adb28d0b
* Merge "Conductor errors if enabled_drivers are not found"Jenkins2015-02-071-5/+7
|\
| * Conductor errors if enabled_drivers are not foundDevananda van der Veen2015-02-041-5/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The conductor service should fail during startup if a configured driver, eg. one that is specified in "enabled_drivers", is not found. At the moment, it merely ignores missing drivers. In addition to adding a check that all configured drivers are loaded, this patch re-arranges some of the initialization of ConductorManager such that an exception during init_host() does not result in secondary exceptions being logged and obfuscating the cause, namely, that no drivers were loaded. Closes-bug: #1417954 Change-Id: I6a96f4b49891c92859479656fe36d2bbd38fe602
* | Merge "Move oslo.config references to oslo_config"Jenkins2015-02-051-1/+1
|\ \ | |/ |/|
| * Move oslo.config references to oslo_configJim Rollenhagen2015-02-021-1/+1
| | | | | | | | | | | | | | The oslo team is recommending changing to non-namespaced references. Implements: blueprint drop-namespace-packages Change-Id: I45462d9d49552044ad990f22bd6e6c5b37cf0649
* | Add support for driver-specific periodic tasksDmitry Tantsur2015-02-031-1/+1
|/ | | | | | | | | | | | Syncs openstack.common.periodic_task to commit 0848516902444ca83dd4998655cae3901d038d (https://review.openstack.org/#/c/148854/). This patch also makes service start running periodic tasks after init_host() is called. Change-Id: I63ee4ce30b3684e53158fe5f985efd04e4e88fef Implements: blueprint driver-periodic-tasks
* Fix RPCService and Ironic Conductor so they shut down gracefullyClif Houck2015-01-191-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Ironic Conductor Manager now waits on its greenpool workers to finish before del_host completes. This will ensure more-correct behavior, as well as giving workers the opportunity to release locks before the RPCService stops. Added a manager test to confirm del_host waits on the manager's greenpool. This modifies RPCService in two important ways: 1) The order of shutdown operations in RPCService.stop is changed to be more correct. First, the server is stopped to prevent new requests from arriving. Second, the manager is instructed to inform the cluster that this conductor is shutting down. Finally, the conductor service stop() method is called with graceful set to True to allow any tasks the service currently has running to finish normally. This is in contrast to the previous order of operations where the service was told to immediately stop before stopping the server. This could allow requests to arrive while the service has already stopped, which is not ideal. Additionally, Service.stop was called in a way which caused existing/running service tasks to immediately exit, which could result in bad node or database state, necessitating manual operator intervention. 2) The underlying Service object is told to shutdown gracefully, which will allow tasks to complete before RPCService completely shuts down. Change-Id: I639f2fa7b9349822fca9180966e0932224fa70a2 Closes-Bug: #1382698
* Hide oslo.messaging DEBUG logs by defaultDevananda van der Veen2015-01-061-0/+1
| | | | | | | | | | | This change moves the default log level for oslo.messaging from DEBUG to INFO. This hides the once-per-second debug log lines which started in oslo.messaging 1.5.0. Change-Id: Ia310a5430dcb0a38f8653bbdf5caac82b6990414 Closes-bug: #1399257
* Translator functions cleanup part 1Vladyslav Drok2014-09-051-6/+6
| | | | | | | | | | | | | | | | | This part fixes ironic/common folder and tox.ini file. Some modules use _ function for log translation, even when the translated string is passed to e.g. LOG.warn function. This patch fixes it, using translator functions appropriate for corresponding log levels. Translator functions, imported from ironic.openstack.common.gettextutils are now imported from ironic.common.i18n. Translator functions are imported the same way across all modules. All places that are changed conform to http://docs.openstack.org/developer/oslo.i18n/guidelines.html Partial-bug: #1364813 Change-Id: I195d0e256c5412d6d75d2e6c35b19b44f2a0b09f
* Remove gettextutils _ injectionVladyslav Drok2014-08-291-0/+1
| | | | | | | | | | Now that ironic supports oslo.i18n, using the install function to inject _ into the builtin has been deprecated. New i18n common module used instead. In one module _ was imported from gettextutils, now also changed to i18n import. Closes-bug: #1346406 Change-Id: I672a975d479991982c24031e834a26e2c2811890