Commit Graph

774 Commits

Author SHA1 Message Date
tikitavi 32740781f6 kernel_id and ramdisk_id parameters are not supported in novaclient create
remove them from ec2api

Signed-off-by: tikitavi <rtikitavi@gmail.com>
Change-Id: I0e647be2d3f1500b14deed72a64728a42a33db34
2023-06-23 14:09:56 +03:00
Stephen Finucane af83b08216 Start generating our own key pairs
Nova API microversion 2.92 removed the ability to generate a private
key. The user or client is now responsible for generating the key pair.
Start doing that using cryptography, which is in our requirements
(unlike paramiko, which nova uses).

included:
https://review.opendev.org/c/openstack/ec2-api/+/857880
https://review.opendev.org/c/openstack/ec2-api/+/859192

Change-Id: I0032de8cd779beafbd6848a2aecbcb6455e8eada
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
2022-09-25 12:57:33 +03:00
Zuul 299c898cf4 Merge "Remove redundant override of logging_context_format_string" 2022-08-05 21:04:28 +00:00
Zuul f3828311f8 Merge "Remove six" 2022-08-04 20:30:16 +00:00
nik.kaluzhin 77d6b2fc8e fixed customer_gateway
Signed-off-by: nik.kaluzhin <doupfish@gmail.com>
Change-Id: I1c9b790eb6ce3f9d4281d6b1306eed49043078f3
2022-08-03 11:35:16 +03:00
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
Takashi Kajinami 3a96fcc53f Remove redundant override of logging_context_format_string
The target value is exactly same as the default defined in oslo.log,
thus this override is just redundant.

Change-Id: Ib386df2d8abf561c5b1c266f4c64d544e93c5d62
2022-04-16 00:39:58 +09:00
Takashi Kajinami ed85f5924c Remove ineffective codes from the FaultWrapper middleware
These three variables are initialized but unused.

Closes-Bug: #1967683
Change-Id: I5bab310fef66faa3291e7651106010761f636bc5
2022-04-04 08:07:41 +09: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
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
Andrey Pavlov cdb6eefc25 fix using of SQLAlchemy.in_ operator in UT
the in_() operator accepts a list or other non-string sequence.
the error message indicates that a plain string is being passed
which is invalid. 1.3 erroneously allows this to silently pass,
producing a useless expression:

>>> print(column('q').in_('fake-string'))
q IN (:q_1, :q_2, :q_3, :q_4, :q_5, :q_6, :q_7, :q_8, :q_9, :q_10, :q_11)

1.4 correctly detects this error.

Change-Id: I43dd37f975b49de21cd34bbc8ce9378e09e88420
2021-03-27 17:18:15 +03:00
Shi Yan faf3cc0608 Handle binary userdata (like gzip format)
Closes-Bug: #1776398
Change-Id: I2d2937925a2729929506d1639470b2eadb792de7
2021-03-09 21:47:28 +11:00
Takashi Kajinami eb3b4851a9 Use volume v3 API by default
Currently ec2api uses the volume v2 API by default, but v2 API was
deprecated a while ago and will be removed fron cinder shortly.
This patch ensures that ec2api uses the volume v3 API instead by
default.

Closes-Bug: #1908993
Change-Id: I280d3c009893c67d215b0c7106eec7fe2435c335
2021-01-24 23:34:37 +00:00
zhoulinhui b27e70a7da Use importlib to take place of imp module
The imp module is deprecated[1] since version 3.4, use importlib to
instead

[1]: https://docs.python.org/3/library/imp.html#imp.reload

Change-Id: I7da97be7403617e1460ae179f7e62dcfa47cdf09
2020-08-30 19:46:20 +08:00
Hervé Beraud ca2bab465d Remove elementtree deprecated methods
All our supported runtimes [1] are compatible with the recommended
alternatives.

`Element.getiterator` [2] is deprecated since python 3.2 and will be removed
in python 3.9, these changes switch usages to Element.iter() [3]

[1] https://governance.openstack.org/tc/reference/runtimes/victoria.html#python-runtimes-for-train
[2] https://docs.python.org/3/library/xml.etree.elementtree.html#xml.etree.ElementTree.Element.getiterator
[3] https://docs.python.org/3/library/xml.etree.elementtree.html#xml.etree.ElementTree.Element.iter

Change-Id: Ice98ff5f59e02452c1392f3b2048929764630674
2020-06-23 11:35:58 +02:00
Hervé Beraud 1d3e05a6e8 Stop to use the __future__ module.
The __future__ module [1] was used in this context to ensure compatibility
between python 2 and python 3.

We previously dropped the support of python 2.7 [2] and now we only support
python 3 so we don't need to continue to use this module and the imports
listed below.

Imports commonly used and their related PEPs:
- `division` is related to PEP 238 [3]
- `print_function` is related to PEP 3105 [4]
- `unicode_literals` is related to PEP 3112 [5]
- `with_statement` is related to PEP 343 [6]
- `absolute_import` is related to PEP 328 [7]

[1] https://docs.python.org/3/library/__future__.html
[2] https://governance.openstack.org/tc/goals/selected/ussuri/drop-py27.html
[3] https://www.python.org/dev/peps/pep-0238
[4] https://www.python.org/dev/peps/pep-3105
[5] https://www.python.org/dev/peps/pep-3112
[6] https://www.python.org/dev/peps/pep-0343
[7] https://www.python.org/dev/peps/pep-0328

Change-Id: I3a0de577d7fc75eb83c143fcf595e01eca676446
2020-06-02 20:12:23 +02:00
Sean McGinnis 21c15aa680
Use unittest.mock instead of third party mock
Now that we no longer support py27, we can use the standard library
unittest.mock module instead of the third party mock lib.

Change-Id: Iadefcc287b8557723a9bebc816080cf65636686b
Signed-off-by: Sean McGinnis <sean.mcginnis@gmail.com>
2020-04-18 12:15:29 -05:00
Andreas Jaeger 80bd123e50 Update hacking for Python3
The repo is Python 3 now, so update hacking to version 3.0 which
supports Python 3.

Fix problems found.

Update local hacking checks for new flake8.

Remove hacking and friends from lower-constraints, it's not needed
there.

Change-Id: I48fcd2521d99d0b77b976e87cc638fe5ac051315
2020-03-31 17:02:37 +02:00
Dmitry_Eremeev eba6cf3805 Fix AMI image registration
Depends-On: Ibe564b0edb64eaf2240f077f4adf042689ed6057
Change-Id: I5ab6b6720ae75d9f036b41c84b11e0fe0608b0d1
2020-02-13 19:28:45 +03:00
Dmitry_Eremeev cb7cef977b Openstack API interface changed.
If rules are created or searched with full permissions (ports 1 - 65535),
they are created or found with "null" ports
instead of (ports 1 - 65535).

Depends-On: I24d1a0016f76f6813a9f62294e7eeb9785fa711b
Change-Id: Ic3fbe89720135039ba2c2afaebf3fafebac4d7e3
2020-02-11 19:06:56 +03:00
Dmitry_Eremeev 2b8bab7707 Fix encoding/decoding in paging of universal describer class
Depends-On: I43609d1b37d24d353413e906d00c62073792bb9c

Change-Id: If568ce59c5adfbc8d7a47efdb82fcfb2d427f271
2020-02-05 14:17:26 +00:00
jacky06 c27a8c4eae Update json module to jsonutils
oslo project provide jsonutils, and ec2api use it in many place[1],
this PS to update the remained json module to oslo jsonutils for consistency.

[1]: https://github.com/openstack/ec2-api/search?q=jsonutils&unscoped_q=jsonutils

Change-Id: I46e7cfe55bd5cfbca90177bc4a970c726872bab4
2019-09-13 02:00:39 +00:00
Stephen Finucane 7b7c2d9f21 tests: Avoid using mock wraps
It looks like something has changed in mock 3.x, resulting in some
functions that are wrapped by mock not being called or being called
incorrectly. This breaks some of the assertions we have. There is almost
certainly a bug (or is it a feature, who knows) but the fact is these
tests were extremely tightly coupled to the implementation and probably
didn't need to be. Stop attempting to spy on them and resolve the issue.

We also start using 'assert_not_called' since that's available in mock
3.x.

Change-Id: I06dddc4eba36f80398732ab4f2b7cbc4d7717a00
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
Closes-Bug: #1831870
2019-06-06 14:23:18 +01:00
Andrey Pavlov c3e30fbaf6 change error message for glance client
switch to openstack CLI in create_config and pass network for image creation

Change-Id: I1608f82eeaa6ff4c5ac55f57989bb1cfe17dbdc7
2019-04-07 13:11:14 +03:00
Jake Yip 5446a54a65 Ignore floating ips not attached to instances
If floating ip is on a port attached to devices other than a nova
compute instance, (e.g. it is attached to a loadbalancer) ignore it.

Change-Id: Icda92f0f4b5246aebb082cf48bef751d9e6df2ba
2018-12-17 10:52:09 +11:00
Zuul 0646224bcf Merge "fix tox python3 overrides" 2018-11-12 17:08:03 +00:00
Zuul 28902a607a Merge "Drop all qpid related explanations" 2018-11-12 12:34:53 +00:00
Doug Hellmann 96756ff916 fix tox python3 overrides
We want to default to running all tox environments under python 3, so
set the basepython value in each environment.

We do not want to specify a minor version number, because we do not
want to have to update the file every time we upgrade python.

We do not want to set the override once in testenv, because that
breaks the more specific versions used in default environments like
py35 and py36.

Change-Id: Id2964291cd5e56af09f84d1aeab8138c10f9758f
Signed-off-by: Doug Hellmann <doug@doughellmann.com>
2018-11-12 11:02:34 +03:00
Zuul ece442f21a Merge "Added EC2 API Import Image support (via RegisterImage EC2 API call)" 2018-08-14 08:13:35 +00:00
Tyler Parcell e4ff745d0e Added EC2 API Import Image support (via RegisterImage EC2 API call)
This change allows for the EC2 API call to RegisterImage to support
external URLS provided for the "ImageLocation" parameter:
https://docs.aws.amazon.com/cli/latest/reference/ec2/register-image.html
It enforces that all standards defined there are adhered to

This changes affects RegisterImage from S3 Bucket, requiring
that the "ImageLocation" for it begin with an "s3://" (case-insensitive).

Change-Id: I2a5e93de68b1a654418781fc77369d91dd17dd48
Signed-off-by: Tyler Parcell <Parcell.Tyler@gmail.com>
2018-08-13 13:28:28 +00:00
chenghuiyu c65cb663de Fix usage of isotime
The commit I34b12b96de3ea21beaf935ed8a9f6bae2fe0d0bc and
Ib384ae8130dcc6cbd47a837d11ca171ce02ef29e introduced the
deprecated oslo_utils.timeutils.isotime() is deprecated
as of 1.6.

The deprecation message says to use the datetime.datetime.isoformat()
instead, but the format of the string generated by isoformat isn't
the same as the format of the string generated by isotime. The string
is used in tokens and other public APIs and we can't change it
without potentially breaking clients.

So the workaround is to copy the current implementation from
oslo_utils.timeutils.isotime() to ec2api.api.ec2utils.

For more informations:
https://docs.openstack.org/oslo.utils/latest/reference/timeutils.html

Change-Id: Id62fb53264b04a7ea6ae3035a129353c5cfa040a
Closes-Bug: #1461251
2018-06-29 16:00:40 +03:00
Zuul ad1779c561 Merge "synchronize default vpc creation across threads" 2018-03-29 18:15:22 +00:00
Andrey Pavlov 38b882d97d synchronize default vpc creation across threads
when two clients come for functions where check_default_vpc
is present then one goes to create default vpc and other fails.
it fails because vpc with is_default flag is already in DB
but children objects (like subnets) are not yet created.
For we will lock check_default_vpc function.

Another way is to rework _create_vpc. It can create VPC
without is_default flag. And at the end it can set the flag.
First thread will pass this. And second thread will fail at flag set
operation and will revert all created object. Then second thread
can check presence of default VPC again.
This way is better cause it can work across several controllers.

Change-Id: I5586fa234257b72721e328a9fa2375a56d1553c2
2018-03-24 00:49:01 +03:00
ghanshyam f5983d7cdc Remove intree ec2-api tempest tests
ec2-api jobs have been switched to use
ec2api-tempest-plugin for ec2-api tests, so
we can remove the in-tree tempest tests now.

Change-Id: I82ace9ebd1ca5216c2e3fc3d75f07146417ebf94
2018-03-18 03:27:03 +00:00
Andrey Pavlov 66a5333f1b skip addresses tests due to novaclient changes
and add TODO to fix the api code.

Change-Id: Ia101640a3a0bab165ed56e3e7753b9bb6ec9d3cf
2018-03-14 11:42:52 +00:00
melissaml 398a5af885 Drop all qpid related explanations
Qpid was removed in Mitaka from Oslo Messaging, so we
can remove all qpid related explanations.

Change-Id: I6b4a4f5cb01f385b77303b19ca196f6555f4a36d
2018-03-13 09:46:00 +08:00
ghanshyam 9ed1c1f830 Switch ec2 neutron-full job to use ec2api tempest plugin
ec2api tempest plugin is ready to use for testing the
ec2-api in gate.
This patch moves the 'ec2-api-functional-neutron-full' job
to run test from plugin.

After this we can remove the in-tree ec2-api tempest plugin.

Change-Id: I87698147d644b615f5941db5a6bf4810e9110a58
2018-02-06 07:33:38 +00:00
Andrey Pavlov 1a43b6a1c3 add ssl_ca_cert option to check client cert
option ssl_ca_cert is used to check ssl certs in
input connections from clients.

Change-Id: Ifcc398d6157488cc7b9057d3946f2ada58776754
2018-01-18 14:49:08 +03:00
Andrey Pavlov 5fc752ca6f remove deprecated options
options was deprecated in previous release. remote them now

Change-Id: I524c13c59b48031b35223f81f363bc4c0862b138
2018-01-18 14:45:37 +03:00
Andrey Pavlov 417b02df65 fix DB migration for MySQL
current version of migration API doesn't allow to
pass several commands to one execute

Depends-On: I9f1f39b30d43dc16a474febcf6549cf1901732ec
Change-Id: I0a74c87c4c782a7a26aa0e67fada994cb3e31434
2018-01-10 05:25:43 +00:00
Andrey Pavlov fce377c0ba handle new volume's status "reserved"
cinder introduced a new status 'reserved' for volume.
It means that volume has reserved for attaching.
Cause AWS doesn't know such status then we need to convert
it to status 'attaching'.

Change-Id: I84ee29eefc8a9db3982c61820e2cf72a56946132
2017-12-23 15:53:29 +00:00
Zuul 09be7d5404 Merge "remove unused configuration options" 2017-10-20 17:26:16 +00:00
tikitavi 22af51cc1c remove unused configuration options
api_rate_limit, bindir, pybasedir, service_down_time, tempdir
 was removed

Change-Id: I72389d3ea4bb0685a0862bfe765ab20b78637648
2017-10-20 13:48:00 +03:00
Jenkins 9f0a3ab395 Merge "fix ec2-api-metadata memcached overlap with nova-api" 2017-09-21 16:13:26 +00: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
Gage Hugo 6e99a751b2 Correct import of keystoneauth1 session
keystoneclient.session has been long deprecated in favor of
keystoneauth1.session. This change corrects the import to use
keystoneauth1.session instead of keystoneclient.session.

Change-Id: I4a0992c5dd171975fd561d4472cb0c1d24592e8a
2017-09-13 15:59:49 -05:00
Jenkins 74906017f7 Merge "Fix test_check_simple_image_attributes to pass with AMI images" 2017-08-14 14:30:47 +00:00
Stefan Nica 41823a515d Fix test_check_simple_image_attributes to pass with AMI images
Modify the ec2api.tests.functional.api.test_images.ImageTest.test_check_simple_image_attributes test case to allow AMI image types.

Change-Id: Idc94f84977dacaf9e2a3d3968288bc4396507fff
Closes-Bug: #1710597
2017-08-14 13:45:47 +02:00
Jenkins c4f3a1e8ed Merge "Use botocore in API instead of boto" 2017-08-11 11:31:02 +00:00
Andrey Pavlov 7af41603a5 Use botocore in API instead of boto
Change-Id: Ifeda67bf4b165c5aea20a4fe413f6a0a9ca58332
2017-08-10 14:48:49 +03:00