Commit Graph

45 Commits

Author SHA1 Message Date
Lingxian Kong 99126428ce Support role for listing instances
Change-Id: Ia3e8d5d65bc134f3c7bc62ca9c170018be54660c
2020-06-03 15:23:55 +12:00
Lingxian Kong 27cf71299e Remove flavor API
Change-Id: I5a35911b5658fdf6bc08844b31cc1325b749526a
2020-05-08 00:30:49 -06:00
Sean McGinnis 2b8282bb1e
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: Ib83e626f51e6e01898bb7931c1660a1a548500f3
Signed-off-by: Sean McGinnis <sean.mcginnis@gmail.com>
2020-04-18 11:59:46 -05:00
Andreas Jaeger e96e99f1ec Update hacking for Python3
The repo is Python 3 now, so update hacking to version 3.0 which
supports Python 3.

Fix problems found.

Change-Id: I5da442bb2f1e634e6b3fe37a6ea3820cea1db96f
2020-03-31 13:33:41 +02:00
Lingxian Kong 7a791177e8 Get all the database instances by admin
Currently, there is no way for the admin user to get databases of all
the projects, which is very important for auditing or billing purpose.

With this change, admin user can get all the database instances by
running:

$ openstack database instances list --all-projects

Change-Id: I318907b1d4a63017f4a6f7967312770f8784c1f4
Story: #2005735
Task: #33393
2019-05-21 00:12:14 +12:00
Chuck Short 78946925b6 Replace assertRaisesRegexp with assertRaisesRegex
This replaces the deprecated (in python 3.2) unittest.TestCase method
assertRaisesRegexp() with assertRaisesRegex().

Change-Id: Ib260a6549a7a957fc1b91b89156a676922142b04
Signed-off-by: Chuck Short <chucks@redhat.com>
2018-08-27 11:03:00 -04:00
Marcin Piwowarczyk 9e737a2cf8 Support configuration groups for clusters
Handles API part implemented in change:
I7c0a22c6a0287128d0c37e100589c78173fd9c1a

So far passing configuration group was possible only for single instance
deployment.

As the trove api now already supports configuration attach and detach
for clusters, we are able to handle it in client.

Configuration will be applied to each cluster instance.

Partially implements: blueprint cluster-configuration-groups
Change-Id: Ic0840c995cbc34203c76494d7ba522f3e17141a7
Signed-off-by: Marcin Piwowarczyk <m.piwowarczy@samsung.com>
2018-08-07 08:25:39 +02:00
zhanggang 4d58f2e019 Add extended properties support for mongo cluster.
User can specify the number and volume of mongos/configserver with
extended_properties argument when creating mongodb. Currently,
the supported parameters are, num_configsvr, num_mongos,
configsvr_volume_size, configsvr_volume_type, mongos_volume_size
and mongos_volume_type.

Change-Id: I35406f9967ce00a51b320eda37572e96228b209d
Signed-off-by: zhanggang <zhanggang@cmss.chinamobile.com>
2018-07-31 14:48:02 +08:00
Zhao Chao 0fc7d9e33d Correctly mocking builtin open in test_v1_shell
There's now a seperate module 'builtins' from python-future(this package
is now installed by stestr, and stestr in required by oslotest-3.6.0),
so under Python 2.x 'builtins' is also imported as a module and
'bultins.open' is mocked instead of '__builtin__.open'. And according to
the Mock document, we should always patch the object where it's looked
up, so only necessary mocking is made in this patch.

Change-Id: I57ea61cefd3b01b19475b0fa7e16f716eaaa14e6
Signed-off-by: Zhao Chao <zhaochao1984@gmail.com>
2018-07-10 14:26:02 +08:00
int32bit 457cefa90d Remove extra parameter 'backup' in backup-create
The parameter 'backup' in backup-create is never read by our Trove API[1], so
I guess it's a extra key argument for history reason. In addition, the
'backup-copy' subcommand should be removed as well because it does not
support in current Trove API.

[1] https://github.com/openstack/trove/blob/master/trove/backup/service.py#L61-L77

Change-Id: I33d439e0037efd4573eeae186758fd778ba5c514
2017-08-22 14:41:51 +08:00
Jenkins 53f3ac1378 Merge "Client changes for datastore-version volume-types" 2017-04-11 07:12:44 +00:00
Peter Stachowski 7c0d2c23c3 Add support for module-reapply command
To facilitate the concept of live-update, a new command
'reapply' has been added to reapply a given module
to all instances that it had previously been applied to.

Originally, a module designated live-update would automatically
be re-applied whenever it was updated.  Adding a specific
command however, allows operators/users more control over
how the new payload would be distributed.  Old 'modules'
could be left if desired, or updated with the new command.

Change-Id: Ic4cc9e9085cb40f1afbec05caeb04886137027a4
Partial-Bug: #1554903
Depends-On: I4caf4a57226dd711575cde766076fa25d16792e2
2017-01-05 00:12:32 +00:00
Peter Stachowski 714c6e781c Add module-instance-count command
Added a --count_only flag to the call for module instances
to return a summary of the applied instances
based on the MD5 of the module (this is most useful
for live_update modules, to see which ones haven't been
updated).

Added a new module-instance-count command.  This was done
to facilitate getting the summary, since it returns
a different result set.  It basically calls the
same python interface as module-instances, but adds
the --count_only flag.

Also added some missing tests.

Change-Id: Iea661166bf3a4f3520a590da5954aedcd0036243
Partial-Bug: #1554900
Depends-On: I4caf4a57226dd711575cde766076fa25d16792e2
2017-01-05 00:11:59 +00:00
Matt Van Dijk ce737378a5 Client changes for datastore-version volume-types
Add trove client support for new volume-types listing and datastore
version association listing.

Co-Authored-By: amrith <amrith@tesora.com>
Change-Id: Iafcd8d068b85c1993fac0471c04e57478c122bfe
Depends-on: I790751ade042e271ba1cc902a8ef4d3c3a8dc557
2016-11-29 12:21:00 -05:00
Morgan Jones 9d3098ebaf Cluster Upgrade
Implements the Clusters.upgrade python API and corresponding
shell command.

Implements blueprint: bp/cluster-upgrade

Change-Id: Iedb08c99bf8eb2a0b0d09e3c1ebd11965fdfff90
2016-11-09 16:33:48 -05:00
Trevor McCasland ca9be53870 Throw correct error on creation of size 0
When trying to create an instance of size 0 an error is thrown
stating that the size was not specified, this is not correct
because I did specify it. The problem is that args.size evaluates
to False because size is 0.

This patch checks for size being zero instead and throws the correct
error message.

Change-Id: If00e83ccd919429dcfac7621dbbd9daa49f8b416
2016-09-30 09:08:04 -05:00
Jenkins 8c1fee10cd Merge "Add --incremental flag to backup-create" 2016-08-25 08:35:27 +00:00
Ali Adil 2844f453cc Add --incremental flag to backup-create
Added --incremental flag to backup-create and set the default
value to False. When the flag is passed it will create a
backup based on the last good known full/incremental backup.
If there is no previous backup a full backup will be created.

Change-Id: I96498180890b8b1692b1bac3b19988532f6eb077
Partial-Bug: #1607429
2016-08-25 05:31:48 +00:00
Peter Stachowski 8607ca8358 Add support for module ordering on apply
Client side of being able to specify 'priority' modules plus a
way to rank the order in which modules are applied.  Two new
attributes 'priority_apply' and 'apply_order' have been added
to the python API and are supported in the CLI by means of the
module-create and module-update commands.

Partially Implements: blueprint module-management-ordering

Change-Id: I2b871c7d1eab634174396bd0905329f3a66755f6
2016-08-25 04:10:18 +00:00
Jenkins cbf9d92d82 Merge "Add command to delete BUILD instances and clusters" 2016-08-24 23:37:17 +00:00
Ali Adil 39daba1e9d Add command to delete BUILD instances and clusters
Sometimes an instance/cluster can be stuck in BUILD state forever.
Attempting to delete the instance in this state is currently not
allowed. Add force-delete and reset-status command. Reset-status
will reset the status to ERROR, letting the instance/cluster be
deleted. Force-delete will combine functionality of reset-status
and delete.

Change-Id: I957b4be5030e493e0eb8c6b6855d41b942b2823c
Partial-Bug: #1579141
2016-08-17 19:05:07 +00:00
Morgan Jones 4f3ab58687 Implement Instance Upgrade
This change includes a new "trove upgrade" CLI command and
a new "Instances.upgrade" python API method to implement
the new Instance Upgrade feature.

Change-Id: I6ec2ebb78019c014f87ba5d8cbfd284686c64f30
Implements: blueprint image-upgrade
2016-08-16 14:44:29 +00:00
Peter Stachowski f067cf83c2 Support flavor ids with leading '0'
When Trove moved to support alphanumeric flavor ids, the case of having
a numeric string id with leading zeros was not taken into account. The
behavior on the client side is to see if the id is all digits, and if so
it is converted to an int. That means that a flavor of '01' will be
incorrectly interpreted as '1'.

This behavior has been fixed and unit tests created.

Change-Id: I5acdec576a2e7da6cbfbb1cfc61c49fbbf7379af
Partial-Bug: #1603187
2016-07-14 22:33:28 +00:00
Peter Stachowski db85939433 Locality support for clusters
In order to allow clusters to be all on the same hypervisor
(affinity) or all on different hypervisors (anti-affinity) a new
argument (locality) needed to be added to the Trove cluster-create API.

This changeset addresses the Trove client part of this feature.
A --locality flag is now available on the 'cluster-create' command and
is passed to the server for processing.

Partially implements: blueprint replication-cluster-locality
Change-Id: Ie46cfa69ffe6a64760aca38c495563f5724bd0d0
2016-06-21 19:30:00 +00:00
Peter Stachowski 358dbf3c80 Locality support for replication
In order to allow replication sets to be all on the same hypervisor
(affinity) or all on different hypervisors (anti-affinity) a new
argument (locality) needed to be added to the Trove create API.

This changeset addresses the Trove client part of this feature.
A --locality flag is now available on the 'create' command and
is passed to the server for processing.

The --replica_count argument was also cleaned up in that it's not
passed on unless it is set. If --replica_of is specified, the
default is set to '1.'

DocImpact: New functionality

Partially implements: blueprint replication-cluster-locality
Change-Id: I18f242983775526a7f1e2644302ebdc0dac025cf
2016-05-02 22:18:53 +00:00
Jenkins 1084741cd0 Merge "Allow use of backup name in trove create" 2016-04-18 18:59:08 +00:00
Sushil Kumar 6b2fad5670 Allow use of backup name in trove create
'trove create' only accepts a backup id as a value
when restoring an instance from a backup. This change
enables the use of the backup name as well.

A few minor typos were fixed as well to make the output
more consistent.

Co-authored-by: Sushil Kumar <skm.net@gmail.com>
Co-authored-by: Peter Stachowski <peter@tesora.com>
Change-Id: I01f9ba96c8bdec5cfa4c4b477eb824b4456774d1
Closes-Bug: #1513636
2016-04-05 18:06:16 +00:00
Peter Stachowski 967f0ff837 Fix inadvertent generation of file during tox test
When running py27 or py34 tox tests, a '4321_4321_4321.dat' file is
created and not cleaned up. This is due to a missing mock in the
module_retrieve test.

The 'open' method is now mocked and the file is not created.

Change-Id: I8e2524961b3cb2ac01b65d5ce11d476ad3a81662
Closed-Bug: #1565959
2016-04-04 19:09:25 +00:00
Peter Stachowski 457360c69f Client support for instance module feature
This adds support in the python API and Trove CLI
for instance module commands.  These commands include:

    - module-apply
    - module-remove
    - module-query
    - module-retrieve
    - module-list-instance

The parsing of --instance was modified to allow multiple
modules to be specified.  This was extended to 'nics' as well.

Partially Implements: blueprint module-management
Change-Id: If62f5e51d4628cc6a8b10303d5c3893b3bd5057e
2016-03-11 18:10:50 -05:00
Jenkins c0cd9d7f72 Merge "Add root-disable api" 2016-01-15 23:17:59 +00:00
Duk Loi e776382c93 Add root-disable api
Add api entry points for root-disable to the Trove client.

Added unit tests.

Change-Id: I27831eb361c2b219a9623f152b9def73a2865d67
Partially implements: blueprint root-disable
DocImpact: added new root-disable CLI command
2015-12-10 11:23:53 -05:00
Jenkins 7af776d06f Merge "cluster create passing availability zone incorrectly" 2015-12-04 23:35:00 +00:00
Petr Malik 6473e50a6a Add 'volume_type' parameter to instance create
An optional Cinder volume-type parameter was added to the instance
create command.
Also allow for 'volume_type' parameter in cluster create.

Note:
Had to change the way arguments get split.
Splitting by just 'volume' would conflict with
the 'volume_type' property.

Change-Id: Ied40b30ca738d815ca0a57971bb59f29ddc20b91
Implements-Blueprint: volume-type-on-create
2015-12-03 17:03:11 -05:00
Craig Vyvial 6619050101 cluster create passing availability zone incorrectly
Change the instance availability-zone to availability_zone.

Closes-Bug: #1520749
Change-Id: I319cf2d631147a953c11d374dd19a413e6e6635f
2015-11-28 03:02:50 -06:00
Saurabh Surana 780b3a38c6 Accepting network and availability zone for instances in cluster
Standalone instance create call in trove already accepts neutron
networks and availability zone information.

In the similar manner, instances which are part of the cluster can
now be supplied with a specific neutron network information and
availability zone.

Instance parameter now includes flavor_id, volume, network
and availability_zone.

We are now spliting the cluster create arguments by trove cluster
arguments. Then dealing with each sub-parameters individually.

Co-Authored-By: Saurabh Surana <saurabh.surana@hp.com>
Co-Authored-By: Sharika Pongubala <sharika.pongubala@hp.com>
Change-Id: I25af22d3a48b728e59d93f959cf8646d54973d2e
Partial-Bug: #1447350
2015-10-08 06:30:56 +00:00
Jenkins 7132f5ff78 Merge "Root enablement for Vertica clusters/instances" 2015-09-04 20:59:26 +00:00
Jenkins e06672eebc Merge "Use more appropriate exceptions for validation" 2015-09-04 05:03:19 +00:00
sharika 153353ce9a Root enablement for Vertica clusters/instances
Adds support for root-enable for Vertica clusters,
with optional user-provided passwords.

Fixes backward compatibility issue.

Implements blueprint: vertica-cluster-user-features
Change-Id: I3e23c87c0e48a7f910e54207116fc75b5ce0ad0c
2015-09-03 21:00:24 +00:00
Petr Malik 55af7dd364 Use more appropriate exceptions for validation
Use ValidationError exception type for input validation errors.

Change-Id: I5ab58fd64f4745a2e558392bff649b05401ed57a
Closes-Bug: 1482279
2015-09-03 20:41:25 +00:00
Morgan Jones d95cefff2a Redis Clustering Initial Implementation
Implements the CLI and python-API methods to support the
clustering commands, including the new cluster scaling
commands.

Change-Id: Icc9b4eea8ed7db1455692823d29586088cfc9434
Implements: blueprint redis-cluster
2015-09-03 14:49:38 -04:00
Amrith Kumar 7ec45dba07 Revert "Root enablement for Vertica clusters/instances"
This reverts commit 77960eecb6.

Change-Id: I7498169a846f6d8544c1dfbc2f5ca7bad0de0ba8
2015-08-28 00:02:45 +00:00
sharika 77960eecb6 Root enablement for Vertica clusters/instances
Adds support for root-enable for Vertica clusters,
with optional user-provided passwords.

Implements blueprint: vertica-cluster-user-features
Depends on: I0a39cae53b371d1a89a6abbf93d026b16a665ed8

Change-Id: Ic9d81ab0e840d699c052c6b0fdccaeec5d69a5b4
2015-08-20 15:38:20 -07:00
Masaki Matsushita 7f82bccba9 Make subcommands accept flavor name and cluster name
This change makes following subcommands accept flavor name and cluster
name.

- create
- cluster-create
- cluster-delete
- resize-instance

The change also remove resize-flavor command.

DocImpact
Closes-Bug: #1463274
Change-Id: I4da69280987ce8d6da33da0c7fb1ec8b35abe25d
2015-07-10 10:05:21 +09:00
Masaki Matsushita 29d0703de1 Fix flavor-show problems with UUID
flavor-show fails if the flavor's ID is in the form of UUID
and user specified its name.
The change in troveclient/v1/shell.py#L92-L95 is from Sushil Kumar.

Closes-Bug: #1467383
Change-Id: Ie838796191a06193a59499da59fae79b9d9f060f
2015-06-29 10:13:12 +09:00
Sushil Kumar 61a756a014 Added more unit-tests to improve code coverage
Following files were too low on code coverage,
so the coverage has been enhanced with addition of more unit-tests.
- troveclient/client.py
- troveclient/v1/shell.py

The methodology to test shell.py has been motivated from the
one used by python-novaclient to test novaclient/v2/shell.py

Also, found an unmocked entry in test_secgroups.py,
which was causing intermittent failure while
writing the tests for shell.py.

Closes-Bug: #1455856
Change-Id: I6a148fb5caad6a83b6ac23411b6458f231064ead
2015-06-08 10:51:40 +00:00