2273 Commits

Author SHA1 Message Date
Miguel Lavalle
e8509d81ee Add 'address_group' type support to rbac commands
Depends-On: https://review.opendev.org/c/openstack/neutron/+/772460
Change-Id: Icd5e96d180364b979d1e93fcb39f9133a41a06e5
2021-02-10 17:40:39 -06:00
Zuul
01a53fa96f Merge "Add device profile to `port`" 2021-01-22 20:42:59 +00:00
Zuul
bfa032cb18 Merge "Support remote-address-group in SG rules" 2021-01-20 17:03:39 +00:00
Rodolfo Alonso Hernandez
0cc878e5b0 Add device profile to `port`
Added device profile parameter to ``port create`` command.

Related-Bug: #1906602

Change-Id: I4c222ac334d3a0a0ee568ed1e0bc8518baa375e1
2021-01-19 14:42:46 +00:00
Zuul
6905e97565 Merge "compute: Improve 'server migration list' options" 2021-01-15 21:34:35 +00:00
Zuul
66e33b6edb Merge "compute: Add '--force' option to 'server delete'" 2021-01-15 21:34:25 +00:00
Zuul
fb564d20a5 Merge "compute: Add missing options for 'hypervisor list'" 2021-01-15 21:34:04 +00:00
Zuul
3864ceea26 Merge "compute: Add 'server volume update' command" 2021-01-15 04:09:58 +00:00
Stephen Finucane
dfa869ed1d compute: Improve 'server migration list' options
Improve both the '--user' and '--project' options to allow names as well
as UUIDs. There's no release note included since this entire command was
added in change I15b4a5aca8d0dee59dd293e7b1c7272cdfbeea20, which hasn't
been included in a release yet.

Change-Id: I7654f3ffc54d38d5cfb03d8d1b2f4dc4fb06fb3d
Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
2021-01-12 17:08:54 +00:00
Stephen Finucane
8a164bb09c compute: Add '--force' option to 'server delete'
This is an admin-only operation by default but can be useful.

Change-Id: I25a4da697e27c0fba4d28b504377667eb18f15fe
Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
2021-01-12 17:07:32 +00:00
Stephen Finucane
262e525aad compute: Add missing options for 'hypervisor list'
Yet more pagination parameters.

Change-Id: I9f0145c89ddc49c1d907e6e6e294319cf80fc6ff
Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
2021-01-12 17:07:23 +00:00
Hang Yang
e01e59caeb Support remote-address-group in SG rules
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
2021-01-12 10:55:24 -06:00
Stephen Finucane
ca7f23d0d1 compute: Add 'server volume update' command
We're not going to expose the ability to swap volumes since that's a
things humans should not generally use. From the API docs [1]:

  When updating volumeId, this API is typically meant to only be used
  as part of a larger orchestrated volume migration operation initiated
  in the block storage service via the os-retype or os-migrate_volume
  volume actions. Direct usage of this API to update volumeId is not
  recommended and may result in needing to hard reboot the server to
  update details within the guest such as block storage serial IDs.
  Furthermore, updating volumeId via this API is only implemented by
  certain compute drivers.

We *do* want users to have the ability to change the delete on
termination behavior though, so that's what we expose.

[1] https://docs.openstack.org/api-ref/compute/?expanded=update-a-volume-attachment-detail#update-a-volume-attachment

Change-Id: I50938e1237b4d298521b26a5f9cb90c018dfebaf
Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
2021-01-12 16:29:07 +00:00
Zuul
d6646d714b Merge "network: Address nits for I3c313fc9329837dde67815901528a34dca98ebcc" 2021-01-12 13:54:11 +00:00
Stephen Finucane
dd89efd5ac network: Address nits for I3c313fc9329837dde67815901528a34dca98ebcc
Address comments left in the review for $subject.

Change-Id: I69449112027736152c9fb62f5fe427efd6a25107
Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
2021-01-12 10:07:58 +00:00
Zuul
d828b04c9f Merge "Support Neutron Address Group CRUD" 2021-01-11 17:38:26 +00:00
Zuul
8993d32188 Merge "Add 'server unshelve --wait' option" 2021-01-11 17:37:39 +00:00
Zuul
05cb650442 Merge "Add 'server shelve --offload', 'server shelve --wait' options" 2021-01-11 17:37:32 +00:00
Stephen Finucane
2b073c2034 Add 'server unshelve --wait' option
This was recently added to the 'server shelve' command. Add it now for
the 'unshelve' command.

Change-Id: I633dd85b60cf70b4f8610f414d82669dd6a53111
Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
2021-01-08 18:01:29 +00:00
Stephen Finucane
64c2a1a453 Add 'server shelve --offload', 'server shelve --wait' options
The '--offload' option allows us to explicitly request that the server
be offloaded once shelved or if already shelved.

The '--wait' option allows us to wait for the shelve and/or offload
operations to complete before returning. It is implied when attempting
to offload a server than is not yet shelved.

Change-Id: Id226831e3c09bc95c34b222151b27391a844b073
Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
2021-01-08 18:01:25 +00:00
Stephen Finucane
d5026278ed compute: Add 'server volume list' command
This replaces the old 'nova volume-attachments' command.

Change-Id: Icb98766f98bd1f2469bdb6df62b4624711f98422
Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
2021-01-08 12:14:43 +00:00
Stephen Finucane
958344733a compute: Add missing options for 'server image create'
Add a '--property' option to record arbitrary key/value metadata to
'meta_data.json' on the metadata server.

Change-Id: I267f3290fce3692cbd1ff6a9af146c2736ee31fe
Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
2021-01-08 12:14:43 +00:00
Stephen Finucane
b349057220 tests: Remove unused fake method
The FakeServerMigration.get_server_migrations method was added in
change I15b4a5aca8d0dee59dd293e7b1c7272cdfbeea20 but has never been
used. Remove it.

Change-Id: I6089c5200737b9319a8e96f2a2fc18b7cdd6b2c6
Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
2021-01-08 12:14:43 +00:00
Stephen Finucane
fc24142ed4 compute: Add missing options for 'keypair list'
Add pagination parameters, '--limit' and '--marker'. This isn't
compatible with our client-side '--project' parameter so we error out
for that.

Change-Id: I403cf0fb7aabad4a3dfda5adae62d47ecf7faf5c
Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
2021-01-08 12:14:43 +00:00
Stephen Finucane
8a0f3fc6a8 compute: Add missing options for 'server set'
Add a new '--no-password' option to unset the password on an existing
server. In addition, add a new '--password' option that replaces the
interactive '--root-password' option. This makes sense given no other
commands uses interactive password options.

Checks that rely on specific API microversions now run before we execute
any action, to avoid situations where an update is only partially
applied.

Change-Id: Ibf8717efdd418a2d95215b4d9ab2acf0d57c4a70
Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
2021-01-08 12:14:41 +00:00
Zuul
9a976ada8e Merge "compute: Add missing options for 'server list'" 2021-01-08 02:26:08 +00:00
Stephen Finucane
d0112a801a compute: Add missing options for 'server list'
This accepts a large number of options that we weren't exposing. Add the
following options: '--availability-zone', '--key-name',
'--config-drive' and '--no-config-drive', '--progress', '--vm-state',
'--task-state' and '--power-state'.

In addition, refine the 'openstack server list --status' parameter to
restrict users to the actual choices supported by the server.

Change-Id: Ieeb1f22df7092e66a411b6a36eafb3e16efc2fc2
Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
2021-01-07 14:10:54 +00:00
Stephen Finucane
bbf7de83ff trivial: Use plural for appended parameters
Multiple compute commands take a '--property' parameter or variant
thereof. These should be stored in a 'properties' (plural) dest for
sanity's sake. Correct this.

Change-Id: If393836925fa736404527d9abd212b8ac9931027
Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
2021-01-06 12:02:57 +00:00
Yongli He
f200799848 compute: Add 'server show --topology' option
Add support for compute microversion 2.78 by adding a '--topology'
option to 'openstack server show' command that retrieves server NUMA
information.

Change-Id: Ie22979df2ea9082ca64a4d43b571bd4025684825
2021-01-06 12:02:25 +00:00
Stephen Finucane
a5c6470f2d compute: Add 'server group create --rule' option
This closes the remaining gap with the 2.64 compute API microversion.

Change-Id: Ia42b23d813b7af6ddb1a41f4e9bdc8a6160b908c
Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
2021-01-06 12:02:25 +00:00
Stephen Finucane
bf834f6d75 compute: Fix 'hypervisor show -f yaml' output
The 'cpu_info' field returned by the 'os-hypervisors' API is an object
and should be formatted as such.  However, this is complicated by the
fact that the object in this field is stringified until microversion
2.28 and is only returned as an actual object on later microversions.
Handle the conversion from the string for older microversions and
display things correctly for all releases.

Change-Id: Ide31466cbb9e89c96d6bd542fe039ab5ed1fac1f
Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
2021-01-06 12:02:25 +00:00
Stephen Finucane
e2a9a9607c compute: Fix 'server group * -f yaml' output
Make use of 'FormattableColumn'-derived formatters, which provide better
output than what we were using before, particularly for the YAML output
format.

Change-Id: Id6d25a0a348596d5a0430ff7afbf87b049a76bc8
Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
2021-01-06 12:02:25 +00:00
Stephen Finucane
af5e9d16e8 compute: Fix 'usage * -f yaml' output
Make use of 'FormattableColumn'-derived formatters, which provide better
output than what we were using before, particularly for the YAML output
format.

Change-Id: Ic770f27cb1f74222636f05350f97400808adffbf
Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
2021-01-06 12:02:25 +00:00
Stephen Finucane
03776d82e5 compute: Fix 'server * -f yaml' output
Make use of 'FormattableColumn'-derived formatters, which provide better
output than what we were using before, particularly for the YAML output
format. For example, compare before for the 'server show' command:

  $ openstack --os-compute-api-version 2.79 server show test-server -f yaml
  ...
  addresses: private=fdff:77e3:9bb4:0:f816:3eff:fe6d:a944, 10.0.0.44
  flavor: disk='1', ephemeral='0', extra_specs.hw_rng:allowed='True', original_name='m1.tiny',
    ram='512', swap='0', vcpus='1'
  ...

To after:

  $ openstack --os-compute-api-version 2.79 server show test-server -f yaml
  ...
  addresses:
    private:
    - fdff:77e3:9bb4:0:f816:3eff:fe6d:a944
    - 10.0.0.44
  flavor:
    disk: 1
    ephemeral: 0
    extra_specs:
      hw_rng:allowed: 'True'
    original_name: m1.tiny
    ram: 512
    swap: 0
    vcpus: 1
  ...

Similarly, compare before for 'server list':

  $ openstack --os-compute-api-version 2.79 server list -f yaml
  - ...
    Networks: private=fdff:77e3:9bb4:0:f816:3eff:fe6d:a944, 10.0.0.44
    Power State: Running
    Properties: ''
    ...

To after:

  $ openstack --os-compute-api-version 2.79 server list -f yaml
  - ...
    Networks:
      private:
      - fdff:77e3:9bb4:0:f816:3eff:fe6d:a944
      - 10.0.0.44
    Power State: 1
    Properties: {}
    ...

We also fix the human-readable output for the 'tags' field.

Before:

  $ openstack --os-compute-api-version 2.79 server list
  ...
  | tags   | ['bar', 'foo']  |

After:

  $ openstack --os-compute-api-version 2.79 server list
  ...
  | tags   | bar, foo  |

Change-Id: I7a8349106e211c57c4577b75326b39b88bd9ac1e
Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
2021-01-06 12:02:24 +00:00
Zuul
f6cad0c9d5 Merge "compute: Add missing options for 'server rebuild'" 2021-01-06 11:30:53 +00:00
Zuul
b663e8a080 Merge "Add 'flavor list --min-disk', '--min-ram' options" 2021-01-06 11:16:49 +00:00
Zuul
23afc0af92 Merge "image: Unset properties rather than setting to None" 2021-01-06 11:16:25 +00:00
youngho choi
6f616a29b3 Add support '--progress' option for 'image create'
openstack-client doesn’t support the upload progress bar.

This patch shows progressbar when create image
if you added '--progress' option like a python-glanceclient.

like this.
[=============================>] 100%
+------------------+---------------------------+
| Field            | Value                     |
+------------------+---------------------------+
| container_format | bare                      |
| created_at       | 2020-09-06T20:44:40Z      |
...

How to use
Add the'--progress' option on the 'openstack image create' command.

Code was written by referring to 'python-glanceclient' project
on stable/ussuri branch

Change-Id: Ic3035b49da10b6555066eee607a14a5b73797c00
task: 40003
story: 2007777
2021-01-04 17:25:34 +00:00
Hang Yang
f57e10b903 Support Neutron Address Group CRUD
Add support for Neutron address group CRUD operations. Subsequent patches
will be added to use address groups in security group rules.

Change-Id: I3c313fc9329837dde67815901528a34dca98ebcc
Implements: blueprint address-groups-in-sg-rules
Depends-On: https://review.opendev.org/738274
Depends-On: https://review.opendev.org/745594
2020-12-24 11:27:23 -06:00
Stephen Finucane
29a7c9afce image: Unset properties rather than setting to None
Currently, we attempt to unset an image property by setting it to None.
This doesn't work for known properties and is rightly rejected by the
Glance API with the following error:

  BadRequestException: 400: Client Error for url:
  http://172.20.4.87/image/v2/images/368c5751-2b0b-4a38-a255-fd146fe52d31,
  Bad Request

The solution is to actually unset the field by deleting it.

Change-Id: Ie156bedbe0f9244f82c81401679706f484caf9aa
Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
Story: #2008463
Task: #41493
2020-12-22 17:11:32 +00:00
Zuul
d10706a8db Merge "Add project field in image list subcommand" 2020-12-22 13:49:26 +00:00
Zuul
0fd090eff3 Merge "Add name and enabled param in ListDomain parser" 2020-12-22 13:30:59 +00:00
Zuul
b3e69a2adb Merge "Add option to filter instances by AZ" 2020-12-22 13:30:55 +00:00
okozachenko
3c80b1b3b2 Add project field in image list subcommand
The motivation is to filter the image by owner

Change-Id: I1f08da175a06e62a844f76b0ec18cb3332efef86
2020-12-15 00:45:30 +02:00
Stephen Finucane
f9fd3642f8 compute: Add missing options for 'server rebuild'
This accepts a large number of options that we weren't exposing. Add the
following options: '--name', '--preserve-ephemeral', '--user-data',
'--no-user-data', '--trusted-image-cert' and '--no-trusted-image-certs'.
In addition, rename the '--key-unset' parameter to '--no-key-name', to
mimic e.g. '--no-property' on other commands.

Change-Id: I61c46e18bef1f086b62a015ebdc56be91071b826
Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
2020-12-09 18:38:26 +00:00
Stephen Finucane
da03bd80e3 Add 'flavor list --min-disk', '--min-ram' options
Allow us to filter on minimum disk and RAM, and close another gap with
novaclient.

Change-Id: Ib3f0bdf419675e1c35c3406fbac8a4c18ac56a33
Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
2020-12-09 15:28:12 +00:00
Stephen Finucane
f5b185c357 Make use of comparable 'FormattableColumn' subclasses
This requires fixes found in cliff 3.5.0 [1] and osc-lib 2.3.0 [2]. With
these fixes in place, we can remove the icky, still broken
'assertItemEqual' and 'assertListItemEqual' helpers.

[1] https://review.opendev.org/761421
[2] https://review.opendev.org/761394

Change-Id: Id6c26b37c3c7d5ec6761361abca57f9219b76838
Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
2020-12-09 15:17:25 +00:00
Artem Goncharov
f36a34b675 Switch compute aggregate functions to SDK
Continue journey towards having OSC consuming SDK for nova part.

Depends-On: https://review.opendev.org/#/c/762131/
Change-Id: Id16e6c47aa93f02f15f49e1f59f73fecaa3e3b80
2020-12-02 11:24:51 +00:00
Artem Goncharov
0f4f42b652 Switch compute flavors from novaclient/direct to SDK
Let's switch flavors from novaclient or direct API requests onto using
SDK. Microversion agreement comes out of the box.

SDK normalizes property names, while OSC uses server side names. In
order not to break OSC users continue using server-side names.

Depends-On: https://review.opendev.org/#/c/762989/
Change-Id: I62b2ed8488ee4ac9c42051311bcfb455506ddd90
2020-12-02 11:24:42 +00:00
Zuul
ea358057f8 Merge "stop image downloads to memory" 2020-12-02 04:45:15 +00:00