Commit Graph

60 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
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
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
tikitavi 61daf6a80f describe-security-groups by name in default VPC mode describes
security groups in default vpc only

changed check_and_create_default_vpc function to return default vpc

fix unit test of describe_security_groups

Change-Id: I50bad4a6a7152eb03599e3985a43162c81500049
2017-02-19 14:16:28 +03:00
tikitavi ead353712e Create new instance by default in default vpc
add unit test
Change-Id: I5a1b38312010ea92a2944ba3aa5d900cbc688751
2017-02-03 20:11:33 +03:00
Andrey Pavlov 2cc7ec92dc fix races
1) fix bug with filtering
filters were applied before unpaired items is added to result

2) fix races in default security group creation

3) add waiter for associate/disassociate address

4) fix security group classic test
it should choose default group group only from classic groups

5) fix describe_vpc_with_filters test
it can run in parallel with other test with same CIDR

6) fix networks list for instance run at subnet creation/deletion

7) fix selective decsribe by names
it should not delete valid items from db

Change-Id: Iadadefb8b4abebbb3b8efc0e536e5de30ed23dab
2015-12-15 09:22:50 +03:00
Andrey Pavlov 8d1a61ce6c change error code and message due to Amazon changes
Amazon changed error code some time ago.

Change-Id: Ib5eb94f3a5bbdb27bc4ead5898376f274dd6e5c3
2015-10-15 15:34:59 +03:00
Jenkins 3a371c2f7a Merge "Prevent updating os_id of db items" 2015-09-10 08:05:59 +00:00
Feodor Tersin 4cd4f28870 Prevent updating os_id of db items
Updating of db item's os_id should be disabled. But a special case (None
-> smth) should be allowed.

Change-Id: I9a38c99d1a5d024ef38339e8d41eff7856cb3ebe
2015-09-09 18:13:32 +03:00
Andrey Pavlov f51ca94079 py34: fix iteritems/itervalues using
Change-Id: Id3e3e814448be22184270db57ff43f5f83c4d1c1
2015-09-09 17:16:09 +03:00
Andrey Pavlov d0a1256415 py34: fix invalid syntax for exception re-raise
Change-Id: I6260cb666d376379fe1e7559b386ab3a76471008
2015-09-09 16:54:21 +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
Feodor Tersin ffc445c964 Merge bdms of run instances parameters with image mappings
Implement AWS feature which allows a user to adjust bdm specified in an
image. The feature is used with boot operation by specifying changed
device attributes with the device name.

Change-Id: Ifb9c215527cd84a60f21ab73fee672928b604300
2015-07-20 17:53:38 +00:00
Feodor Tersin c8ca315277 Implement storage of VPN gateway route propagation attribute
Change-Id: I09ea00b8160b92ed591bac8edd7d28e8f2df472a
2015-05-25 17:48:56 +03:00
Feodor Tersin 020e6c0ba1 Implement VPN connection storage
Change-Id: I3e73dca9ed4084a8d864b7d7495ac6321b623f10
2015-05-25 17:48:38 +03:00
Andrey Pavlov 2f5a484b3a implement groupId for EC2 classic groups
Change-Id: Ia184f1482d1e4a01fc676613abdccfa3c1a72d09
2015-05-22 19:54:42 +03:00
Feodor Tersin 2ab476ecb2 Store static routes for VPN gateways
Change-Id: Id2438158f959068391c0302846dc61a59cf7284c
2015-05-16 17:43:28 +03:00
Feodor Tersin 6843471ed1 Implement VPN gateways
Change-Id: I6d1d88c779321e875c16943a4aa162457543267c
2015-05-16 17:28:53 +03:00
Feodor Tersin 54690d1095 Implement customer gateway
Change-Id: I0e090f1d8dca70235615242f8993081c71ae6615
2015-05-16 17:28:48 +03:00
Andrey Pavlov c354318db8 check right error codes in image operations
Change-Id: Ifa4efbc58f757743ccee19279a7f969890f1dd68
2015-04-22 13:31:16 +03:00
Alexandre Levine 5332325708 Fixes in security_groups.
Fixed exception for orphan "vpc-..."-named groups in describe.
Added check for not deleting default VPC group.
Added check for not deleting VPC if non-default groups exist.
Added check for not allowing creation of groups with existing names.

Change-Id: Ia205ff65409577d148c08b40a297d521d8a8acb1
2015-04-02 18:18:20 +04: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
Andrey Pavlov f8af53b167 create tags' tests
Change-Id: Ic25c25e13f2c89e4179b5d926d3c8908fa4197b1
2015-03-05 09:35:39 +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 1c30d32264 Common exception handling
Change-Id: Ibb2b9623f8d5fa7380c930e1b099028a94932b70
2015-02-21 01:41:12 +03:00
Feodor Tersin b200178189 Handle OS and some input errors for network interfaces
Change-Id: Ifc169ecd4babe343f6f2469668975ec59e8dc997
2015-02-14 16:31:41 +03:00
Feodor Tersin 7377e3f7d9 Implement DescribeAccountAttributes action
Change-Id: I2e67e88f5e804fc400109c762ca9b9be1a8f930e
2015-02-11 01:15:11 +03:00
Feodor Tersin c754004c21 Handle OS errors for addresses, improve unit-tests
Change-Id: I12aad165c9f02a0d7efcf43ab94cff7809e7e7c6
2015-02-11 01:14:51 +03:00
Feodor Tersin 25570b493c Handle and log OS errors for subnets
Change-Id: I7b52a0a0e0d460c4519b51ada3c5850337280767
2015-02-09 13:30:21 +03:00
Feodor Tersin 0dae622a00 Handle and log OS errors for vpc
Change-Id: Ib936187500e91219dfe7acd8b1a6d3c2ff513ce5
2015-02-08 21:37:08 +03:00
Andrey Pavlov 8ead64f89b some fixes to key pairs
Change-Id: I1a3fb41778174bb4c8e8576a02ca8a3a5c27e23c
2015-01-31 12:42:05 +03:00
Feodor Tersin 3c3c4aacc9 Implement device index for networ interfaces
Change-Id: If4b3de991bb959e0f4f336f55fee53e4468e2d0e
2015-01-26 16:57:18 +04:00
alevine 46fc51f71c Added validation for security groups except for IP permissions.
Change-Id: Ie0135cc3e63c0faa7c4a9bfe84cf3469f2985e1a
2015-01-21 12:33:02 +04:00
Feodor Tersin f06c5b190d Port tests for instances
Change-Id: Ia2443478e86aeaef0a5833cae0ed09d519b2f51c
2015-01-20 03:54:17 +04:00
Feodor Tersin b27f4feab5 EC2 metadata implementation
Change-Id: I7d3ba06c420e4f70cc01fd0ec64398a4c3405244
2015-01-16 01:19:26 +04:00
Feodor Tersin c748453028 Remove Glance to EC2 ID Nova mapping
Change-Id: I251597542805bd2ed2641041da7a65cd954a6233
2014-12-30 17:06:06 +04:00
Andrey Pavlov 4e508a1841 remove access to nova's instance id mapping table
Change-Id: I04475a22067d6892632e0e3b608b4bd1e789ab12
2014-12-30 08:53:50 +03:00
Andrey Pavlov 28756f3ad6 remove proxy to ec2
Change-Id: I7c20d19ba1d608c84fbcf9602fcd4be61e9f64ea
2014-12-26 16:05:16 +03:00
Feodor Tersin 01e20e6cfa Tags implementation
Change-Id: Ifcc52758bed9f855928d56527c2a0edb4d5c113e
2014-12-22 14:56:14 +04:00
alevine 92e11cc9d8 Keypair unit tests
Change-Id: I217a9c6abd52fd423e775459334e590a8e1549e7
2014-12-22 11:57:33 +04:00
alevine 8053ca77bb Added absent security groups unit tests and functionality
Change-Id: I4004c9c1b68bee707122f45016d3a7dbb4a7beec
2014-12-21 15:33:48 +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 03d974efc3 Extract snapshots implementation
Change-Id: Iefeda78e8703a7c22c1ff831c3d85d1409c9ea1e
2014-12-09 19:30:16 +04:00
Feodor Tersin 51c7193224 Extract volumes implementation
Change-Id: I491bafd9c06a0cee3596892eedc538a0c2ab64d4
2014-12-09 19:30:09 +04:00
alevine 9b03a6bc4f Added AvailabilityZones and Regions. Added universal describe.
Change-Id: I82f1fe0a8e1fbd23d9b1d2fcc27523ad1a88e8af
2014-12-07 03:45:48 +04:00
Feodor Tersin 4fbecbf901 Allow VPC and EC2 Classic in one project
Change-Id: I86a32b26429ccca43e3c0865e12501b567ef1503
2014-12-01 20:01:59 +04:00
Feodor Tersin 3c400fb115 Filters in describe instances
Change-Id: If5f2e7c37f49df07bfa973dba3ac87a087477a89
2014-11-27 19:43:26 +04:00
Feodor Tersin ccac40d0bf Raise if any object isn't found in get_db_items. Use this for instances
Change-Id: Ib92a40f82d70146b6ed830ce62b3d13a370128f6
2014-11-25 16:24:46 +04:00
Feodor Tersin 27ae351172 Extract describe_instance_attribute
Change-Id: Id62e2d60619fd18254a41ca94e2a6cce06c2169c
2014-11-23 10:46:53 +04:00