Commit Graph

32 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
Andrey Pavlov f9e75281b4 fix UT for cinderclient
- bump version from 2 to 3 for cinderclient
- update aws ec2 interface for create_colume and
  create_network_interface. add cilent_token param
- fix describe network interface - something was
  changed in neutron ports output
- set metadata port for OVN conf file also

Change-Id: Ie3e5a5930d5a8159050ecc0900239935558dddd7
2021-09-28 19:24:15 +00:00
Shi Yan faf3cc0608 Handle binary userdata (like gzip format)
Closes-Bug: #1776398
Change-Id: I2d2937925a2729929506d1639470b2eadb792de7
2021-03-09 21:47:28 +11:00
Stefan Nica 1dad720ef5 fix ec2-api-metadata memcached overlap with nova-api
When ec2-api-metadata and nova-api are using the same
memcached server as a cache backend, the cached values
get intermixed due to the fact that the cache keys are
the same. The result is that either nova-api or
ec2-api-metadata will report cache value errors.

This commit fixes this potential problem by using
a different cache key prefix for the ec2-api metadata
entries.

Change-Id: Ibd26b33b3370d5c9c6cca0bb6e0d9c9eb03c0d50
Closes-Bug: #1717494
2017-09-15 13:42:20 +02:00
Ngo Quoc Cuong 90ed02d682 Delete log translation functions and add hacking rule
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.

Since we have removed log translations completely, we should add hacking
rule to prevent future mistakes.

Change-Id: Ia7524308ef2675f8d41ac80b37dfc7e3787efd90
2017-07-03 04:14:44 -04:00
tikitavi 7939ce17e4 add using cache to metadata
if  configured adds the resulting metadata tree to the cache and
upon next request retrieves the data from the cache
reduces the time of the second and subsequent sequential requests
to the metadata approximately from 2.5 seconds to 0.1

Change-Id: Ia1408f6ef407eb97db1789b5b60d6b36b162ba4d
2017-06-07 15:26:53 +03:00
Jenkins 140af4ae7b Merge "Remove log translations" 2017-05-25 14:41:17 +00:00
tikitavi 20f65fac2d fix ec2-api after deprecation of nova-network functions in novaclient
removed NovaEngine in addresses, availability_zones, instances, security_groups
removed unit tests for NovaEngine
disabled some unit tests using NovaEngine for further reworking

Closes-bug: #1691484
Change-Id: I662d5b57b9e46be80c1d2093038ada83897565eb
2017-05-24 20:00:19 +03: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
skseeker e5989d20b5 LOG.warn is deprecated in python3
Change-Id: Ic021b320be0beb472153d5341931e2b17630e6a8
2016-02-02 11:58:10 +00:00
Jenkins 09d77a2a32 Merge "Expose public key data in metadata server" 2015-09-15 06:03:45 +00:00
Andrey Pavlov 72fba9be44 py34: use ascii decoding instead utf-8 when it possible
Change-Id: I0daf7c0f89e1f5cd1e13edb4db2555d59a350383
2015-09-14 22:53:55 +03:00
Feodor Tersin 2f933907f7 Expose public key data in metadata server
Previously this was skipped because user keys were not accessible with
admin account. Since Nova v2.10 microversion provides admin access to
user keys's public data, this gap with legacy Nova EC2 could be fixed.

Change-Id: If0bb004eb894f6474fb0a65c8fb21dfbe43ae268
2015-09-14 21:36:31 +03:00
Andrey Pavlov f34d64747c py34: fix string conversion
fix working with strings for metadata server,
for some instance properties and for errors.
do some magic with types/encoding.

Change-Id: I2446fc48b51dd903a719aa4dbb1a5556af19e5df
2015-09-13 23:56:53 +03:00
Andrey Pavlov 0ff52b760e py34: fix text conversion and urlparse usage in metadata
Change-Id: I89a3198955a585d601a3d2510c0af3f00eaed2cd
2015-09-10 20:12:03 +03:00
Andrey Pavlov f51ca94079 py34: fix iteritems/itervalues using
Change-Id: Id3e3e814448be22184270db57ff43f5f83c4d1c1
2015-09-09 17:16:09 +03:00
Feodor Tersin 24d91a8724 Unify work with request unpacking methods in metadata server
To improve code readability:
- unify methods' names;
- group methods together.

Change-Id: I48b02aa9406e49dd132a9243f70f6c2e4f334954
2015-09-02 11:07:01 +03:00
Feodor Tersin 5fb8e79312 Consolidate path parsing logic in metadata server
This easies understanding of the code.

Change-Id: I3585853f49864402dcd4ce8fa63fd64dbbc6b0cd
2015-09-02 09:32:10 +03:00
Feodor Tersin 9149b914e1 Add NSX VMware support in metadata server
Port the solution for NSX VMware added into Nova during Liberty cycle by
https://review.openstack.org/#/c/147539

Change-Id: Id4ad1e1b6108818b99f769e9027800b1dafe1447
2015-09-02 09:32:06 +03:00
Feodor Tersin b947e62081 Simplify getting instance attributes from metadata request
Move extraction of instance attributes from a request to a separate
function. This simplifies program logic, which eases adding of
processing of alternative alternative request source types.

Change-Id: I8bb1760cccf69161047a844a92704d0e734b8102
2015-09-02 09:15:33 +03:00
Andrey Pavlov 2f967d5ed4 add code for config generation
Change-Id: Ib86b949bb43ca6b5c386b7032a255f06b0f2eab9
2015-08-28 20:15:50 +03:00
Feodor Tersin 516d4a1ce5 Move strip/prepend dev functions to ec2utils
These functions are useful for various ec2api modules but do not have
any instance specificity.

Change-Id: Ib4539986ce3019d47d56817ec5b1bcf056074d72
2015-07-16 11:38:49 +03:00
Feodor Tersin b19ce0116e Fix compatibility with legacy Nova client for metadata server
No test is changed because the project doesn't have tests for backward
compatibility.

Change-Id: I9f97b13d19415943f613ccc1f20e933fb5df410d
2015-06-19 11:04:38 +03:00
Andrey Pavlov 97e72e40d0 Performance: leverage dict comprehension in PEP-0274
merged from Ifb5cb05b9cc2b8758d5a8e34f7792470a73d7c40

PEP-0274 introduced dict comprehensions to replace dict constructor
with a sequence of length-2 sequences, these are benefits copied
from [1]:
  The dictionary constructor approach has two distinct disadvantages
  from the proposed syntax though.  First, it isn't as legible as a
  dict comprehension.  Second, it forces the programmer to create an
  in-core list object first, which could be expensive.
Nova dropped python 2.6 support, we can leverage this now.
There is deep dive about PEP-0274[2] and basic tests about
performance[3].
Note: This commit doesn't handle dict constructor with kwagrs.
This commit also adds a hacking rule.

[1]http://legacy.python.org/dev/peps/pep-0274/
[2]http://doughellmann.com/2012/11/12/the-performance-impact-of-using-dict-instead-of-in-cpython-2-7-2.html
[3]http://paste.openstack.org/show/154798/

Change-Id: I1bc53e335b6c291da5c54f067f9fdfd5da6b2902
2015-04-02 16:07:58 +03:00
Andrey Pavlov 4b2924c02e add metadata test and fix metadata logic
added ssh.py file is temporary solution until such class
is absent in tempest-lib

Change-Id: I6e4638ed969a30311db03a9c72cbdcae47c179e8
2015-03-25 12:03:19 +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
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 849cc68245 Port tests for block device mapping
Change-Id: I92a7de65db8116ef488b11b6349dc37c332f8e11
2015-01-17 13:59:03 +04:00
Feodor Tersin b27f4feab5 EC2 metadata implementation
Change-Id: I7d3ba06c420e4f70cc01fd0ec64398a4c3405244
2015-01-16 01:19:26 +04:00
Feodor Tersin 6109fc7b0d Metadata proxy service
Change-Id: I57a51a79373341c05eb73df3af2eb3a3e328bf98
2015-01-08 20:53:02 +03:00