Commit Graph

205 Commits

Author SHA1 Message Date
Hirotaka Wakabayashi 4815692d8c Uses the "network_id" param creating a cluster
This PR replaces a request parameter name "net-id" with "network_id"
creating a cluster. When creating a cluster, Clusters API internally
calls Instaces API to create a instance. A request parameter name to
create instances has changed[1] but python-troveclient still uses
old parameter name when creating a cluster.

The original problem is instance creation error when creating a
instance that belongs to a cluster. Troves's Instances API has
changed a parameter name from "net-id" to "network_id", but Clusters
API and python-troveclient still uses the "net-id" parameter name.
We need to fix it.

[1]: 5354172407

Task: 44925
Story: 2009958
Change-Id: Ia3d1d6f451296eba34f2389da184c41a7ee9e84e
2022-04-09 18:07:58 +00:00
Lingxian Kong c04e299b1d Revert "Remove flavor API"
Story: 2008341
Task: 41242

This reverts commit 27cf71299e.

Change-Id: I036a0423263b1a0332415c6403647ae82c9e34c4
2020-11-13 20:53:10 +13:00
Hervé Beraud e2bf7cff22 Stop to use the __future__ module.
The __future__ module [1] was used in this context to ensure compatibility
between python 2 and python 3.

We previously dropped the support of python 2.7 [2] and now we only support
python 3 so we don't need to continue to use this module and the imports
listed below.

Imports commonly used and their related PEPs:
- `division` is related to PEP 238 [3]
- `print_function` is related to PEP 3105 [4]
- `unicode_literals` is related to PEP 3112 [5]
- `with_statement` is related to PEP 343 [6]
- `absolute_import` is related to PEP 328 [7]

[1] https://docs.python.org/3/library/__future__.html
[2] https://governance.openstack.org/tc/goals/selected/ussuri/drop-py27.html
[3] https://www.python.org/dev/peps/pep-0238
[4] https://www.python.org/dev/peps/pep-3105
[5] https://www.python.org/dev/peps/pep-3112
[6] https://www.python.org/dev/peps/pep-0343
[7] https://www.python.org/dev/peps/pep-0328

Change-Id: I73b532283079d346b75a925e2aee707c4de8fa9e
2020-06-02 20:54:04 +02:00
Lingxian Kong 27cf71299e Remove flavor API
Change-Id: I5a35911b5658fdf6bc08844b31cc1325b749526a
2020-05-08 00:30:49 -06:00
Lingxian Kong adde0d0bed Support log tail/save for instance
Support to show log content and save instance log files:

  openstack database log tail [--lines LINES] <instance> <log_name>
  openstack database log save [--file FILE] <instance> <log_name>

Change-Id: I2a4eecca663f9126f770fae4c4be28b3667f91c4
2019-12-16 15:21:25 +13:00
Lingxian Kong f5a57732a9 Support log actions in osc plugin
- openstack database log show <instance_id> <log_name>
- openstack database log set <instance_id> <log_name>
  [OPTIONS]

Change-Id: I86f414a53e6f6416f96e0040635bb010aa49cf41
2019-12-16 13:41:30 +13:00
ZhijunWei 463eab47e4 Update hacking version
1. update hacking version to latest
2. fix pep8 failed

Change-Id: I49a6d46466b06bd56bed1f15632c9c80ef539b38
2019-01-02 23:57:05 +08:00
zhanggang 0ce6255bfd Sync two parameters of cluster-create to OSC
The previous patches have add configuration and extended_properties
to "trove cluster-create"[1][2], this commit add the two paramenters
to OSC, user can pass configuration and extended_properties during
"openstack database cluster create".

[1] https://review.openstack.org/#/c/583125/
[2] https://review.openstack.org/#/c/589047/

Change-Id: Ic8e3ba4e92d3b65fa65875675f58eead5827976a
Signed-off-by: zhanggang <zhanggang@cmss.chinamobile.com>
2018-08-21 19:06:11 +08: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
Nguyen Hung Phuong 5757f3a1f6 Clean imports in code
In some part in the code we import objects. In the Openstack style guidelines
they recommend to import only modules. [1]: "Do not import objects, only modules".

[1] https://docs.openstack.org/hacking/0.10.3/

Change-Id: I8dd5396ab604013639a0b626ce3ecd3e3fad12e8
2018-02-21 16:33:43 +07:00
Zuul c638e2173d Merge "Fix error with configuration-parameter-show" 2017-12-25 20:43:54 +00:00
Zuul 455e334a47 Merge "Use ID instead of Name in secgroup_delete_rule" 2017-12-21 09:50:03 +00:00
wangyao e3a7d83ea1 Fix error with configuration-parameter-show
According bug description, there will be an error when
use  configuration-parameter-show without version_id
and datastore. To fix this problem, I add an judgement
for use the cmd without parameter datstore and
datastore_version not like an uuid.

Now in such a case, the cmd will has an exception info.

Change-Id: I01fd56bad80f389da369be90dff5c89b05e6a8dc
Closes-Bug: #1363065
2017-12-21 16:46:06 +08:00
Zuul f92e624653 Merge "Support delete and cluster_delete with many resources" 2017-12-21 06:36:21 +00:00
zhanggang 4ae174ddaf Use ID instead of Name in secgroup_delete_rule
In trove secgroup_delete_rule help message, the parameters
<security_group_rule> is described "Name of security group rule".
In fact, security group rule has not attribute 'name', it only has
'id'.
Users could use trove secgroup-list-rules to get all ID of rules.

Change-Id: If5b97f744b24838e6aa61f4c96608da569886dd2
2017-12-20 23:35:10 -05:00
wangyao 3d9576bfa5 Support delete and cluster_delete with many resources
Not like nova-delete when use trove-delete there is only support
delete an instance everytime. With this patch, we can delete
many instances or clusters in the same call, like
trove delete instance1 instance2.

Change-Id: I6bb0c406ba7f4c0e43cddfdff1d156b7e82ffa7a
2017-12-21 10:44:24 +08:00
Zuul b0e4b924ff Merge "Fix datastore abnormal display with trove list" 2017-12-20 23:22:37 +00:00
wangyao b7d40c2a52 Fix datastore abnormal display with trove backup-show
According bug description, the datastore display abnormal
when use trove backup-show.  The cause of the problem
is method _print_object unformatted datastore from result.

Fix by formatted datastore where necessary.

Change-Id: Ifbcc8312e52eb3d052f5d24645d4d243ec50aed7
Closes-Bug: #1735157
2017-11-29 19:53:55 +08:00
wangyao b626a08450 Fix datastore abnormal display with trove list
According bug description, the datastore display abnormal
when use trove list.

Change-Id: Ia1dda1c2fb6822ea991afbdf3a67819c262e49a8
Closes-Bug: #1734846
2017-11-28 18:02:51 +08:00
Zuul 7e14c4f2b0 Merge "Fix networks abnormal display with trove show" 2017-11-27 21:54:40 +00:00
wangyao fe1c727551 Fix networks abnormal display with trove show
According bug description, the networks display abnormal
when use trove show. The cause of the problem is method
_print_instance unformatted networks from result.

Change-Id: I30e27b731f67ab7c31e30af8ab9bb3e499e27dfa
Closes-Bug: #1734710
2017-11-27 23:39:36 +08:00
Zuul 34dbdd2198 Merge "Add proper message when delete instance or cluster" 2017-11-17 02:08:53 +00:00
Zuul a05be72736 Merge "Remove extra parameter 'backup' in backup-create" 2017-11-11 06:30:18 +00:00
wangyao c4d21897f5 Add proper message when delete instance or cluster
According bug description, not like nova-delete when use trove-delete
there is no message or alert is generated. To solve this problem, I
added some message when normally execute deleting instance or cluster.

Change-Id: I572a24116fd1abec220f49a3f9705a5c071155bf
Closes-Bug: #1569669
2017-11-10 23:14:25 +08:00
Zuul 484b8a82d4 Merge "ESFIX:Fix troveclient error with Chinese character" 2017-11-08 23:07:38 +00:00
wlhc 7e209a4c32 Fix "trove module-instances" command which don't work.
The "trove module-instances" command don't work.

cat <<EOF>> myping.data
message=Module.V1
EOF

trove module-create myping ping myping.data

trove module-apply \
      7d95769f-1912-4e77-8b86-d9a4eb48cd2e myping
trove module-instances myping
ERROR: Module with ID 7d95769f-1912-4e77-8b86-d9a4eb48cd2e \
could not be found.

Change-Id: I30c2e698bd1ea90cc8fdf0dc5e3a5b087ca2bec2
Closes-Bug: #1664472
2017-11-06 08:51:52 +00:00
jiansong fd076ed1ba ESFIX:Fix troveclient error with Chinese character
Now troveclient does not support returning Chinese characters, so
to make changes.This should also avoid other unicode output
problems

Change-Id: Ie948cff4e81806f17c697f50271992cc492c48f4
Closes-Bug: #1720490
2017-11-03 11:15:45 +00: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 8aaa4e81aa Merge "Add related_to help message for instance help" 2017-06-15 04:30:55 +00:00
Jenkins 3ef2b4212f Merge "Update reset-status docstring" 2017-06-11 01:34:25 +00:00
jiansong 7d00721475 Add related_to help message for instance help
We have been change the mongodb cluster scaling related changes
in the Liberty version[1], as mongodb cluster grow the necessary
variables,we should displayed in the help message to expose it,
rather than hide it. So made this change.

[1]:https://specs.openstack.org/openstack/trove-specs/specs/liberty/cluster-scaling.html#cluster-grow

Change-Id: I45f5702f7645aa7855f8140bcd5ec83e2c76eeae
2017-06-05 02:11:10 +00:00
Petr Malik e923fb1fc2 Enable user/db operations on clusters
Accept cluster ids in user and database API and
route the requests on the single instance interface.

Implements blueprint: datastore-specific-api-extensions
Change-Id: I9cfa048cdee7c9eb18787957fb69e14e05dd4128
2017-04-18 16:20:11 +00:00
Jenkins 53f3ac1378 Merge "Client changes for datastore-version volume-types" 2017-04-11 07:12:44 +00:00
Ali Adil d2c24f98d4 Update reset-status docstring
Added more information for reset-status docstring.

Change-Id: I4ab194029e5bfbca990984be707f727081bf5907
2017-01-16 11:05:38 -05:00
Jenkins e2a2263e19 Merge "Add support for module-reapply command" 2017-01-09 21:39:07 +00:00
Jenkins d857e713b4 Merge "Allow type to be specified on cluster-create" 2017-01-05 05:51:57 +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
Jenkins d273969fa3 Merge "Fix module-list" 2017-01-04 21:14:53 +00:00
Peter Stachowski fb4064d39e Fix module-list
Under a keystone V3 scenario, the CLI command for
module-list will fail as it tried to determine whether
to display the 'visible' and 'tenant' fields (which only
make sense to show to an admin).

Keystone V3 stores the role information (used to find
out if the user has admin access) in a different
place than V2.  This fix uses a keystoneauth1 property
to have the value determined correctly internally,
so trove doesn't have to worry about it.

The logic was also moved to the utils module to
faciliate reuse.

Closes-Bug: #1622019
Change-Id: I6dbc3660b507017f85d06bde2903f4d2334fea35
2016-12-22 08:08:16 -08:00
Jenkins 20eb0a4bd1 Merge "Cluster Upgrade" 2016-12-10 15:55:42 +00:00
Peter Stachowski 916bb8278b Allow type to be specified on cluster-create
Authored-By: Peter Stachowski <peter@tesora.com>
Change-Id: I209a1883943e143b0ea66f6a08bb7e308aa516f3
2016-12-09 17:38:44 -05: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
Jenkins 857f2496ff Merge "Added limit/marker support for config group lists" 2016-11-21 11:03:44 +00:00
Morgan Jones aed18902d0 Multi-Region Support
This is an initial attempt at supporting multiple regions.  It should
handle the mechanics of deploying an instance/volume to a remote
region.  Additional changes may be required to allow the guest
agent on the instance to connect back to the originating region.

Co-Authored-By: Doug Shelley <doug@tesora.com>
Depends-On: I386efb2d5c147417af7ea25704405977c9b6bbcd
Change-Id: Ib0b35100c0780dc07c60d20622554ba77c4bc850
2016-11-17 01:28:54 +00: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
Duk Loi 2377c0ca55 Added limit/marker support for config group lists
Added support in the CLI for limit and marker to the
configuration-list and configuration-instances command.

Changed the python API to use the _pagination function
instead of _list.

Modified the unit tests to test this change.

Change-Id: I46d8258eab81d1510707244547e31cd5707a22ce
Closes-Bug: bug/1638352
2016-11-02 17:47:10 -04:00
Trevor McCasland cd61fe3b37 Add i18n to v1/shell.py
Help, print, and exception messages will now all be translated. I
did not find any logging messages.

Motivation for this change:
    1. A patch for shell.py recently added i18n, we should be
       consistent with the additions from v1.
    2. I noticed a patch on v1/shell.py that had reviewers suggesting
       to use i18n, instead of applying it to one message lets do it
       for the whole file.

Change-Id: Ifd1bf25020c5f180a074165e2634a105bcbd4ed8
2016-10-18 15:56:36 +00: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