267 Commits

Author SHA1 Message Date
Andrey Kurilin
f9bdba2dd7 Extend microversion stuff to support resource classes
Current implementation of novaclient.api_versions.wraps allow to use
versioned methods for shell functions and resource managers. As resource
managers can have versioned methods, resource objects can have it too, but
it was not implemented yet. This patch fixes this omission.

Changes:
 - Add api_version property to base resource class. It is mapped to
   api_version property of manager class;
 - Move `novaclient.utils.generate_function_name` to
   `novaclient.api_versions._generate_function_name`, since this method is
   specific to microversion stuff and should not used outside api_versions
   module;
 - Rewrite _generate_function_name to handle class(owner) name. Previously,
   it was improssible to have two classes in one module with versioned
   methods with equal names.
 - Remove call of generate_function_name from novaclient.shell. Shell module
   should not take care about function identifiers. get_substitutions accepts
   object with __id__ property now.
 - Mark _add_substitution as private method, since it should not be used
   outside api_versions module
 - Split all versioned methods of Server resource from novaclient.v2.servers
   module.

Change-Id: Icfce16bfa6f919d7f8451d592f4a8e276b1f1709
2016-06-16 05:57:59 +00:00
Sergey Nikitin
19ff19e1b8 Added functional tests for server tags (microverison 2.26)
Also fixed wrong shell output in 'server-tag-list'
and removes 'server-tag-show' command.

Change-Id: Icfd73e50108c7b1226e51307c0afc3f8f54ff2d6
2016-06-15 21:13:38 +03:00
Jenkins
0e9456aede Merge "Log request_id for each api call" 2016-06-10 14:35:48 +00:00
Jenkins
43e29c6506 Merge "Add info for user_id in v2.10" 2016-06-10 14:07:29 +00:00
Takashi NATSUME
d16c3692e6 Log request_id for each api call
Add the function to log 'x-openstack-request-id' or
'x-compute-request-id' in each API call.
If the caller (e.g. heat) uses oslo.log,
the caller's request id in oslo.context and
the callee's request id can be output in the same
log message (same line).

Change-Id: I29312ce278ecfae41a688a0ddf76c24cfa0eaf6b
Implements: blueprint log-request-id
2016-06-08 00:10:55 +00:00
sampathP
fc90f825f4 Fix nova host-evacuate for v2.14
From API micro version 2.14, evacuate does not need onSharedStorage
flag. This patch check the API micro version and set/ignore the
onSharedStorage flag before call evacuate for each instance.

Closes-Bug: #1581336
Change-Id: I825653d66f94d36a945b8240ec52285827423375
2016-05-25 09:53:42 +09:00
Jenkins
2b1d4633d7 Merge "Added Support of microverison 2.26" 2016-05-23 14:18:01 +00:00
Jenkins
f510d8fd6f Merge "Deprecate --tenant option from flavor-access-list" 2016-05-23 14:17:43 +00:00
Matt Riedemann
1fd68964ea Deprecate --tenant option from flavor-access-list
The --tenant option in the flavor-access-list command was
never implemented and filtering by tenant is not supported
in the REST API for os-flavor-access, so to avoid confusion
this change deprecates the command line option.

It also removes the cruft that was in the python API code
so that only 'flavor' is allowed. This it not a backward
incompatible change since list() still takes kwargs and still
raises a NotImplementedError for anything in kwargs but
'flavor'.

Change-Id: I2c36376674f3a7caf5967a16ac0152f17d9fc906
Closes-Bug: #1582284
2016-05-18 14:10:42 -04:00
Sergey Nikitin
ff9b97b2c6 Added Support of microverison 2.26
This microversion allows to create/delete/update
server tags and to search servers by tags.

Implements: blueprint tag-instances

Change-Id: I66b6d4a763c507335f27a425bc3d4c2aae377c00
2016-05-18 17:36:17 +03:00
Kevin_Zheng
8030879330 Name and AZ should as be optional param on aggregate-update
'name' should be an optional parameter not required
on aggregate-update, so we can update 'availability_zone' only.

Change-Id: I778ab7ec54a376c60f19dcc89fe62fcab6e59e42
Closes-bug: #1280118
2016-05-18 11:08:58 +08:00
Jenkins
eea2512ec8 Merge "Enhance descriptions for get and clear password" 2016-05-12 09:38:43 +00:00
xiexs
dceb77ff44 Clean the duplicated columns for "nova network-list"
If we specify --fields with default columns name, then there will
be an additional column which is absolutely redundant, we need to
check for such case.

Also do the same for "nova list"

Co-Authored-By: ZhiQiang Fan <aji.zqfan@gmail.com>

Change-Id: Ife0a62d2d77aee261ce39c30d3a89ba97a253dae
Closes-Bug: #1574424
2016-04-29 05:53:02 +08:00
ZhiQiang Fan
c22cbb6fac [Trivial] change some functions in novaclient/utils.py to public
There are some functions in novaclient/utils.py which have name with
prefix `_`, in Python, this means it is a private function which
should be only used in its own module. However, these functions are
used in other modules such as novaclient/v2/shell.py.

This patch removes the prefix _ for these functions.

Change-Id: I7bc8a76fd390a7dd30eecbb5c7e641b6ccfb40c0
2016-04-27 20:13:45 +08:00
jichenjc
b1cf812597 Add info for user_id in v2.10
Add description so the output of client will be:

 --user <user-id>  List key-pairs of specified user ID (Admin only).
                    (Supported by API versions '2.10' - '2.latest')

Change-Id: I2916ae6086fe0ada115b0435ba110943b47c829f
2016-04-27 04:50:51 +08:00
jichenjc
4b4573ef9d Enhance descriptions for get and clear password
per http://paste.openstack.org/show/495955/
it shows nova get-password and clear-password is calling
'os-server-password' and in turn operate on metadata server
instead of the operating systme itself, the existing wording
lead to confusion in nova client description.

Change-Id: If69622c181ad3259855d45cb21909e5b7de53615
2016-04-26 12:41:20 +08:00
Jenkins
3bed5446d7 Merge "Use common find_server from v2.shell" 2016-04-26 00:48:31 +00:00
xiexs
2b9310eaed Add a note message for reboot
Currently nova reboot only performs a hard-reboot to
baremetal nodes as ironic doesn't support the soft-reboot
yet. And as absence of this information, end user has to try
to excute this command firstly and then probably realize
the difference between the baremetal nodes and ordinary
VM instance about this command:

 * For VM instance
   nova reboot       : perform a soft reboot by default.
   nova reboot --hard: perform a hard reboot.

 * For baremetal node
   nova reboot       : perform a hard reboot by default.
   nova reboot --hard: perform a hard reboot as well.

For more user-friendly, we'd better add some notes into
the help message explicitly.

Change-Id: I7b3f6da4b5f8a514c6d923f3546470d9de459003
Partial-Bug: #1485416
2016-04-23 20:29:48 -04:00
Andrey Kurilin
fd23ff9000 Use common find_server from v2.shell
- extend v2.shell._find_server with raise_if_notfound param
- reuse v2.shell._find_server for instance_action extension
- fix instance-action-list on v2.21 (it was unable to work
  with deleted instances)

Change-Id: I7b538124c6ab0ee00164822b324aaf2d37c8c2af
2016-04-14 12:05:57 +03:00
Matt Riedemann
a602e59806 Deprecate image list/show/delete/update CLIs/APIs
This deprecates all of the image CLIs/python API bindings that use
the Nova os-images API which is a proxy to the Glance v1 API.

This will emit a warning each time a deprecated CLI/API is used and also
updates the help docs for the deprecated CLIs and docstrings for APIs.

The plan is to do a release once this is merged so people start seeing
it and then we'll actually remove the deprecated CLIs/APIs in the first
python-novaclient release after the Nova server 15.0.0 'O' release.

Depends-On: Iff5fb3180855de7adb3399f6be16bedc8543b4ec

Change-Id: I3f60cc7f4c6e27861c4a84b925d573f35f1a1848
2016-04-12 11:57:57 -04:00
Jenkins
85eb9f7236 Merge "Fix typos in docstrings and comments" 2016-04-07 13:18:42 +00:00
Jenkins
c1f975f4ff Merge "Remove busted baremetal CLIs and API bindings" 2016-04-06 12:49:57 +00:00
Jenkins
96e4449f44 Merge "Switch to 2.1 default api_version in v2.Client" 2016-04-06 12:22:32 +00:00
Dao Cong Tien
a967e40185 Fix typos in docstrings and comments
Change-Id: Ib94c2b999f8295ec526d4e44883b86ab8b5a0688
2016-04-06 09:36:28 +07:00
Matt Riedemann
0634a38cdc Remove busted baremetal CLIs and API bindings
The os-baremetal-nodes compute API does not proxy
baremetal node create/delete or interface add/remove
requests to Ironic, so there is no point in even
having CLIs or python bindings for these operations
in the client.

There isn't a point in deprecating these since they
are already unusable, so let's just remove them.

Change-Id: Id5dd7fbddff87e506460904e352713ae777a8073
Closes-Bug: #1566535
2016-04-05 17:32:20 -04:00
Jenkins
9d9cb2a0aa Merge "Fix ServerGroup.NAME_ATTR" 2016-04-05 10:50:09 +00:00
Jenkins
0193797fcf Merge "Remove deprecated volume(snapshot) commands/bindings" 2016-04-04 17:30:08 +00:00
Jenkins
4435207af2 Merge "Using glance 'image-list'/'image-show' in boot help message" 2016-04-04 12:10:19 +00:00
Matt Riedemann
a425702689 Remove deprecated volume(snapshot) commands/bindings
23f13437dd64496fcbc138bbaa9b0ac615a3cf23 deprecated the
purely volume or volume-snapshot related CLIs and python
API bindings during Kilo. python-cinderclient should be
used for the python API bindings now, and python-openstackclient
should be used for the CLI for those operations.

The alternate_service_type context manager is also removed
since it was only used for proxying through to the volume API
endpoint.

Since the proxy for creating volumes is removed, we have to
add python-cinderclient for testing the volume attachment
CLIs/APIs that are left intact.

Change-Id: I09a6501603667350f49b1b1fa130353a6d5272a2
2016-04-03 14:05:05 -04:00
Andrey Kurilin
b9807c0648 Switch to 2.1 default api_version in v2.Client
Direct initialization of versioned clients is restricted, but we tries to
decrease the number of possible bugs and issues, so default value for
api_version was added to v2.Client .

Let's set it to 2.1, since 2.0 is too old API version.

Change-Id: If127f858f7f670a090a57267f46a69ea4c056cce
2016-04-01 19:25:44 +03:00
Rui Chen
51306fc4c9 Fix ServerGroup.NAME_ATTR
Finding by specify server group name failed in ServerGroupsManager.find(),
ServerGroup.NAME_ATTR is "server_group_name" currently, but NAME_ATTR
should be "name", because only "name" attribute exists in ServerGroup
object, not "server_group_name".

Change-Id: Id6b7676d14e6283d856a069da5ff287dc3228386
Closes-Bug: #1563301
2016-04-01 10:02:11 +00:00
Jenkins
d9e8e364e0 Merge "Fix host-evacuate-live for 2.25 microversion" 2016-03-29 19:52:22 +00:00
huangtianhua
31c9e399f2 Using glance 'image-list'/'image-show' in boot help message
Using glance commands instead in boot help message.

Change-Id: I0f20d24a9ab32a80bbbc524e1b5ce754aded1814
2016-03-28 17:40:19 +08:00
Jenkins
5f6d731f93 Merge "aggregate-details changed to aggregate-show" 2016-03-25 19:03:50 +00:00
Matt Riedemann
90fbbb2956 Fix host-evacuate-live for 2.25 microversion
Change I01b22593724616bc0a7793c509ecabf095d6927d made the
live_migrate() method in the ServerManager conditional on the
API version requested. This broke the host-evacuate-live
command which is calling ServerManager.live_migrate() directly
with one too many arguments for the v2.25 version of the method.

This updates the host-evacuate-live shell to behave like the
live-migration method and be aware of the API version when
calling the live_migrate() method.

Related to blueprint making-live-migration-api-friendly

Change-Id: I4dbeb6ebe03f03799b706be2d787d21484b5c664
Closes-Bug: #1561938
2016-03-25 14:00:59 -04:00
Jenkins
abe6707d26 Merge "Wrap interface_list by proper resource class" 2016-03-21 14:22:34 +00:00
Jenkins
2d353f2879 Merge "Overwrite Usage class's get() function" 2016-03-21 14:03:12 +00:00
Jenkins
a4d2d0ce83 Merge "Add changes-since support when list servers" 2016-03-21 14:03:06 +00:00
Jenkins
b154a4828b Merge "Validate shutdown value of --block-device" 2016-03-21 13:59:48 +00:00
abhishek.talwar
bf68a0cf10 aggregate-details changed to aggregate-show
To show details of aggregate, we have
aggregate-details command. But all other
commands to show details of any resource
is *-show like flavor-show, keypair-show etc.

So changed the command to aggregate-show.

Change-Id: If4875833a27382a6f3193ec55d6d4cb1852249fd
Closes-Bug: #1552646
2016-03-21 12:44:16 +05:30
Balazs Gibizer
f6bcac4772 Validate shutdown value of --block-device
The shutdown value of the --block-device parameter was stated to
to be either 'remove' or 'preserve' but the code only coverted
everything to False that was not equal to 'remove'.

This patch adds strict validation that rejects values other than
'remove' or 'preserve'.

Closes-bug: #1558157
Change-Id: I89a6c4fe90ec4d8155f4a7b93006d1972654a223
2016-03-16 17:51:00 +01:00
Kevin_Zheng
7cefdd36a6 Add changes-since support when list servers
Nova API supports change-since filter when list servers:
https://github.com/openstack/nova/blob/master/nova/api/openstack/compute/servers.py#L325-L331
but in python-novaclient we don't.
This patch  add the support for change-since when list servers.

Closes-bug: #1551591

depends-on: Ic2f239f634f917a5771b0401a5073546c710c036

Change-Id: I27f2d1e33a56d357e247111b338c93861716cfee
2016-03-16 17:56:21 +08:00
Andrey Kurilin
97d63e3ecc Wrap interface_list by proper resource class
Server resource is not the right one to represent data for interfaces.
This patch adds new resource class NetworkInterface for this task.

Change-Id: I02cfe520643522006333f6e1e80e029959af6e1c
Closes-Bug: #1554907
2016-03-09 15:02:43 +03:00
abhishek.talwar
b80d8cb6e6 nova add-secgroup help updated with secgroup id
As per nova add-secgroup help,
the user need to enter secgroup
name's to  add it to a server.
But as the command works fine
with secgroup id too, so updated
the help.

Change-Id: If13dd619808b7ff87c214f17ef71296166d870ab
Closes-Bug: #1554930
2016-03-09 14:53:43 +05:30
Jenkins
17be772404 Merge "Return a less dramatic message for public flavors." 2016-03-08 01:35:48 +00:00
Matt Riedemann
d8e2f0c1a4 Make it clear that host-servers-migrate is a cold migration
Let's be clear in the help text that host-servers-migrate is
a cold migration since we have similar sounding commands
host-evacuate and host-evacuate-live (which is not actually
evacuate, it's live migration).

Change-Id: I17ee230fc1c29369c40492523c9d97d25f7ee023
2016-03-07 16:01:22 -05:00
Jenkins
0fc5437e5d Merge "Fix a typo in novaclient/v2/hosts.py" 2016-03-07 18:30:20 +00:00
Sven Anderson
c2ec89d285 Return a less dramatic message for public flavors.
Getting the access list of a public flavor bails out with a dramatic
error message, suggesting that something is broken.  This changes the
message to an unagitated "Access list not available for public
flavors."

Change-Id: I432496c24b23de8fa58de93f2cbed8bed1d540b1
2016-03-07 11:35:27 +01:00
Takashi NATSUME
0ee5aea617 Fix a typo in novaclient/v2/hosts.py
TrivialFix
Change-Id: I6992edbb768f14d0d4f0a7d79521876832e12714
2016-03-07 14:25:54 +09:00
Cao ShuFeng
3a538f6d86 Overwrite Usage class's get() function
base.Resource's get function will call its manager's get() function
with one parameter. However UsageManager's get function takes three
parameters.

Change-Id: I958a55c4d52cec4d1177371b788b3cf788098a6c
Closes-bug: 1552616
2016-03-06 04:21:02 +00:00