Commit Graph

26 Commits

Author SHA1 Message Date
xuanyandong 44f22cf2a5 Remove six
Replace the following items with Python 3 style code.

- six.PY2
- six.text_type
- six.string_type
- six.binary_type
- six.iterkeys
- six.moves
- six.itervalues

Implements: blueprint six-removal

Change-Id: I6195ceeeed2ebe1586973eaeef7fa9f29698fec2
2022-07-05 17:37:44 +08:00
OpenStack Release Bot d42220cdc8 Add Python3 zed unit tests
This is an automatically generated patch to ensure unit testing
is in place for all the of the tested runtimes for zed.

See also the PTI in governance [1].

[1]: https://governance.openstack.org/tc/reference/project-testing-interface.html

Change-Id: I21c553d594eaf856e6b2d74ec6174394618a3156
2022-03-08 18:27:28 +00:00
Ngo Quoc Cuong 335a0eb4ad Remove log translations
The i18n team has decided not to translate the logs because it seems
like it not very useful; operators prefer to have them in English so
that they can search for those strings on the internet.

See http://lists.openstack.org/pipermail/openstack-dev/2017-March/thread.html#113365.

Change-Id: I4418a388934ef58acb70c7f637b0236a6ccc7fe6
Closes-Bug: #1682101
2017-05-11 13:43:05 +07:00
Ronald Bradford f70ab5b46d Graduate to oslo.utils.timeutils
Remove the Oslo Incubator code for timeutils in favor for the
 oslo.utils functionality.

Change-Id: Idb7917b80add6aa0f492e6974b630c3a8ffce71f
Depends-On: Ieff34b88d857727e02a3918908b2719535ff4b55
2016-03-18 14:11:42 -04:00
Zhihai Song ed23159ebc Replace oslo_utils.timeutils.isotime
This change introduces ec2api.openstack.common.timeutils that
substitutes the deprecating functions from oslo_utils. Using the
isoformat in the datetime lib will change the time format in API.
So it is better to carry this function in ec2-api. The deprecation
happens in this commit.
https://review.openstack.org/#/c/252898/

Change-Id: Id3606e7ca73ab3e7d58cfe6131984dbf0f3b7e4d
2015-12-17 19:02:59 +08:00
Andrey Pavlov da6f97f291 rework certs stuff
remove ca_certs using for incoming requests
do small refactoring for keystone client using

Change-Id: I83dbb71248835cfc361eca691647deaa99023c8a
2015-11-12 11:19:06 +03:00
Andrey Pavlov 108a8387c6 fix working with incorrect certificate
use 'insecure' flag from config

Change-Id: I880dffc58ab428dcd0aacf62815faeddc0321e9f
2015-11-11 12:55:43 +03:00
Feodor Tersin 7407fbf5bc Use a singleton for admin session
It's not so efficiently to keep admin context per green thread, because
there is a lot of such threads (1k per cpu by default). This doesn't
save more requests to keystone for admin (re)authentification.

There are different strategies to decrease these requests, but the
simplest one is selected - singleton. It bases on an assumption that
Keystone's session is thread safe. It seems to be true.

Change-Id: I626815df693934825e281a834d9b1de852afcdf5
2015-09-14 10:12:38 +03:00
Feodor Tersin 62ae9997fb Use keystone session for admin context
Since that oslo_context is used in ec2api, admin context is cached
between service calls. This leads to that context auth token becomes
outdated, because it has no renewal logic. This is not a big problem for
ec2api service, because each new initialization of regular context
overwrites a previous cached context. But this is a problem for metadata
service, where is no regular context used.

Instead of disabling caching of admin contexts this patch uses the
caching in a separate thread storage. To handle token outdating Keystone
session is used.

Change-Id: I714419dc193471dde8a15715cbaeec83896809c9
2015-09-10 09:00:18 +03:00
Feodor Tersin 1acaceb881 Fix context helpers for admin context
Admin context in ec2api has is_os_admin flag on. Thus helper functions,
which figures out that if a context is admin, has to consider that flag.

Change-Id: Ie5594771314e521e82a80ed8fef213fb5f6232c3
2015-09-10 08:51:54 +03:00
Andrey Pavlov 245754fdaf use request id generator from oslo_context
Change-Id: I6ca0ade07df18ae0af0eefa24ca9406d533d5c2b
2015-09-09 16:41:36 +03:00
Andrey Pavlov 0167580e6d adopt ec2 api to work with keystone v3 api
Change-Id: Idbafeff0aff9a32852ef0dbeaae5b341a7c06b61
2015-08-11 10:40:17 +03:00
Andrey Pavlov 0edf330293 remove roles from context
roles variable needs to check policies in nova.
but ec2api doesn't have policies checking.

Change-Id: If17c4458fabfe947752c526b8015b7b7e0c54d72
2015-08-10 13:32:58 +03:00
Andrey Pavlov 1e591f5f63 update from oslo-incubator
Change-Id: Ic3157b98e8829cc0220e617eb27b552127eafe20
2015-06-24 18:33:23 +00:00
Feodor Tersin 84b441123c Remove get_admin_context function
Originally (in Nova) this function was intendend to get context to get
full access to DB, i.e. to read previously deleted data (with deleted
field is on) or across tenant data access.
Since ec2api database has no ability to hide data instead of delete it,
and API requests for other tenant data are managed by special DB API
methods, we don't need such context elevation.

Change-Id: I16ce6f973872a320858d27d87ed8928958169b3f
2015-03-21 01:20:59 +03:00
Feodor Tersin 99e124814c Reorganize hierarchy of exception classes
Separate ancestors of ec2api internal and aws compliant exceptions.
EC2APIException - base exception class for ec2api with formatting
support
EC2MetadataException - still covers internal exception of ec2api
metadata service
EC2Exception - still covers AWS compliant exceptions
EC2xxxException - derive EC2Exception and are intended to group
exceptions by kind

Also remove unused attributes and code from base exception class.
Fix string constant style to be 'xxx' wherever it's possible.

Change-Id: I398c1e8e1816e0d4073fa5d3fdf0c0a939470399
2015-03-21 01:20:58 +03:00
Feodor Tersin 8282371da4 Get rid of Nova DB access
Important features:
- Nova client with microversion support is required.
- Nova API server may not support microversion 2.3 (not tested).
- Attaching volumes are not displayed in an instance bdm. Because Cinder
volume doesn't yet contain attachment info (which contains a device
name), and Nova instance volumes_attached doesn't contain a device name
(mountpoint). But a bdm must contain it.

Other features:
- v2.3 is requested always
- RunInstance result is formatted w/o extra v2.3 info, so it doesn't
contain rootDeviceName and other such info
- if rootDeviceName property is empty it's omitted instead of
to report fake /dev/sda1 as Nova EC2 does it. This leads to omit
rootDeviceType property in this case as well.
Also the same is done for corresponding image's properties.
- deleteOnTermination volume property is omitted for volume at all, and
for instance bdm if Nova doesn't report it. Previously this volume
property contained 'False' only.
- DescribeVolumes isn't used in DescribeInstances (as opposed to
DescribeNetworkInterfaces), because both methods require actual state
of corresponding OS objects, so we prevent duplication of OS requests.
- Not merged Nova client is used
https://review.openstack.org/#/c/152569/

Also:
- fix multi-run instances for EC2 Classic mode
- safe getting of OS instance security groups
- ec2context module alias is renamed to ec2_context, as it is in other
code
- fakes.CinderVolume is renamed to local standard OSVolume
- fakes.OSInstance it transformed to be initialized from a dictionary,
as it is for other fakes.OSXxx objects
- fix code style

Depends-On: Icf2b9739aaf87b4c9af13ad64a310081a68f776e
Change-Id: Id65ea0f56ffd889286d5ca082e1daf2643205c52
2015-03-20 15:33:05 +03:00
Feodor Tersin 5480e9b850 Add get_os_admin_context function in context module
A preparation step to get rid of Nova DB usage.

Move a function of OS admin context initialization to context module to
use it in all of API.

We're going to use this function to initialize Nova client to get
instance object with an admin account (which is the only option to get
neccessary extended instance attributes).

Change-Id: I195d899ed245ea3489c7e97b56ee6aaff9a08be2
2015-03-10 20:40:05 +03:00
Andrey Pavlov 67eae1069d follow oslo
move to oslo.db and some other oslo libraries

Change-Id: I57e4f01bd46339cdfe3ed2e4748eb1e923cea584
2015-02-26 22:04:09 +03:00
Feodor Tersin 49c721f8c7 Use timeutils from oslo.utils instead of oslo incubator
Change-Id: I4ad485df22bb3779f855b17b74c012f380f12d8e
2015-02-26 13:38:39 +03:00
Andrey Pavlov 47d0a7c35b rework v4 auth.
workaround webob bug.
unify keystone auth with current nova code.
make secret_key lazy loaded.

Change-Id: I475e422af28b8b14a57cbb86901b5059e457d3a0
2015-02-03 17:00:25 +03:00
Feodor Tersin b27f4feab5 EC2 metadata implementation
Change-Id: I7d3ba06c420e4f70cc01fd0ec64398a4c3405244
2015-01-16 01:19:26 +04:00
Feodor Tersin daf47b16ef Extract describe images
It was necessary to:
- extend DB-layer API
- add ec2util functions to auto insert db items
- fix and improve Describer class
- use Describer class for volumes and snapshots

Change-Id: Ief0c3507fd1c7d7e3262a34cbd1d8bfa1d4a9ace
2014-12-19 09:54:26 +04:00
Feodor Tersin 306f9dcf68 Implement describe_instances, store reservation_id
Change-Id: I64c8e62eed6b769953ad0452da676259e9f8900d
2014-11-22 22:56:11 +04:00
Feodor Tersin bd25a18a1a Update copyright
Change-Id: I185fa28474fca0cc8666d6f59de251ce1f9683f2
2014-11-11 21:02:39 +04:00
Alexandre Levine 66826e9e5b Initial EC2-API service commit.
This code introduces standalone service which proxies its calls to
existing nova EC2-API.
All the code here except for the ec2api/api/proxy.py,
ec2api/api/ec2client.py and some util functions is taken from current
nova and unused functionality is cut of it.
The proxy.py and ec2client.py files implement the new code which
proxies incoming request (on port 8788) to original EC2 API in nova
on port 8773.
The result is transparently translated back to user.

Change-Id: I4cb84f833d7d4f0e379672710ed39562811d43e0
2014-07-18 19:33:55 -07:00