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
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
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
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
Add '--property' option to the 'server rebuild' command, to provide
the ability to specify properties of the rebuilt instance.
This is equivalent to the '--meta' option of the compute's
'nova rebuild' command.
Change-Id: I25ea6622e970416090109316e1e28fab8b0b3f07
Story: #2003979
Task: #26922
In API microversion 2.25 Nova removed the disk_over_commit parameter
to the live migration server action. This patch makes sure that we
don't include it in our request if we're running with 2.25 or higher.
Story: #2002963
Task: #22966
Change-Id: I1bbdd33be96d82422a05982508e370237c3560f3
`host_set()` expects `status` and `maintenance_mode` as keyword
arguments, but in `SetHost.take_action()`, it is called without
expanding the keyword arguments.
So it's called as
```
host_set(host, {'status': 'enable'})
```
instead of
```
host_set(host, status='enable')
```
Change-Id: If0b37ac60091161a892bfc694fce31a988f66005
Task: 23023
save (potentially many) HTTP calls to Glance API for image list
and a call to Nova API for flavor list when the server list
actually returned no servers.
Change-Id: I93a56138c50b82fb4dce67a2f788107f71c5f423
Story: #2002039
Task: #19681
The force down action is added in Microversion 2.11, we should limit
the command only can be executed when the microversion is above 2.10.
Change-Id: I0a87e02e71ff025d30181fc17ebcd003a590f110
With the 2.51 compute API microversion, non-admin users can also
see event details for a given request. This change mentions that
in the help text for "openstack server event show".
While in here, change the _info private attribute access to the
to_dict() usage.
Change-Id: I5fd487b17c4b85bd7e619112ad262ffdd3a940c8
Task: 21199
Story: 2002193
Compute API version 2.47 embeds the server's internal
flavor in the response. The original flavor id is not
preserved since it could have changed if the flavor
was deleted and re-created after the server was created,
which was the dreaded Horizon "Edit Flavor" issue.
So the flavor dict in the server response is a dict of
information about the flavor representing the server
"right now" excluding the id. The original flavor name
is shown though along with the ram/disk/vcpu etc
information.
The server list command has a similar issue which
will be fixed in a follow up change.
Change-Id: I1a92999758006d02567c542b6be8902a049899cc
Task: 13864
Story: 1751104
When showing a server or doing a rebuild, we already have
the latest version of the server so _prep_server_detail
getting the server again is an unnecessary performance hit.
ShowServer is pretty obvious here. For RebuildServer, the
compute API actually refreshes the server before returning
it in the response, so the client already gets the latest
when the rebuild call returns.
The only other usage of _prep_server_detail that does require
a refresh is CreateServer since the POST /servers response is
a minimal version of the server object.
This adds a new refresh kwarg, backward compatible by default,
to _prep_server_detail but changes ShowServer and RebuildServer
to no longer refresh.
Change-Id: Ib1c9c424ed1cafc2dfd8be90af8de8a774bdfbf0
There is a to_dict() method on the Server object from
python-novaclient which makes a deepcopy of the internal
Server._info - use this instead of accessing the _info
attribute directly.
Also, while in here, fixed a typo in _prep_server_detail.
Change-Id: I679b4489c815f8a54368ef6b23b9f77e75b4d0bc
The --ip6 filter when listing servers as a non-admin user
only applies when also using --os-compute-api-microversion
2.5 or greater. This change simply adds a note about that in
the --ip6 option help text.
We could probably get more sophisticated by trying to determine
if the user has the admin role or not and if not, and using --ip6
without microversion >= 2.5, we could error out, but that seems
excessive at this point.
Change-Id: I665c64e0bdac04c695fa119a479df43f70b0fa62
Story: #2002184
Task: #20057
Migrate uses the same mechanism in the backend than Resize and so the
steps and step names are similar. Currently when using the --wait
option with 'migrate', we wait forever because the status won't get to
active until the user performs an action. This makes it return on
verify_resize status just like 'resize' does, so that the user can
perform the next manual step.
Change-Id: Ie1aeac52506bc8801f88fd6a6eb4f6094cf20050
Story: 2001994
Task: 19621
add --image-property option, just like --image-with of novaclient did.
Change-Id: Ic1a8976559255529a8785b1b301a0307812433cb
Signed-off-by: Chen Hanxiao <chenhx@certusnet.com.cn>
Update the code so that "openstack server list --all"
also displays the names of private flavors.
Change-Id: I4804fcd905eaf67b1ad9b461084eaf0caa820d2f
Closes-Bug: #1742453
Compute API version >= 2.37 requires a 'networks' value in
the server create request. The novaclient CLI defaults this
to 'auto' if not specified, but the novaclient ServerManager.create
python API binding code does not, as it wants clients to be explicit.
For the purposes of the OSC CLI, we should follow suit and if the
user is requesting OS_COMPUTE_API_VERSION>=2.37 without specific
nics, we should just default to 'auto'.
Change-Id: Ib760c55e31209223338a4086ff1f4fee88dc6959
Closes-Bug: #1750395
This is a followup to https://review.openstack.org/#/c/541609/ that
changes most outstanding direct uses of sys.stdout to use the encoded
stdout set up by cliff.
Change-Id: I07cfc418385fc787d3b7d3c32d39676cf81bb91f
Because of encoding issue, the "openstack console show log" is prone to
a stack dump, as explained in the bug report.
Use the stdout handle that has already been set up by cliff's App class
with a sane default encoding.
Change-Id: I4d8b0df7f16ee0463e638bb11276220e5b92023b
Closes-Bug: 1747862
a)
/os-floating-ips was removed in Compute API 2.36 and from novaclient's
Python API in 10.0
Add to api.computev2:
floating_ip_add()
floating_ip_remove()
Convert add floating IP command to nova-net/neutron split:
"server add floating ip"
"server remove floating ip"
b)
/os-hosts was removed in Compute API 2.43 and from novaclient's
Python API in 10.0.
Add to api.computev2:
host_list()
host_set()
host_show()
Convert host commands to use intenal api:
"host list"
"host set"
"host show"
c)
The introduction of the Network-style commands into the server group
broke cliff's autoprogram directive as it executes the get_parser() methods
without fully initializing the Command object.
NOTE: This is really three reviews squashed to get through the gate in one pass.
Depends-on: Id6de87211d6c4ea8fd14aa9203d8d5b17e9e2f04
Change-Id: I5116086f9a9e4b2b31a744bf8f4558c79f0bfe59
--swap will add a additional storage device,
which not affect the original swap partition/device.
This patch will clarify this misleading description.
Change-Id: Ic079c069985d39cc969b97876901007a81883f57
Signed-off-by: Chen Hanxiao <chenhx@certusnet.com.cn>
Per API reference, only 'changes-since' is accepted and the variant
with underscore is ignored, making the CLI functionality broken.
[dtroyer] added release note and fixed unit tests.
Change-Id: I0c596531a8af03da17d5ce39d75b12e941403aa5
Closes-Bug: 1732216
The hard-coded choices for the server group policy make it impossible
to create a server group with the soft-affinity or
soft-anti-affinity policy rules which were added in compute API
microversion 2.15. This removes the hard-coded choices so that the
policy is restricted on the server side rather than the client side.
Change-Id: Ib3dc39422ac1015872d56ae2fdeddf0f29613494
Closes-Bug: #1732938
This command will detach a server from a network. All server's
neutron ports that belongs to the specified networks will be removed.
Change-Id: I83a064ed62ab00c6f1016900b9cf30f1c15b8382
Currently, if users want to add another NIC to a running instance,
they need to (i) create a neutron port and (ii) add the port to the
server via teh AddPort command. It would be more convenient to have
a single command to achieve the equivalent.
Novaclient already support adding network to an instance via the
interface-attach command. This patch introduces a similar capability
in OSC.
Change-Id: Ia3e39c57ae7ecb96aae1b66adc52c289daccb6ec
In reviews we usually check import grouping but it is boring.
By using flake8-import-order plugin, we can avoid this.
It enforces loose checking so it sounds good to use it.
This flake8 plugin is already used in tempest.
Note that flake8-import-order version is pinned to avoid unexpected
breakage of pep8 job.
Setup for unit tests of hacking rules is tweaked to disable
flake8-import-order checks. This extension assumes an actual file exists
and causes hacking rule unit tests.
Change-Id: I12b596820727aeeb379bee16c2bc993dee9eb637
'cliff', the command line library used by 'osc_lib' (and, thus,
'python-openstackclient') recently gained a Sphinx extension to
automatically document cliff commands. This allows us to use the
documentation we already have in code instead of duplicating it in the
documentation.
Introduce the use of this, starting with the 'server' commands. This
requires extending the descriptions for two commands to ensure no
information is lost.
Change-Id: If701af8d5a3f78f4b173ceb476dd0c163be4b6ca