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>
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>
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>
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>
This replaces the 'server-migration-show' command provided by
novaclient.
Change-Id: I413310b481cc13b70853eb579417f6e6fad10d98
Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
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>
Simplify the parsing of this option by making use of a custom action.
Change-Id: I670ff5109522d533ef4e62a79116e49a35c4e8fa
Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
argparse doesn't sort options by name, meaning we can use the
opportunity to group closely related options together. Do that.
Change-Id: I6714c8db1a549bd4206d2282d2876a406af65aa2
Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
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>
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>
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>
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>
This is an admin-only operation by default but can be useful.
Change-Id: I25a4da697e27c0fba4d28b504377667eb18f15fe
Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
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>
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>
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>
This replaces the old 'nova volume-attachments' command.
Change-Id: Icb98766f98bd1f2469bdb6df62b4624711f98422
Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
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>
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>
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>
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>
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>
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
This closes the remaining gap with the 2.64 compute API microversion.
Change-Id: Ia42b23d813b7af6ddb1a41f4e9bdc8a6160b908c
Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
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>
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>
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>
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>
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>
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>
Use consistent help strings and error messages.
Change-Id: I42647a6b7e67ce4b8dd5f826e20802ade691c266
Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
Continue journey towards having OSC consuming SDK for nova part.
Depends-On: https://review.opendev.org/#/c/762131/
Change-Id: Id16e6c47aa93f02f15f49e1f59f73fecaa3e3b80
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
Add optional parameters "NODE" and "HOST" in the help text of the
server create comand for --availability-zone.
Co-Authored-By: tianhui <tianhui@awcloud.com>
Change-Id: I4faea8a3d3aecb21ec535e55c238c71745fc68cb
Task: 24274
Story: 2003313