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
Remove the Oslo Incubator code for timeutils in favor for the
oslo.utils functionality.
Change-Id: Idb7917b80add6aa0f492e6974b630c3a8ffce71f
Depends-On: Ieff34b88d857727e02a3918908b2719535ff4b55
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
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
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
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
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
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
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
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
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
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