summaryrefslogtreecommitdiff
path: root/openstackclient/tests
Commit message (Collapse)AuthorAgeFilesLines
* Merge "Fix openstack server list --deleted --marker option" into stable/steinstable/steinZuul2020-08-071-0/+67
|\
| * Fix openstack server list --deleted --marker optionKeithMnemonic2020-01-211-0/+67
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch removes using the "name" option for a marker when --deleted is also used. The find_resource() function that is being called does not correctly handle using the marker as the "name" in the search when also using deleted=True. One simple way to fix this is force the marker to only be an ID when --deleted is used. This is how the nova client works. Using the --deleted option is available to users with the admin role by default. If you're an admin listing --deleted servers with a marker by name, find_resource() is going to fail to find it since it doesn't apply the --deleted filter to find_resource(). The find_resource() function is trying to find the marker server by name if it's not found by id, and to find it by name it's listing servers with the given marker as the name, but not applying the --deleted filter so it doesn't get back any results. In the story it was suggested modifying find_resource to include the deleted query param when it's specified on the command line but that didn't work because it still results in something like this: http://192.168.1.123/compute/v2.1/servers?deleted=True&name=4cecd49f-bc25-4a7e-826e-4aea6f9267d9 It seems like there are bugs in find_resource(). Restricting the marker to be the server ID when listing deleted servers is probably OK since if you're using --deleted you're an admin and you could be listing across all projects and if you're filtering by a server across all projects anyway (not that you have to, I'm just saying if you are), or even showing a server in another project, you have to do it by id rather than name because find_resource() won't find the server in another project by name, only ID. story: 2006761 Task: 37258 The server test case was removed from the cherry-pick as it used features of the openstack client that are not in stable/stein Change-Id: Ib878982b1d469212ca3483dcfaf407a8e1d2b417 (cherry picked from commit c42c27aa926e93a2507e686eeaf0c5510a29d245)
* | Stop silently ignoring invalid 'server create --hint' optionsStephen Finucane2020-02-191-1/+24
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The '--hint' option for 'server create' expects a key-value pair like so: openstack server create --hint group=245e1dfe-2d0e-4139-80a9-fce124948896 ... However, the command doesn't complain if this isn't the case, meaning typos like the below aren't indicated to the user: openstack server create --hint 245e1dfe-2d0e-4139-80a9-fce124948896 Due to how we'd implemented this here, this ultimately results in us POSTing the following as part of the body to 'os-servers': { ... "OS-SCH-HNT:scheduler_hints": { "245e1dfe-2d0e-4139-80a9-fce124948896": null } ... } Which is unfortunately allowed and ignored by nova due to the use of 'additionalProperties' in the schema [1] Do what we do for loads of other options and explicitly fail on invalid values. This involves adding a new argparse action since none of those defined in osc-lib work for us. This is included here to ease backporting of the fix but will be moved to osc-lib in a future patch. Conflicts: openstackclient/tests/unit/compute/v2/test_server.py NOTE(stephenfin): Conflicts are due to the absence of tests for changes Ic06d97b29e51828b29d7ac5172645c288e4ada9e ("Compute: Add description support for server") and If188c3d96fa506dbe62ef256418f2f9bca1520c2 ("Add host and hypervisor_hostname to create servers"), neither of which we want to backport. [1] https://github.com/openstack/nova/blob/19.0.0/nova/api/openstack/compute/schemas/servers.py#L142-L146 Change-Id: I9e96d2978912c8dfeadae4a782c481a17cd7e348 Signed-off-by: Stephen Finucane <sfinucan@redhat.com> Story: #2006628 Task: #36840 Related-Bug: #1845322 (cherry picked from commit ea27ebb0f918db9eab2f5751a1b065818faa0e6d) (cherry picked from commit 576d9ecfd0ac27611ec89af6d34e7378b7a39fb3)
* Fix functional tests for py3Eric Fried2020-01-125-8/+26
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fix various things so the functional tests will work under python3: - A hashlib.md5() can only be update()d with an encoded string in py3. - There's no dict.iteritems(), change to dict.items() (which is already an iterator). - Open temp files with 'w+' mode rather than the default 'w+b' (as an alternative to encoding all the write and expected-read payloads as bytes). - (This is a weird one) Explicitly raise SkipTest from unittest (rather than unittest2, which is where cls.skipException landed). Not sure why this is busted, but this moves the ball. Conflict/issue with raising SkipTest on this branch. (cherry picked from commit f1d742f32adeb662a3fdf8fa3ef3bc391e71ed81) (cherry picked from commit b866202f54afddca66a77cd989b082e193a96956) Includes squash of: Before writing object data to stdout, re-open it in binary mode Otherwise, you can hit TypeErrors on Python3. Closes-Bug: 1775482 (cherry picked from commit 415b48056d9d021e04ec972029040a89a6b13928) Change-Id: Ic9b2b47848a600e87a3674289ae7ae8c3e091fee
* Fix compute service set handling for 2.53+Matt Riedemann2019-09-201-4/+100
| | | | | | | | | | | | | | | | | | | | | With compute API microversion 2.53 there is a single PUT /os-services/{service_id} API which takes the service id as a UUID. Since the openstack compute service set command only takes --host and --service (binary) to identify the service, this change checks if 2.53 or greater is being used and if so, looks up the service by host and binary and calls the appropriate methods in novaclient. If the command cannot uniquely identify a compute service with the given host and binary, an error is raised. A future change could add an --id option to be used with 2.53+ to pass the service id (as UUID) directly to avoid the host/binary filtering. Change-Id: I868e0868e8eb17e7e34eef3d2d58dceedd29c2b0 Story: 2005349 Task: 30302 (cherry picked from commit 4bd53dc1090fda86f6ce25b76a079e250c9206d8)
* Fix BFV server list handling with --name-lookup-one-by-onemelanie witt2019-07-221-8/+26
| | | | | | | | | | | | | | | | | | | | | | | | When the --name-lookup-one-by-one option passed to the 'server list' command, the image and flavor names will be looked up for each server being listed instead of fetching all image/flavor names. The current code assumes all servers have an image attribute, but servers booted from volumes have no image, so the following error is raised when listing BFV servers with --name-lookup-one-by-one: AttributeError: ('unicode'|'str') object has no attribute 'get' The error occurs when the code attempts server.image.get('id'). This fixes the --name-lookup-one-by-one code not to assume an image for a server. The unit tests for 'server list' have also been robustified to feature one BFV server to enhance our test coverage. Story: #2006063 Task: #34777 Change-Id: I312c971346c7ded93f6fcaa515098554b8580295 (cherry picked from commit bfc34e11b3437506508b3e120accc0e212268ac6)
* Fix bug in endpoint group deletionJose Castro Leon2019-06-272-0/+557
| | | | | | | | | | | There is a typo in the endpoint group deletion, due to this you can't remove endpoint groups once assigned. I am adding also the unit tests to avoid this kind of issues in the future Task: 30640 Story: 2005521 Change-Id: Ie938f2c9894bb39b4c0ed1f7aa3a6a751a303058 (cherry picked from commit 04e03b2a1fe34046e2148d3c1d17b9053010c8af)
* Merge "Fix service discovery in functional tests" into stable/steinZuul2019-03-268-32/+31
|\
| * Fix service discovery in functional testsGlenn Van de Water2019-03-228-32/+31
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If a required service is not enabled then we skip the test. The discovery is done by tests/functional/base.py:is_service_enabled but this method is broken, credentials are not passed to the 'openstack service show' command so every call will fail and every test that relies on it will be skipped. This commit fixed that method and the issues that popped up when re-enabling tests. Network segment range: - issue where we assumed network-segment-range extension is always present - issue where we compare integers and string representations of numbers Subnet: - issue where we try to deepcopy an uncopyable object in UnsetSubnet Change-Id: Id3cc907c1ed2a25b49cf6f4a7233e0401a02383a Story: 2005169 Task: 29908 (cherry picked from commit 7741347041b078ca4d687597897194d7797d202d)
* | Fix: set invalid None project_id on range creationKailun Qin2019-03-221-6/+36
|/ | | | | | | | | | | "project_id" attribute should not be set to None on shared network segment range creation since it is not a valid string type which is required for the API. Change-Id: Ia2bab12e39b4bb7e05ff2acfffb851252c100651 Story: 2005205 Task: 29975 (cherry picked from commit 28c06d06885b3ae93da07eb14411d92c3df7e792)
* Merge "Add network segment range command object"3.18.0Zuul2019-03-083-0/+757
|\
| * Add network segment range command objectKailun Qin2019-03-073-0/+757
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add network segment range command object in support of network segment range management. This patch set includes documentation, unit tests and functional tests (currently skipped unit network segment range enabled in Neutron by default) for the following new commands: - "os network segment range create" - "os network segment range delete" - "os network segment range list" - "os network segment range set" - "os network segment range show" Co-authored-by: Allain Legacy <Allain.legacy@windriver.com> [depends on removed by dtroyer as those are all +W and trying to pass the gate, OSC has it's freeze dealine looming] Depends: https://review.openstack.org/624708 Depends: https://review.openstack.org/624709 Depends: https://review.openstack.org/638386 Partially-implements: blueprint network-segment-range-management Change-Id: I335692f2db5be07c1c164f09b13f1abb80b7ba33
* | Merge "API microversion 2.69: Handles Down Cells"Zuul2019-03-071-0/+44
|\ \
| * | API microversion 2.69: Handles Down CellsSurya Seetharaman2019-03-061-0/+44
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch explicitly points out the change needed while forming the detailed lists for servers. In those cases where the server response for ``openstack server list`` has the flavor and image keys missing for the instances in the down cell, the servers will be skipped from being processed. Depends-On: https://review.openstack.org/591657/ Related to blueprint handling-down-cell Change-Id: Ibcfe9febdc45db1cb86c6e88f65976feceb01c02
* | | Merge "Add support for get details of Quota"Zuul2019-03-074-4/+170
|\ \ \
| * | | Add support for get details of QuotaSławek Kapłoński2019-02-244-4/+170
| | |/ | |/| | | | | | | | | | | | | | | | | | | | | | | | | With passing "--detail" argument to "openstack quota list", details about current usage should be returned. It is currently supported by Nova and Neutron so details of resources from those projects can be returned. Change-Id: I48fda15b34283bb7c66ea18ed28262f48b9229fe Related-Bug: #1716043
* | | Merge "Add possibility to filter images using member_status"Zuul2019-03-071-0/+43
|\ \ \
| * | | Add possibility to filter images using member_statusArtem Goncharov2019-02-261-0/+43
| |/ / | | | | | | | | | | | | | | | | | | | | | | | | In order to see image sharing membership it is required to additionally pass member_status filter to API. Otherwise only those with status 'all' will be returned. Thus adding possibility to see images shared with project to be approved or rejected. Change-Id: Ifd6e13e5a4ef09fbc29e76d464c93fbdbb178ae4
* | | Merge "Paginate over usage list to return all usages"Zuul2019-03-062-0/+27
|\ \ \
| * | | Paginate over usage list to return all usagesPavlo Shchelokovskyy2019-02-282-0/+27
| |/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | since nova api 2.40 the os-simple-tenant-usage API supports pagination and will by default return a number of entities configured internally in Nova. This means that when there are many enough projects, the single call to usage.list() will not return usages for all projects. This patch effectively copy-pastes the logic to paginate over usage list results from novaclient/v2/shell.py code. Change-Id: I1b639fe386b7b7db3223f6965495094b9d51533a Story: #2005099 Task: #29713
* | | Merge "Add --attached / --detached parameter to volume set"Zuul2019-03-061-0/+36
|\ \ \
| * | | Add --attached / --detached parameter to volume setDavid Rabel2019-02-281-0/+36
| |/ / | | | | | | | | | | | | | | | | | | | | | | | | As to reflect cinder reset-state --attach-status functionality, this patch adds --attached / --detached parameter to OSC's volume set command. Change-Id: Ic8ee928c9ab0e579512cfb7608f63bfcc2993c7b Closes-Bug: #1745699
* | | Merge "Fix: Restore output 'VolumeBackupsRestore' object is not iterable"Zuul2019-02-282-2/+62
|\ \ \
| * | | Fix: Restore output 'VolumeBackupsRestore' object is not iterablewhoami-rajat2019-02-272-2/+62
| |/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | VolumeBackupsRetore object has '_info' attribute which contains the output data of the restore command which should be returned instead of the 'VolumeBackupsRestore' object. Change-Id: I64b75649c1ac9c24e05a197f7280975564b4d386 Story: 2004740 Task: 28811
* | | Merge "Partially Revert "Add command to unset information from Subnet-pools""Zuul2019-02-271-34/+1
|\ \ \
| * | | Partially Revert "Add command to unset information from Subnet-pools"Bernard Cafarelli2018-09-051-34/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We do not support removing a prefix from a subnet pool, only updating with a larger prefix (which is handled by the set command) This reverts commit 063c722a110031883e9615064092644de6df8da2. Change-Id: I11224fbdb94dc1caef42a8a64cbcebaf1dc542fe Story: #1670230 Task: #13697
* | | | Merge "This fix removes an erroneous underscore found within the function ↵Zuul2019-02-272-2/+2
|\ \ \ \ | |_|/ / |/| | | | | | | named test_snapshot_delete within test_snapshot.py found in both volume v1 and v2 of python-openstackclient."
| * | | This fix removes an erroneous underscore found within the function namedJeremy Houser2019-02-112-2/+2
| | |/ | |/| | | | | | | | | | | | | | | | | | | test_snapshot_delete within test_snapshot.py found in both volume v1 and v2 of python-openstackclient. Story: 2004977 Change-Id: Iae29ba7992dcf8596f4fb4333d8bcf1889ecd7e6
* | | More state handling in volume transfer requests functional testsDean Troyer2019-02-061-8/+19
|/ / | | | | | | | | | | | | | | | | | | | | | | Using addCleanup() for removing the pending volume transfer request has no way to wait for the volume status to become available before cleaning up the volume and gets racy when the tests are run with slow performance in the volume backend. So we pause at the end of the test after either accepting the transfer request or explicitly deleting it so the cleanup can delete the volume. Change-Id: I04862069cab28bc76eeafd60ba32be646f478d86 Signed-off-by: Dean Troyer <dtroyer@gmail.com>
* | Merge "Add floating IP filter to floating IP list command"Zuul2019-01-151-0/+17
|\ \
| * | Add floating IP filter to floating IP list commandJohannes Kulik2019-01-141-0/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add a parameter ``--floating-ip-address`` to ``floating ip list`` because it's supported by the API and also more efficient than the current ``floating ip show``. This also works as a work-around for pagination issues ``floating ip show`` might run into with an IP parameter. Change-Id: I113e3fa2495e1e86bb553c55c44f71a3f9f49d23
* | | Use os-cloud instead of OS env vars for functional testsMonty Taylor2019-01-105-47/+85
|/ / | | | | | | | | | | | | | | | | | | | | | | | | | | In order to support switching auth contexts, such as for registered_limits which take a system scoped token, switch the functional tests to using the --os-cloud command line parameter. However, honor the OS_CLOUD env var as a way that someone can select a different cloud, including 'envvars', to use. Use devstack-system-admin cloud for limit tests Keystone requires these to have system scope now. Change-Id: Ia81eebd3e00ae986cf3ba7e3d98f3e8a1647b622
* | Merge "Support enable/disable uplink status propagation"Zuul2018-12-242-0/+42
|\ \
| * | Support enable/disable uplink status propagationHongbin Lu2018-12-052-0/+42
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add options to enable/disable uplink status propagation on creating a neutron port. Related patches: * neutron: https://review.openstack.org/#/c/571899/ * openstacksdk: https://review.openstack.org/#/c/586687/ Depends-On: https://review.openstack.org/#/c/586687/ Change-Id: I095a98fc5f5aee62d979a16b3cd79d91ec3b9ddb Related-Bug: #1722720
* | | More volume functional test fixesDean Troyer2018-12-181-43/+48
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Remove the use of class setup/teardown from volume transfer functional tests as that just doesn't work too well here. Also wait for volume status before attempting transfer request operations, some test nodes take a while to create the volumes. Change-Id: Ib9378ab5c973deb2aa86c9b9ed31408f3a05115a Signed-off-by: Dean Troyer <dtroyer@gmail.com>
* | | Merge "Supports router gateway IP QoS"Zuul2018-12-121-1/+155
|\ \ \
| * | | Supports router gateway IP QoSLIU Yulong2018-12-101-1/+155
| |/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Adds --qos-policy and --no-qos-policy to `openstack router set`: --qos-policy <qos-policy> Attach QoS policy to router gateway IPs --no-qos-policy Remove QoS policy from router gateway IPs Adds --qos-policy to `openstack router unset`: --qos-policy Remove QoS policy from router gateway IPs Partially-Implements blueprint: router-gateway-ip-qos Closes-Bug: #1757044 Change-Id: Ifec3b2cf9bdb59513c8bcd7bd60305506a071192
* | | Merge "Replace assertEqual(True/False, expr) with assertTrue/assertFalse"Zuul2018-12-128-136/+41
|\ \ \
| * | | Replace assertEqual(True/False, expr) with assertTrue/assertFalseliuyamin2018-11-148-136/+41
| |/ / | | | | | | | | | | | | | | | | | | In some cases, If the result of expr is a boolen value, we shoud use assertTrue/assertFalse to instead. Because it is clear and simple. Change-Id: I53b345fc3915a7b0e737e9dd4d58fe09c746d61c
* | | Merge "Don't display router's is_ha and is_distributed attributes always"Zuul2018-12-101-2/+41
|\ \ \ | |/ / |/| |
| * | Don't display router's is_ha and is_distributed attributes alwaysSławek Kapłoński2018-05-251-2/+41
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In case when is_ha or is_distributed attribute of Neutron's router is set to None, it means that it wasn't returned from server and should not be displayed. Otherwise it might be confusing for user is making openstack router show <router_name> call as an admin will return e.g. is_ha=True but same call done as regular user will return False or None. It might happen like that because returning of those attributes is forbidden for regular users in Neutron's policy.json Depends-On: https://review.openstack.org/567606/ Change-Id: I626b5193d9ecb308baad7b27939f9673c32b4182 Closes-Bug: #1689510 Task: 19789 Story: 2002110
* | | Add volume backup import/export commandsSean McGinnis2018-11-102-0/+143
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This adds commands to import and export volume backup records so they can be imported and restored on other Cinder instances or to the original instance if the service or database has been lost and had to be rebuilt. I know this is a commonly used process by some users, so it would be good to have this functionality in osc so they do not have to switch clients. More details about the export and import process can be found here: https://docs.openstack.org/cinder/latest/admin/blockstorage-volume-backups-export-import.html Change-Id: Ic95f87b36a416a2b50cb2193fd5759ab59336975 Signed-off-by: Sean McGinnis <sean.mcginnis@gmail.com>
* | | Merge "Add project param in LimitList parser"Zuul2018-11-081-1/+2
|\ \ \
| * | | Add project param in LimitList parser3.17.0Vishakha Agarwal2018-11-081-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | when doing openstack limit list --project xyz_id, CLI raising error unrecognized arguments, whereas in api-ref document [1], user can pass project_id as query param.This addresses the above issue, by adding param --project in parser of LimitList. [1] https://developer.openstack.org/api-ref/identity/v3/index.html Change-Id: If4644cc99a3803f61f4a688b828aeb73977fc0dd Closes-Bug: #1798744
* | | | Merge "Remove invalid 'unlock-volume' migration arg"Zuul2018-11-081-24/+0
|\ \ \ \
| * | | | Remove invalid 'unlock-volume' migration argSean McGinnis2018-10-261-24/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There is an optional flag that can be passed in to a volume migration to tell Cinder to 'lock' a volume so no other process can abort the migration. This is reflected correctly with the --lock-volume argument flag to `openstack volume migrate`, but there is another --unlock-volume flag that is shown in the help text for this command that does not do anything and is not used anywhere. Since there is no action to "unlock" a volume, this just causes confusion - including for Cinder developers that know this API. To avoid confusion, this invalid flag should just be removed from the command. Change-Id: I5f111ed58803a1bf5d34e828341d735099247108
* | | | | Merge "Add --name-lookup-one-by-one option to server list"Zuul2018-11-081-1/+29
|\ \ \ \ \
| * | | | | Add --name-lookup-one-by-one option to server listPavlo Shchelokovskyy2018-11-021-1/+29
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | usually in a big cloud there are many images and flavors, while each given project might use only some of those. This patch introduces '--name-lookup-one-by-one' argument to server list command (mutually exclusive with '--no-name-lookup') When provided (or either '--image' or '--flavor' is specified) to the `server list` command, name resolving for corresponding entity is now using targeted GET commands instead of full entities list. In some situations this can significantly speedup the execution of the `server list` command by reducing the number of API requests performed. Change-Id: I59cbf3f75c55e5d3747654edcc9be86ad954cf40 Story: #2002039 Task: #19682
* | | | | | Handle multiple ports in AddFloatingIPmelanie witt2018-11-061-8/+106
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | AddFloatingIP refers to an old nova proxy API to neutron that was deprecated in nova. The neutron API for floating IP associate requires a port to be specified. Currently, the code is selecting the first port if the server has multiple ports. But, an attempt to associate the first port with a floating IP can fail if the first port is not on a network that is attached to an external gateway. In order to make the command work better for users who have a server with multiple ports, we can: 1. Select the port corresponding to the fixed_ip_address, if one was specified 2. Try to associate the floating IP with each port until one of the attempts succeeds, else re-raise the last exception. (404 ExternalGatewayForFloatingIPNotFound from neutron) This also fixes incorrect FakeFloatingIP attributes that were being set in the TestServerAddFloatingIPNetwork unit tests, which were causing the tests to use None as parsed args for ip-address and --fixed-ip-address and thus bypassing code in the 'if parsed_args.fixed_ip_address:' block. Task: 27800 Story: 2004263 Change-Id: I11fbcebf6b00f12a030b000c84dcf1d6b5e86250
* | | | | | Merge "Add --key-name and --key-unset option for server rebuild API."Zuul2018-11-021-0/+90
|\ \ \ \ \ \