Commit Graph

572 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
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
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
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
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 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
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 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
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 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 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
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
Andrey Pavlov 7af41603a5 Use botocore in API instead of boto
Change-Id: Ifeda67bf4b165c5aea20a4fe413f6a0a9ca58332
2017-08-10 14:48:49 +03:00
Jenkins 22d8fa90ad Merge "fix register_image function" 2017-07-06 10:47:32 +00:00
tikitavi 11b76a8812 fix register_image function
replacement of functions performed earlier with nova-cert service
function decrypt_text copied from novaclient to image api
certificates in devstack for uploading image to s3 are created by openssl

Change-Id: Ibf7b90ea29085656005317c4aa0fd96f3313da0c
2017-07-05 15:56:38 +03: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
Jenkins 05f8d67d2b Merge "add using cache to metadata" 2017-06-08 10:31:21 +00: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 b560a6b88a Merge "minor fix to https://review.openstack.org/#/c/466115/" 2017-06-05 15:00:25 +00:00
tikitavi 169db23ae6 minor fix to https://review.openstack.org/#/c/466115/
fix indents
rework unit tests

Change-Id: I65a2e749ea863023abea5e6802364c2e85ef0e38
2017-06-05 16:10:17 +03:00
Jenkins cb20528157 Merge "Remove the deprecated tempest.test.attr" 2017-05-25 18:22:14 +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 7e28af2fcb Remove the deprecated tempest.test.attr
[1] moves the attr decorator from test.py to tempest/lib. So, all the
references to tempest.test has to be moved to tempest.lib.decorator.

[2] https://review.openstack.org/#/c/456236/

Change-Id: I03287250a614c8df328cfaccdbee68aa159964a9
2017-05-22 10:14:13 +07:00
Jenkins a14bddc857 Merge "Using neutron engine in security groups describe." 2017-05-02 15:47:30 +00:00
Jenkins ceaca8338f Merge "Replace six.iteritems() with .items()" 2017-04-20 15:52:26 +00:00
M V P Nitesh 1cde1a7fe8 Replace six.iteritems() with .items()
1.As mentioned in [1], we should avoid using six.iteritems to achieve
iterators. We can use dict.items instead, as it will return iterators
in PY3 as well. And dict.items/keys will more readable.
2.In py2, the performance about list should be negligible, see the
link [2].
[1] https://wiki.openstack.org/wiki/Python3
[2] http://lists.openstack.org/pipermail/openstack-dev/2015-June/066391.html

Change-Id: Ib7ad61bac89e14561719434085b63cbad7e9a9be
2017-04-20 09:42:45 +00:00
Jenkins c406cd5f08 Merge "Switch to use stable remote_client" 2017-04-19 15:14:04 +00:00
Jake Yip 6b3c283894 Using neutron engine in security groups describe.
Nova engine works incorrect in case when describe is using in metadata.
Security-group-list in nova cannot be filtered by tenant,
listing all secgroups in case of big amount of groups can be slow
and may have limitations in number.

Co-Author: tikitavi <rtikitavi@gmail.com>

Change-Id: I199b0f4f4febad4c23a0d8968f7858763bcbf00c
Closes-Bug: #1660888
2017-04-19 12:58:44 +00:00
Andrey Pavlov 6d30c69895 use glanceclient version '2'. fix keystone error message.
current devstack deploys glance version '2' only.
use it.

messages in keystone's exceptions was changed.
fix unit tests that checks it.

Change-Id: I7ed1f0ff518efa374a5e3b693c5785958c77340d
2017-04-19 13:10:40 +03:00
Ken'ichi Ohmichi 476c1a9a86 Switch to use stable remote_client
Tempest has provided stable library remote_client under tempest.lib
since the commit Idb2206c239f25bc8b8530275e84c834233b9544b
This patch switches to use it.

Change-Id: I5972f53f05afaf73c3d96aa9d4352afe320b4f69
2017-03-13 10:09:36 -07:00
Ken'ichi Ohmichi 824db94f5e Switch to use stable data_utils
Tempest provides stable library interfaces under tempest.lib.
This patch switches to use it for data_utils.

Change-Id: Icc562ededf2282d4a5abd44814d403a43cfc1e48
2017-03-07 12:46:02 -08:00
tikitavi 0ee47eb58e small fixes to default vpc implementation
Change-Id: I9c827ceec0ab6a2df0b221bc989a3c211c000200
2017-02-27 15:34:09 +03:00
Jenkins 5d45aea122 Merge "Changes in address in default VPC mode" 2017-02-27 08:50:05 +00:00
Jenkins ccde527aae Merge "add unit tests for create, delete security group and authorize security group ingress in case of default vpc" 2017-02-27 08:49:17 +00:00
Jenkins a0a5dbd2df Merge "describe-security-groups by name in default VPC mode describes security groups in default vpc only" 2017-02-27 08:49:12 +00:00
Jenkins 8cd198af7d Merge "Changes in security groups in default VPC mode" 2017-02-27 08:39:41 +00:00