summaryrefslogtreecommitdiff
path: root/openstackclient/tests
Commit message (Collapse)AuthorAgeFilesLines
* Replace assertItemsEqual with assertCountEqualAlfredo Moralejo2023-01-311-6/+6
| | | | | | | | | Similar to [1] required after adding some new tests in [2] [1] https://review.opendev.org/c/openstack/python-openstackclient/+/805790 [2] https://review.opendev.org/c/openstack/python-openstackclient/+/819938 Change-Id: I6f4f867048793f9e1e1a05afa4f2beaf8def5053
* compute: Require image when rebuilding a volume-backed serverwhoami-rajat2022-09-301-0/+19
| | | | | | | | | | | | | | | | | A volume-backed server will have no image attribute (or rather the image property will be set to the empty string). As such, if you want to try rebuild you will need to specify an image [*]. Enforce this. [*] Before microversion 2.93, this must be the same image. However, we don't touch on that here. This will be addressed later. Change-Id: I6842dabd7acb4e3a78f894e55e616625757eb6a4 Story: 2010297 Task: 46290 (cherry picked from commit 1f63034441a63b968185e1678049c01205b8e6d7) (cherry picked from commit 0118d57c027c630f726dba4659c1e554ba833405) (cherry picked from commit 53d8667b4bdd749177f39473674a917c0ad5df22) (cherry picked from commit db417598ed958b3f1877906d5d1bc7c5896ea168)
* Merge "compute: Show flavor in 'server list' with API >= 2.47" into ↵Zuul2022-07-051-240/+318
|\ | | | | | | stable/wallaby
| * compute: Show flavor in 'server list' with API >= 2.47Khomesh Thakre2021-12-011-240/+318
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fix the issue where the flavor name was empty in server list output. This requires somewhat invasive unit test changes to reflect the changed API response from the server, but this has the upside of meaning we don't need new tests since what we have validates things. Also drop the flavor ID column as it is removed from the compute API. Change-Id: Ica3320242a38901c1180b2b29109c9474366fde0 Signed-off-by: Khomesh Thakre <khomeshthakre24@gmail.com> Story: 2008257 Task: 41113 (cherry picked from commit 8e362402dee07744668bcf7f6774af4fbe9a07e3) (cherry picked from commit 0873e7580eceab07c3be0824d2ea4163491f8d6e)
* | Fix: create image from volume commandwhoami-rajat2022-07-042-1/+494
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently the command ``openstack image create --volume`` calls cinderclient to upload the volume to image service (glance) but OSC passes ``visibility`` and ``protected`` fields which are only available in microversion 3.1 or greater. This generates an error if the user is using volume microversion < 3.1 and wants to create an image from volume. This patch fixes that by only passing ``visibility`` and ``protected`` fields when the volume microversion is 3.1 or greater and fail otherwise i.e. the following 3 cases: 1) visibility/protected argument + mv >= 3.1 = pass 2) visibility/protected argument + mv < 3.1 = fail 3) not visibility/protected argument + any mv = pass Changes: openstackclient/tests/unit/volume/v3/fakes.py NOTE(croelandt): Imported openstackclient/tests/unit/volume/v3/fakes.py from the Yoga branch. Used FakeType instead of FakeVolumeType for compatibility with older class names. Story: 2010060 Task: 45511 Change-Id: I568a0ea0af8f7f82b16d49a6a1bb0391b99c50dc (cherry picked from commit 9eea28ba59e44526b9d6f1ad9f80c3553d5853e2) (cherry picked from commit 849e7e93f83a220265d11af71e2edc009c3f7bea) (cherry picked from commit 665d93ff0721801896bf08c3cc4f189a55daae80)
* | compute: Fix filtering servers by tagsStephen Finucane2021-10-131-2/+2
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The nova API expects the 'tags' and 'not-tags' filters of the 'GET /servers' (list servers) API to be a CSV string [1]: tags (Optional) A list of tags to filter the server list by. Servers that match all tags in this list will be returned. Boolean expression in this case is 't1 AND t2'. Tags in query must be separated by comma. New in version 2.26 not-tags (Optional) A list of tags to filter the server list by. Servers that don’t match all tags in this list will be returned. Boolean expression in this case is 'NOT (t1 AND t2)'. Tags in query must be separated by comma. New in version 2.26 We were instead providing a Python list, which was simply being URL encoded. Correct this. [1] https://docs.openstack.org/api-ref/compute/?expanded=list-servers-detail#list-servers Change-Id: Ie0251a0dccdf3385089e5bbaedf646a5e928cc48 Signed-off-by: Stephen Finucane <sfinucan@redhat.com> Closes-Bug: #1946816 (cherry picked from commit 53debe7fe1978f661768a27430f646a288948ecc) (cherry picked from commit cbc64f9469600624e74631f42ca214487e800155)
* Replace assertItemsEqual with assertCountEqualwallaby-em5.5.1Dirk Mueller2021-08-2431-291/+291
| | | | | | | | | | | | | | | | | | | | assertItemsEqual was removed from Python's unittest.TestCase in Python 3.3 [1][2]. We have been able to use them since then, because testtools required unittest2, which still included it. With testtools removing Python 2.7 support [3][4], we will lose support for assertItemsEqual, so we should switch to use assertCountEqual. [1] - https://bugs.python.org/issue17866 [2] - https://hg.python.org/cpython/rev/d9921cb6e3cd [3] - testing-cabal/testtools#286 [4] - testing-cabal/testtools#277 Conflicts: openstackclient/tests/unit/volume/v2/test_volume_snapshot.py NOTE(jpena): This file is not present in stable/wallaby Change-Id: I0bbffbec8889b8b3067cfe17d258f5cb16624f38 (cherry picked from commit e82a05864f482acc485d1bd35a4db23452f8b2ac)
* Merge "project cleanup"5.5.0Zuul2021-03-181-0/+183
|\
| * project cleanupArtem Goncharov2021-02-021-0/+183
| | | | | | | | | | | | | | | | | | New implementation of the project cleanup based on the sdk.project_cleanup. It is implemented as an additional OSC operation and will ideally obsolete the `openstack project purge` giving flexibility to extend services support, parallelization, filters, etc. Change-Id: Ie08877f182379f73e5ec5ad4daaf84b3092c829c
* | compute: Remove 'file://' prefix from '--block-device'Stephen Finucane2021-03-111-1/+1
| | | | | | | | | | | | | | | | | | There are a couple of other (networking-related) options which accept paths, none of which insist on a URI-style path. Let's just drop this bit of complexity before we release the feature. Change-Id: Ia7f781d82f3f4695b49b55a39abbb6e582cd879c Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
* | Merge "compute: Add support for loading BDMs from files"Zuul2021-03-111-0/+83
|\ \
| * | compute: Add support for loading BDMs from filesStephen Finucane2021-03-051-0/+83
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The syntax of the '--block-device' parameter is complex and easily screwed up. Allow users to load a block device config from a file. For example: $ openstack server create ... --block-device file:///tmp/bdm.json ... This should alleviate the pain that is BDMv2 somewhat. No functional tests are provided since we already have tests for the CSV style of passing parameters and the unit tests show that the net result is the same. Change-Id: I3e3299bbdbbb343863b4c14fb4d9196ff3e1698d Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
* | | Merge "compute: Add functional tests for --block-device"Zuul2021-03-112-38/+154
|\ \ \ | |/ /
| * | compute: Add functional tests for --block-deviceStephen Finucane2021-03-052-38/+154
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This mostly reuses the existing tests for '--block-device-mapping', which can hopefully be removed at some point in the future. This highlights two issues with the implementation of this option. Firstly, the 'boot_index' parameter is not required so don't mandate it. Secondly, and more significantly, we were defaulting the destination type for the 'image' source type to 'local'. Nova only allows you to attach a single image to local mapping [1], which means this default would only make sense if you were expecting users to use the '--block-device' option exclusively and omit the '--image' option. This is the *less common* case so this is a bad default. Default instead to a destination type of 'volume' like everything else, and require users specifying '--block-device' alone to pass 'destination_type=local' explicitly. [1] https://github.com/openstack/nova/blob/c8a6f8d2e/nova/block_device.py#L193-L206 Change-Id: I1718be965f57c3bbdb8a14f3cfac967dd4c55b4d Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
* | | network: Add missing subnet unset --gateway <subnet-id>Bharat Kunwar2021-03-051-0/+4
|/ / | | | | | | | | | | Story: 2008695 Task: 42003 Change-Id: I9486a09531b11f27a9ff0d68fd4ad8c68a65cccf
* | Merge "compute: Remove deprecated 'server migrate --live' option"Zuul2021-03-041-163/+40
|\ \
| * | compute: Remove deprecated 'server migrate --live' optionStephen Finucane2021-01-221-163/+40
| | | | | | | | | | | | | | | | | | | | | It's been long enough. Time to remove this. Change-Id: I37ef09eca0db9286544a4b0bb33f845311baa9b2 Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
* | | Merge "compute: Stop silently ignore --(no-)disk-overcommit"Zuul2021-03-041-0/+34
|\ \ \ | |/ /
| * | compute: Stop silently ignore --(no-)disk-overcommitStephen Finucane2021-01-221-0/+34
| | | | | | | | | | | | | | | | | | | | | | | | | | | These options are not supported from Nova API microversion 2.25 and above. This can be a source of confusion. Start warning, with an eye on erroring out in the future. Change-Id: I53f27eb3e3c1a84d0d77a1672c008d0e8bb8536f Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
* | | Merge "compute: Auto-configure shared/block live migration"Zuul2021-03-041-20/+25
|\ \ \ | |/ /
| * | compute: Auto-configure shared/block live migrationStephen Finucane2021-01-221-20/+25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | API microversion 2.25 introduced the 'block_migration=auto' value for the os-migrateLive server action. This is a sensible default that we should use, allowing users to avoid stating one of the '--block-migration' or '--shared-migration' parameters explicitly. While we're here, we take the opportunity to fix up some formatting in the function, which is really rather messy. Change-Id: Ieedc77d6dc3d4a3cd93b29672faa97dd4e8c1185 Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
* | | Merge "compute: Add 'server create --block-device' option"Zuul2021-03-041-0/+256
|\ \ \ | |/ /
| * | compute: Add 'server create --block-device' optionStephen Finucane2021-01-221-0/+256
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | One of the last big gaps with novaclient. As noted in the release note, the current '--block-device-mapping' format is based on the old BDM v1 format, even though it actually results in BDM v2-style requests to the server. It's time to replace that. Change-Id: If4eba38ccfb208ee186b90a0eec95e5fe6cf8415 Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
* | | Merge "compute: Add missing 'server create' options"Zuul2021-03-041-0/+233
|\ \ \ | |/ /
| * | compute: Add missing 'server create' optionsStephen Finucane2021-01-211-0/+233
| | | | | | | | | | | | | | | | | | | | | | | | | | | Add some volume-related options, namely '--snapshot', '--swap', and '--ephemeral'. All are shortcuts to avoid having to use '--block-device-mapping'. Change-Id: I450e429ade46a7103740150c90e3ba9f2894e1a5 Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
* | | Merge "compute: Improve 'server create --block-device-mapping' option parsing"Zuul2021-03-041-29/+76
|\ \ \ | |/ /
| * | compute: Improve 'server create --block-device-mapping' option parsingStephen Finucane2021-01-211-29/+76
| | | | | | | | | | | | | | | | | | | | | Once again, custom actions to the rescue. Change-Id: I6b4f80882dbbeb6a2a7e877f63becae7211b7f9a Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
* | | Merge "compute: Rename 'server migrate (confirm|revert)'"Zuul2021-03-041-0/+152
|\ \ \ | |/ /
| * | compute: Rename 'server migrate (confirm|revert)'Stephen Finucane2021-01-211-0/+152
| | | | | | | | | | | | | | | | | | | | | | | | | | | We're confirming or reverting a server migration, not a server migrate. We've a number of 'server migration *' commands now so it makes sense to move them under here. Change-Id: Ib95bb36511dad1aafe75f0c88d10ded382e4fa5c Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
* | | Merge "compute: Add 'server migration show' command"Zuul2021-03-042-0/+171
|\ \ \ | |/ /
| * | compute: Add 'server migration show' commandStephen Finucane2021-01-212-0/+171
| | | | | | | | | | | | | | | | | | | | | | | | This replaces the 'server-migration-show' command provided by novaclient. Change-Id: I413310b481cc13b70853eb579417f6e6fad10d98 Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
* | | Merge "Rename FakeServerMigration to FakeMigration"Zuul2021-03-042-12/+12
|\ \ \ | |/ /
| * | Rename FakeServerMigration to FakeMigrationStephen Finucane2021-01-212-12/+12
| | | | | | | | | | | | | | | | | | | | | | | | Server migrations are (confusingly) a different thing returned by a different API. Change-Id: Ib6b7c8f9cc3d1521a993616f832d41651dc46f73 Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
* | | Merge "compute: Add support for 'server boot --nic ...,tag=<tag>'"Zuul2021-03-041-0/+107
|\ \ \ | |/ /
| * | compute: Add support for 'server boot --nic ...,tag=<tag>'Stephen Finucane2021-01-211-0/+107
| | | | | | | | | | | | | | | | | | | | | | | | This has been around for a long time but was not exposed via OSC. Close this gap. Change-Id: I71aabf10f791f68ee7405ffb5e8317cc96cb3b38 Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
* | | Merge "compute: Improve 'server create --nic' option parsing"Zuul2021-03-041-52/+52
|\ \ \ | |/ /
| * | compute: Improve 'server create --nic' option parsingStephen Finucane2021-01-211-52/+52
| | | | | | | | | | | | | | | | | | | | | Simplify the parsing of this option by making use of a custom action. Change-Id: I670ff5109522d533ef4e62a79116e49a35c4e8fa Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
* | | Merge "compute: Add missing options for 'server event list'"Zuul2021-03-041-1/+234
|\ \ \ | |/ /
| * | compute: Add missing options for 'server event list'Stephen Finucane2021-01-211-1/+234
| | | | | | | | | | | | | | | | | | | | | | | | Add pagination parameters, '--limit' and '--offset', and filtering parameters, '--changes-since' and '--changes-before'. Change-Id: Ieca8267c3b204ae2db580502cc8fe72c95eddf09 Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
* | | Merge "Add --name to port list"Zuul2021-03-031-0/+20
|\ \ \
| * | | Add --name to port listBrian Haley2021-02-231-0/+20
| | |/ | |/| | | | | | | | | | | | | | | | | | | | | | The neutron API supports filtering ports by name, but the CLI was missing support for it like it does for other networking resources. Change-Id: I4ff339e18656013218a26f045b205cb7a02dd2fb Story: #2008654
* | | Merge "compute: Add missing options for 'server group list'"Zuul2021-03-031-4/+43
|\ \ \ | | |/ | |/|
| * | compute: Add missing options for 'server group list'Stephen Finucane2021-01-211-4/+43
| | | | | | | | | | | | | | | | | | | | | | | | | | | Add pagination parameters, '--limit' and '--offset'. It's unfortunate that we can't use '--marker' like elsewhere but that requires server-side support to be truly effective. Change-Id: I186adc8cdf28e9c540ad22bca6684d9dd892976a Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
* | | Merge "compute: Add 'server * --all-projects' option"Zuul2021-03-031-0/+66
|\ \ \ | |/ /
| * | compute: Add 'server * --all-projects' optionStephen Finucane2021-01-211-0/+66
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add an '--all-projects' option to a number of commands: - server delete - server start - server stop This is in addition to 'server list', which already supports this option. This option allows users to request the corresponding action on one or more servers using the server names when that server exists in another project. This is admin-only by default. As part of this work, we also introduce a 'boolenv' helper function that allows us to parse the environment variable as a boolean using 'bool_from_string' helper provided by oslo.utils. This could probably be clever and it has the unfortunate side effect of modifying the help text in environments where this is configured, but it's good enough for now. It also appears to add a new dependency, in the form of oslo.utils, but that dependency was already required by osc-lib and probably more. Change-Id: I4811f8f66dcb14ed99cc1cfb80b00e2d77afe45f Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
* | | Add 'address_group' type support to rbac commandsMiguel Lavalle2021-02-101-1/+5
| |/ |/| | | | | | | Depends-On: https://review.opendev.org/c/openstack/neutron/+/772460 Change-Id: Icd5e96d180364b979d1e93fcb39f9133a41a06e5
* | Merge "Add device profile to ``port``"Zuul2021-01-222-0/+30
|\ \ | |/ |/|
| * Add device profile to ``port``Rodolfo Alonso Hernandez2021-01-192-0/+30
| | | | | | | | | | | | | | | | Added device profile parameter to ``port create`` command. Related-Bug: #1906602 Change-Id: I4c222ac334d3a0a0ee568ed1e0bc8518baa375e1
* | Merge "Support remote-address-group in SG rules"Zuul2021-01-202-0/+44
|\ \ | |/ |/|
| * Support remote-address-group in SG rulesHang Yang2021-01-122-0/+44
| | | | | | | | | | | | | | | | Add support for using remote-address-group in security group rules. Change-Id: Ib1972244d484839943bc3cda07519a6c6d4b945a Implements: blueprint address-groups-in-sg-rules Depends-On: https://review.opendev.org/755644