Commit Graph

13 Commits

Author SHA1 Message Date
Takashi Natsume 7ef2c28bf3 Use unittest.mock instead of third party mock
Now that we no longer support py27, we can use the standard library
unittest.mock module instead of the third party mock lib.

Change-Id: I4d45ae17f6f84f945f5dd049a929216ce6b6b58e
Signed-off-by: Takashi Natsume <takanattie@gmail.com>
2020-04-26 10:12:09 +00:00
zhangbailin 4d6c70d25d Microversion 2.85: Change volume-update CLI
This commit add a new CLI
``nova volume-update [--[no-]delete-on-termination]
<server> <src_volume> <dest_volume>`` to update
'delete_on_termination' for an attached volume, that the user can
decide whether to delete attached volumes when destroying the server.

Depends-On: https://review.opendev.org/#/c/711194/

Change-Id: I1fc64fb6e6611c92c6b72265e1bf4b32e9c45f0a
Blueprint: destroy-instance-with-datavolume
2020-04-09 08:52:05 +08:00
Stephen Finucane c4c44bcb2d Remove six
Mostly a find-replace job. Let's do this now so we don't have to carry
it for the next decade.

Change-Id: I7bef9fb7c6895f746cee1aca6522786f38b9857c
Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
2020-02-21 09:48:38 +00:00
zhangbailin cd396b8b61 Microversion 2.79: Add delete_on_termination to volume-attach API
Support add 'delete_on_termination' field to the voume attach API to
support configuring whether to delete the data volume when the server
is destroyed.

* Updating the ``nova volume-attachments`` command to show the
  ``delete_on_termination`` value if 2.79 or greater is used.
* The '--delete-on-termination' option is added to the `nova volume-attach`
  CLI.

Depends-On: https://review.opendev.org/#/c/673133/
Part of blueprint support-delete-on-termination-in-server-attach-volume

Change-Id: I8dcf2fd21a2fd99ca4e05bd953fbbe026be3a619
2019-09-09 12:43:42 -04:00
zhangdaolong baa23254ec Fix the inappropriate parameter name
The argument to the function should be the volume ID,
not the attachment ID.So the argument name of the
function here is easy to misunderstand.

Change-Id: Ie093b6acebe8b9e8dbdfed89856666db25bcf756
2017-07-16 23:34:57 +08:00
Takashi NATSUME e11a1266bb Microversion 2.49 - Virt device tagged attach
Change-Id: I65a2d33710f85e9b8c342d6ff4c1e4cc82990b8c
Implements: blueprint virt-device-tagged-attach-detach
2017-07-12 01:16:31 +09:00
john-griffith 428742b404 Fix help message and description for volume-update
The help for the `volume-update` command says:

update_server_volume(server_id, attachment_id, new_volume_id)
Update the volume identified by the attachment ID, that is
attached to the given server ID

Parameters:
server_id – The ID of the server
attachment_id – The ID of the attachment
new_volume_id – The ID of the new volume to attach
Return type:
Volume

But in reality the command takes an original volume and a
destination volume. The update help is also not very clear
regarding what the command actually does and the fact that
it's primarily a libvirt data migration from src volume to
destination volume.

This patch modifies the help to show the correct arguments
and also adds some more info regarding what the command
is doing.

Change-Id: Ia267285f85854976545c2a72c3729c1bfcb2c991
Closes-Bug: #1690397
2017-05-13 22:54:18 +00:00
Andrey Kurilin 65c1fbae70 Store api_version object in one place
Currently we store api_version in two places: client and
HTTPClient/SessionClient instances.

It would be nice to store it in one place, so it would be easier
to change api_version without recreating novaclient object.

Change-Id: I36369a126c20de5922141e8725834ca93d6b0a1a
2016-08-18 18:36:40 +03:00
Matt Riedemann a425702689 Remove deprecated volume(snapshot) commands/bindings
23f13437dd 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
Takashi NATSUME 209f172242 Add return-request-id-to-caller function(5/5)
Add return-request-id-to-caller function to
resources and resource managers in the following files.
The methods in the resource class and resource manager return
a wrapper class that has 'request_ids' property.
The caller can get request ids of the callee via the property.

* novaclient/v2/volume_snapshots.py
* novaclient/v2/volumes.py
* novaclient/v2/volume_types.py

Co-authored-by: Ankit Agrawal <ankit11.agrawal@nttdata.com>
Change-Id: I4de8c5cf685a5970acc92f8a58a1db26a8d9ffc7
Implements: blueprint return-request-id-to-caller
2016-01-28 11:24:03 +00:00
Matt Riedemann 23f13437dd Deprecate volume/volume-type/volume-snapshot CRUD CLIs/APIs
This deprecates all of the volume CLIs/APIs that go directly to the
cinder API via the volume service type.

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 2016.1 'M' release.

DocImpact: The volume, volume-type and volume-snapshot CRUD CLIs/APIs are
           deprecated and will be removed after the Nova 2016.1 release.
           Use python-cinderclient or openstackclient for CLIs instead.
           Use python-cinderclient or python-openstacksdk for APIs instead.

Related-Bug: #1454369

Change-Id: I4e92f924739de9b664e08117984bfb60359f2212
2015-06-02 14:14:06 -07:00
Kevin L. Mitchell 0a327ce375 Eliminate test comprehensions
The novaclient tests are rife with examples of using a list comprehension
to perform a series of asserts, when a simple for loop would be more
appropriate and more idiomatic; part of the problem is the propensity
for people to cut and paste.  Eliminating the existing examples should
remove the temptation for developers to use this non-idiom to perform
tests.

Change-Id: I2cc8979e720740eae81692a60e30a3d95dce2a2c
2015-05-21 19:12:35 -05:00
Andrey Kurilin 0a60aae852 Rename v1_1 to v2
Module novaclient.v1_1 is used as implementation of V1.1, V2 and V3.
Since future development(microversioning) will be done across V2,
implementation should be done in appropriate module(to prevent misleading).

Despite the fact that implementation for all versions are equal, discover
method for contrib path worked only for v1.1. This patch fixes this bug and
modifies shell tests to check all versions.

Change-Id: Ib6798f4dfe177586302141f522dc593560ce6a5b
2015-02-04 17:40:46 +02:00