api.compute.APIv2 network functions.
novaclient 8.0 is now released without support for the previously
deprecated nova-net functions, so include a new low-level REST
implementation of the removed APIs.
Change-Id: If230f128e91cda44461fe93c976cac2aecec2252
api.compute.APIv2 starts with security group functions.
novaclient 8.0 is now released without support for the previously
deprecated nova-net functions, so include a new low-level REST
implementation of the removed APIs.
Change-Id: Id007535f0598226a8202716232313e37fe6247f9
This change enables to specify which fixed-ip will be added to a vm using:
openstack server add fixed ip <vm> <network> --fixed-ip-address <ip>
This change uses interface_attach instead of add_fixed_ip[1] which is
less flexible and uses a deprecated API.
[1] https://review.openstack.org/384261
Closes-Bug: #1678140
Change-Id: I7fe4621439ef0d8dca080551ffaeb614c5a91174
Cleanup help strings and docs for clarity and to keep things consistent:
* --limit metavar should be <num-resource> to indicate what is being counted
* --marker metavar should be <resource> or <resource-id> to indicate the
type of value being specified
* <*-ip-address> metavars should be just <ip-address> as there is no difference
in format between fixed and floating IPs
* Move all occurances of '(name or ID)' to end of help text
Change-Id: I2c31746ed6ded3845244e03e57d809f8bc0e6b9d
This change enables to add/remove a specific port to/from a server using
the new commands:
openstack server add port <vm> <port>
openstack server remove port <vm> <port>
Closes-Bug: #1678137
Change-Id: I6ee57df089235ccc1fb9d38316bd484956b1134d
The Nova API responds with an validation error when a bdm is submitted
containing an empty volume_size. So instead omit that attribute when it
is empty.
Change-Id: Iba905fca8c440a03e828c20922f3b813bba3fa3a
Closes-Bug: 1677236
This change enables to specify which vm fixed-ip will be associated to a
floating ip using:
openstack server add floating ip <vm> <fip> --fixed-ip-address <ip>
Closes-Bug: #1624524
Change-Id: I2ddb68c5873bfed7293b0e661d1adbe111681136
The behavior of server migrate command are different depending on
whether user specify --live option or not.
server migrate command will call live migration API if user specify
--live option.
Ohterwise server migrate command will call migration(cold migration)
API.
Now then, "--block-migraiton" option and "--disk-overcommit" option
only affect live-migration.
But, openstackclient doesn't warn user if user specify these options
without "--live".
But, user can't recognize that specifying options are ignored.
This patch adds a validation that checks whether or not user specify
these options without "--live".
Change-Id: Ifa278abb23ecdba4b13f3742998359ac74eb7ad4
Closes-bug: #1662755
"auto" and "none" options was added into --nic argument of server create
command in patch https://review.openstack.org/#/c/412698/ , but that
don't work and raise internal error when execute command. The patch
fix that issue and add unit and functional tests.
Change-Id: Ia718c3bac0a5172a0cdbe9f0d97972a9346c1172
Co-Authored-By: Kevin_Zheng <zhengzhenyu@huawei.com>
Closes-Bug: #1663520
Current compute_client.servers.create() relies on block_device_mapping
arg which is legacy[1]. "block_device_mapping" format require
device_name which is leads to hard-coded hack in --volume key handler
to KVM specific. "block_device_mapping_v2" format is more friendly
to hypervisiors.
Support of block_device_mapping_v2 appear in python-novaclient 2.16.0,
openstackclient require at least 2.29.0
Makes options --volume and --block-device-mapping work simultaneously.
Appends --block-device-mapping data even if --volume used.
After bug 1383338 only --volume was taken when both are used.
[1]http://docs.openstack.org/developer/nova/block_device_mapping.html
NOTE(dtroyer): I moved the new test_boot_from_volume() functional
test to Ie51b1c375c5940856ec76a5770df3c6bd18a3eba to test our
previous behaviour. The only changes required to support the new
behaviour should be that the empty_volume is now attached in that test.
Change-Id: I7bac3d870dd9ca404093142f8bce22a62e49180d
Closes-Bug: 1647406
Closes-Bug: 1497845
With the deprecation of the Nova proxy APIs in microversion 2.36 [1],
any operation that uses a microversion higher than 2.36 and works with
images will fail because the /images endpoint will return 404. This
patch updates openstackclient to query images using the image client
in places where previously the compute client was used.
[1] http://docs.openstack.org/developer/nova/api_microversion_history.html#id33
Change-Id: Ia66e44e530799ce6531922dcf6a84e38528c8725
Closes-bug: 1630161
The raw output in the command 'openstack server create'(also in show) is
used in display table directily. the item like
os-extended-volumes:volumes_attached and security_groups needs to convert.
the worry output:
os-extended-volumes:volumes_attached | [{u'id': u'c3525de9-1cbf-4ac8-8b7a-ca295c46633b'}]
security_groups | [{u'name': u'default'}]
Change-Id: Id9db251c315f989e1dc5b1b6231ab328014213e3
Leverage the new cliff command class attribute (_description)
to get the help of a command, this allows us to mark strings
for translation. We could not do this before since the help
was grabbed from the docstring.
This also depends on a new release of cliff and a bump to the
minimum level in osc's requirements.
Closes-Bug: 1636209
Depends-On: Id915f6aa7d95a0ff3dc6e2ceaac5decb3f3bf0da
Change-Id: I8673080bb5625e8e3c499feaefd42dfc7121e96f
Currently, --shared-migration and --block-migration options effects are
reversed: --block-migration requests a migration with share,
--shared-migration a block-migration.
This change corrects OSC implementation and clarifies arguments passed
to novaclient (the root cause of the bug).
Change-Id: Ib682cff0c44d3b1304670f8606907b1762d8b1e7
Closes-Bug: #1518059
Currently SshServer ("server ssh" command) raises an AttributeError if
no explicit login is provided because it uses an attribute which no more
exists.
Change-Id: I86f68230037d51efb41aca62e07e058733ecd67a
Closes-Bug: #1624085
group to server
In AddServerSecurityGroup, we currently pass the security group
name to novaclient. If multiple security groups with same name
exist, then even while passing secuity group using id to
command 'openstack server add security group <server> <group>'
it results in error 'Multiple security_group matches found'.
Added unit test case to test the command.
Change-Id: I6097eb36e1545c85209cfd767c477e10f82c6999
Closes-Bug: 1604076
In RemoveServerSecurityGroup we currently pass the entire security
group object, which results in TypeError in novaclient.
Added unit test case to test command 'openstack server remove
security group -h <server> <group>'
Change-Id: I6d486403a83804c3a30d6f89d2cf7f64f09797c6
Closes-Bug: 1590883
The `Image Name` column is shown by default (i.e.: without passing `--long`). E.g.:
```
$ openstack server list
WARNING: openstackclient.common.utils is deprecated and will be removed after Jun 2017. Please use osc_lib.utils
+--------------------------------------+-----------------+---------+----------------------+----------------------+
| ID | Name | Status | Networks | Image Name |
+--------------------------------------+-----------------+---------+----------------------+----------------------+
| abe67035-b14f-4541-b436-e0e778ec4227 | n9anonw302mgm1 | ACTIVE | mnky3-3000=10.3.0.55 | Koala.2016-07-01-175 |
| 8f6a2d12-2bc3-4d89-ba94-8916ce9cdf92 | n9anonw301mgm1 | ACTIVE | mnky3-3000=10.3.0.37 | Koala.2016-07-01-175 |
| b316d6d1-67cf-4f75-94a4-4c9a2b03f6a4 | n9dobby301mgm0 | ACTIVE | mnky3-3000=10.3.0.36 | Koala.2016-05-04-130 |
+--------------------------------------+-----------------+---------+----------------------+----------------------+
```
The `Image ID` column is only available with `--long`. E.g.:
```
$ openstack server list --long -c Name -c "Image Name" -c "Image ID"
WARNING: openstackclient.common.utils is deprecated and will be removed after Jun 2017. Please use osc_lib.utils
+-----------------+----------------------+--------------------------------------+
| Name | Image Name | Image ID |
+-----------------+----------------------+--------------------------------------+
| n9anonw302mgm1 | Koala.2016-07-01-175 | f587c6fc-1df3-42cd-ac86-8cd2c995a8d9 |
| n9anonw301mgm1 | Koala.2016-07-01-175 | f587c6fc-1df3-42cd-ac86-8cd2c995a8d9 |
| n9dobby301mgm0 | Koala.2016-05-04-130 | 37ff47a6-3e51-4986-bfa5-62afbfad5dfc |
+-----------------+----------------------+--------------------------------------+
```
Closes-Bug: #1599304
Change-Id: I477995b840eb9520b285948926ebbfe1777dd86c
This patch does the following things to transfer
"ip fixed add/remove" to "server add/remove fixed ip":
* Add new command "server add/remove fixed ip", and unit
tests and doc.
* Deprecate "ip fixed add/remove" command.
compute/v2/fixedip.py is not removed because the arguments'
positions are different between the new and old commands.
* ip fixed add <network> <server>
server add fixed ip <server> <network>
* ip fixed remove <ip-address> <server>
server remove fixed ip <server> <ip-address>
Change-Id: Ica07ccf92a76c21fd5608ecaff86ff7c4d96f5a0
Implements: blueprint rework-ip-commands
Partial-bug: 1555990
Co-Authored-By: Dean Troyer <dtroyer@gmail.com>
floating ip"
This patch does the following things to transfer
"ip floating add/remove" to "server add/remove floating ip":
* Add new command "server add/remove floating ip", and unit
tests and doc.
* Deprecate "ip floating add/remove" command.
compute/v2/floatingip.py is not removed because the arguments'
positions are different between the new and old commands.
* ip floating add <ip-address> <server>
server add floating ip <server> <ip-address>
* ip floating remove <ip-address> <server>
server remove floating ip <server> <ip-address>
Change-Id: Ic0dd22ca6fb7b7bc3e820fd5a14d7c551e7ab963
Implements: blueprint rework-ip-commands
Partial-bug: 1555990
Co-Authored-By: Dean Troyer <dtroyer@gmail.com>
Use file logger for all command specific logs.
This patch also fixes some usage that doesn't
follow rules in:
http://docs.openstack.org/developer/oslo.i18n/guidelines.html
After this patch, all self.log and self.app.log
will be standardized to LOG().
NOTE: In shell.py, we got the log in class OpenStackShell,
which is also known as self.app.log in other classes.
This logger is used to record non-command-specific logs.
So we leave it as-is.
Change-Id: I114f73ee6c7e84593d71e724bc1ad00d343c1896
Implements: blueprint log-usage
Use osc-lib directly for exceptions.
Leave openstackclient.common.exceptions for deprecation period.
Change-Id: Iea3e862302372e1b31ccd27f69db59b4953ca828
When a server is unexpected state, OSC don't support reset
the server to active or error state, that's supported by
novaclient, and it's an important command for operators, the
patch implement this function.
Change-Id: I3e7800feb192832b0719ef9a353945beb6bfd509
Implements: blueprint server-reset-state
This patch fixes 2 problems:
1. The '\n' should be in the end of a message,
not the beginning.
i.e.:
The original code was:
sys.stdout.write(_('\nError deleting server'))
It will make the output look like this:
[root@tangchen /]# openstack server delete aaa bbb
Error deleting server
Error deleting server[root@tangchen /]#
We change it to:
sys.stdout.write(_('Error deleting server\n'))
Then the output will become:
[root@tangchen /]# openstack server delete aaa bbb
Error deleting server
Error deleting server
[root@tangchen /]#
which is much better.
2. Record the error in log for those who didn't.
Change-Id: I38b00c2321014757970183205f95f026e20a8090
There is such a comment in test_server.py:
# Call .get() to retrieve all of the server information
# as findall(name=blah) and REST /details are not the same
# and do not return flavor and image information.
This is an out of date comment. There is no function named
findall() in OSC now. So use find_resource() instead of get(),
and remove this comment.
Change-Id: I8d79afc5f341fb5caf771d905506b7f1c7a41ae8
In _prep_server_detail(), power_state is not formatted
by _format_servers_list_power_state(). So when executing
"server show" or "server create", the power state is
represented by number. This patch map the numbers to
meanful strings.
This patch also adds power_state attribute to FakeServer,
and improves unit tests for this attribute.
Change-Id: I2ec674327de4e5133b8712ba6bb53fa5ce55e3f4
There are lots of "this option can be repeated" comments
in the doc, which are not consistent to other similar
docs.
This patch changes them to the following format:
"repeat option to do something"
Change-Id: I54e01053091c428bf87bb36bb95f73a0b80ab6e7
Fix "--property" option describe issue in "server unset"
document, and update the help message to keep consistent.
Change-Id: I68022a187e83fad6320365400ad2a1b0c8cf9a61