Commit Graph

28 Commits

Author SHA1 Message Date
Erik Olof Gunnar Andersson b336bb34dc Re-factored rpc serializer
This patch cleans up the current rpc
implementation by moving the seralizer
back to the rpc module, this is more in
line with other projects; such as Nova.

- Moved _init_serializer back into rpc.
- Added back unit-tests for profiler.

Change-Id: Ia148b2d3bc352e96e7633f7af82ecd26b5f35e35
2021-03-09 00:13:45 +00:00
Erik Olof Gunnar Andersson 672b119507 Re-use transport for rpc server
This patch changes the rpc server to re-use
the transport in the same manner as the rpc client.

Story: 2008494
Task: 41752

Change-Id: I93eecacbe45d19c4f73e9a974d60e642e87bbdf0
2021-02-03 19:38:42 +00:00
Erik Olof Gunnar Andersson 987c9d809e Re-use transport for rpc calls
We are currently creating a new transport for each api
call. This patch changes that so that each worker
can re-use the same transport for multiple requests.

Story: 2008494
Task: 41544
Change-Id: I11a24f035a9d66a536e5e58328084ee08f0c6285
2021-01-29 21:21:24 +00:00
Mohammed Naser 8ce15c4510 Avoid running periodic processes inside each worker process
The periodic jobs are currently getting registered per each worker
which means that in cases with large number of workers, the APIs
for services such as Heat and Keystone will be hit very hard.

This patch resolves this issue by registering the jobs only to the
main process, ensuring that they run once per instance (or group
of workers).

Closes-Bug: #1702349

Change-Id: If9e13effc14fd35e646d02bb4f568e79786aa958
2017-09-19 10:06:32 +00:00
rajat29 907e598dbd Set access_policy for messaging's dispatcher
oslo.messaging allow dispatcher to restrict endpoint methods
since 5.11.0 in d3a8f280ebd6fd12865fd20c4d772774e39aefa2, set with
DefaultRPCAccessPolicy to fix FutureWarning like:

FutureWarning: The access_policy argument is changing its default
value to <class 'oslo_messaging.rpc.dispatcher.DefaultRPCAccessPolicy'>
in version '?', please update the code to explicitly set None as the
value: access_policy defaults to LegacyRPCAccessPolicy which exposes
private methods. Explicitly set access_policy to DefaultRPCAccessPolicy
or ExplicitRPCAccessPolicy.

Change-Id: Ie3dc84840fd39a3a55d6c1dad720d998fadd3c2e
2017-06-21 11:14:24 +05:30
rajat29 ed39dd8b49 Use get_rpc_transport instead of get_transport
With the added get_rpc_transport() function in oslo.messaging [1]
and the recent version bump of oslo.messaging to 5.24.2, we can
safely replace get_transport() with get_rpc_transport() which is much
cleaner.

[1] https://review.openstack.org/#/c/454194/
Related-Bug: #1680192

Change-Id: I3a3e88f0fc85a03c0ee9b82edd165436f136a4d0
2017-06-07 10:56:58 +00:00
Spyros Trigazis (strigazi) bd69b3fff6 Use eventlet executor in rpc_service
The default executor of o.m is 'blocking', but after change [1],
o.m with blocking is broken. 'eventlet' and 'non-blocking' work
fine and most services use 'eventlet', so this is why it was
noticed by magnum which used the default one.

Use eventlet to not be affected by bug #1694728 , but more
importantly, the oslo team suggests to not use blocking which
has 0% test coverage and it is going to be deprecated and unset
from the default configuration.

[1] https://review.openstack.org/#/c/463673/

Change-Id: I47da73787456c97f7d84fd4440404b551ff62528
Closes-Bug: #1694728
2017-06-01 12:31:13 +00:00
ChangBo Guo(gcb) 31ee6a32b1 Remove old oslo.messaging transport aliases
Those are remnants from the oslo-incubator times. Also, oslo.messaging
deprecated [1] transport aliases since 5.2.0+ that is the minimal
version supported for stable/newton. The patch that bumped the minimal
version for Magnum landed 3 months+ ago, so we can proceed ripping
those aliases from the code base.

[1] I314cefa5fb1803fa7e21e3e34300e5ced31bba89

Closes-Bug: #1424728

Change-Id: I7c35f71f601f3191de4a97866d52db343e5735b1
2017-04-05 06:31:31 +00:00
Tovin Seven 32d088b2c1 Integrate OSProfiler in Magnum
* Add osprofiler wsgi middleware. This middleware is used for 2 things:
  1) It checks that person who wants to trace is trusted and knows
     secret HMAC key.
  2) It starts tracing in case of proper trace headers
     and adds first wsgi trace point, with info about HTTP request

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

* Traces HTTP/RPC/DB API calls

Demo: https://hieulq.github.io/cluster-create-false-new-html.html

Co-Authored-By: Hieu LE <hieulq@vn.fujitsu.com>
Implements: blueprint osprofiler-support-in-magnum
Change-Id: I7d68995aab81d365433950aada078ef1fcd5469b
2017-01-24 07:43:31 +07:00
Hieu LE 1a97476593 Centralize config option: rpc periodic section
Centralize config option of rpc periodic section.
Replace oslo_conf cfg to magnum.conf.

Change-Id: Ic499369d16e7be79449a0e8ed5416b0ab92abc07
Implements: blueprint centralize-config-magnum
2016-09-22 05:57:17 +00:00
Jaycen Grant 729c2d0ab4 Rename Bay DB, Object, and internal usage to Cluster
This is patch 3 of 3 to change the internal usage of the terms
Bay and BayModel.  This patch updates Bay to Cluster in DB and
Object as well as all the usages.  No functionality should be
changed by this patch, just naming and db updates.

Change-Id: Ife04b0f944ded03ca932d70e09e6766d09cf5d9f
Implements: blueprint rename-bay-to-cluster
2016-09-08 13:01:12 -07:00
Johannes Grassler f895b2bd09 Fix global stack list in periodic task
The periodic task unneccessarily lists Heat stacks in the
global tenant (across all tenants) which the Magnum service
user may lack permission for. Also, the most restrictive way
to let it use global stack-list is chose a Keystone role and
open that operation to any user in any project holding that
role.

This commit substitutes a direct lookup of all bays' stack_id
attributes for this global stack list. This direct lookup will
yield the same net result. In order to get the neccessary
permissions it will use each bay's stored Keystone trust to
act on behalf of the bay's creating user.

Co-Authored-By: Jiri Suchomel <jiri.suchomel@suse.com>
Closes-Bug: #1589955
Change-Id: I67b176c137c463e37e037970cc4e468d51db30c9
2016-07-27 10:11:51 +02:00
Hongbin Lu 317153a464 Revert "Fix socket descriptor leak"
Several commands take much longer to complete after that commit.
Therefore, we should revert that specific commit first, and
investigate root cause before merging it back.

This reverts commit 873214b6e2.

Closes-Bug: #1540646
Change-Id: I0eb12f76e93fb1675c78bf60367db534061aceb1
2016-02-01 17:10:58 -05:00
Surojit Pathak 873214b6e2 Fix socket descriptor leak
The connection to amqp was not getting cleaned up, even after the
communication to conductor across amqp was complete, for a given
request. Thus, sockets were leaking with each communication and finally
led to a hang situation, where no more fds were available.

Change-Id: I1deabdbce6ba448fe4c25d7694aabe5e5fec7b5a
Closes-Bug: #1510776
2016-01-06 19:48:17 +00:00
Surojit Pathak 27b2868c08 oslo_messaging requires stop() before wait()
According to [1], the correct usage is to call stop() before wait().

[1] -
http://docs.openstack.org/developer/oslo.messaging/notification_listener.html

Change-Id: I930526add5bff312347cb9e41feee7cdcadf3895
Closes-Bug: #1531239
2016-01-05 19:06:49 +00:00
Surojit Pathak d024bc60c4 Decoupling magnum service from periodic task
Liberty tech-debt-bug

Magnum service was initially utilizing periodic task within magnum
conductor. This commit lays out independent periodic framework for
magnum service, by decoupling from periodic task.

Change-Id: Ie0e725b75069309a9fa783f77c1a454f9dae549e
Partial-Bug: 1500998
2015-11-30 18:52:48 +00:00
Surojit Pathak 3674ce278d Backend support for magnum service
To support 'magnum service-list' after 'nova service-list', we need to
introduce periodic status update functionality for internal services.

Change-Id: Ia0c09222405c87cb61e5de4a43ba345ae3405b50
Partially-Implements: blueprint magnum-service-list
Closes-bug: #1492501
2015-09-28 17:06:10 +00:00
Wanghua bb27c29066 Remove unnecessary codes
_server should not be a class variable, so we just remove _server = None

Closes-Bug: #1472977
Change-Id: I935198fce7087a165cdd75b0752d2a66f86e23aa
2015-07-14 02:47:49 +00:00
Eli Qiao fbe5b8065f Add periodic task framework
This patch adds periodic timer to conductor service.
Any new periodic tasks need to be added to magnum/service/periodic.py
We add 2 default configure options to support periodic task:
    'periodic_enable', default=True
    'periodic_interval_max', default=60
These 2 options are for rpc_service.
PS:
We don't need to supervisor timers because timer itself won't have any
exception, and it is not a thread, which means can not be killed.

Partial-Implements: blueprint add-periodic-task
Co-Authored-By: ShaoHe Feng <shaohe.feng@intel.com>
Change-Id: I132d9cc89b26baf249b62b713ccd3776f0078d7d
2015-07-02 17:01:21 +08:00
ZhiQiang Fan 32374e68c7 port to oslo.service
oslo.service has graduated, let's port to it.

Change-Id: I222e02e6fc6731c128a7857850000ca46b29a2c0
Closes-Bug: #1466851
2015-06-28 14:29:00 +08:00
Eli Qiao d31f0d99b0 Handle Interrupt in conductor service
Currently, conductor service doesn't handle interrupts, so it will show
lots of call trace if gets KeyboardInterrupt.

This patch improves this by puting in service.launcher, which already has
better interrupts handling.

Closes-Bug: #1465472
Change-Id: I6a6948c9942cc7c84fcf4ce22b029e7b6727c84e
2015-06-17 16:45:23 +08:00
Bradley Jones 58a13e38a4 Only define RequestContextSerializer once
rpc_service.py is already importing rpc.py so it should reuse
RequestContextSerializer rather than redefining it.

Change-Id: Ie8a6deca7e7c238b8076a8bbbe9598a025222aa1
Closes-Bug: #1459090
2015-05-27 05:44:12 +01:00
Hongbin Lu 848641d5de Implement listener API for conductor horizontal-scale
The conductor listener RPC API and its handler provide a way for
conductors to confirm that other conductors are still alive. This
will be used during acquisition of a lock. In particular, if a conductor
wants to perform an operation on a bay and the bay was locked, the
conductor will attempt to communicate with the conductor who owns that lock.
If the conductor responds affirmatively, the lock will be considered active.

Change-Id: I17a6f9cdc2e8b40d997c1b4e1964658d8e372297
Partial-Implements: blueprint horizontal-scale
2015-04-13 03:09:57 +00:00
Mitsuhiro SHIGEMATSU 1e1d3158d1 Fix typo in magnum/magnum/common/rpc?service.py
Change-Id: I8ae18096ab61e19faaf9f83d858f39b1b96d1e1e
2015-03-21 07:04:20 +09:00
Madhuri Kumari 9739bc82fa Register all magnum exceptions in allow_remote_exmods
Whenever any remote commands raise an exception,
that exception is returned as RemoteError to the
controller rather than being from the magnum
exceptions. Then controller further returns this
to user causing 500 InternalServerError status.
This was so because magnum exceptions were not
listed in allow_remote_exmods.

This patch registers all magnum exceptions in
allow_remote_exmods list. Thus helping to send
proper response to user.

Partially implements blueprint exception-handling-in-magnum
Closes bug: #1424904

Change-Id: Ia90b74798ac070ea514c66a4f66db939dbd1d2a9
2015-02-25 08:41:39 +00:00
Davanum Srinivas 6a84010253 Change ctxt to context to for consistency
rename ctxt in all files under magnum/

Closes-Bug: #1416922
Change-Id: I28870d1381bd7107d431d5d3c76ad636f6d1d90a
2015-02-08 22:50:27 -05:00
Davanum Srinivas 17c5711c55 Remove imports from oslo namespaces
Oslo team is recommending everyone to use the direct imports and
not use the Oslo namespaces. So switch all our code to use oslo_*
instead of "from oslo." or "import oslo" or "from oslo"

NOTE: some of the tests still have mocks referring to oslo.utils
@mock.patch('oslo.utils.timeutils.utcnow')
as the tests break otherwise. We should do this later.

Closes-bug: #1419385
Change-Id: I8e3fbeb833cddc3f55674a0e781ffe69d5033ad4
2015-02-08 02:59:30 +00:00
Steven Dake 6349b4e384 Add RPC backend service
This uses a simplified RPC model while integrating with the
versioned objects serializer.

bay-create is handled by the backend.
bay-list is handled by the RPC service.

Change-Id: I384994584ad7f928df9366a2e6f677951a450e40
2014-12-11 12:30:50 -07:00