Commit Graph

22 Commits

Author SHA1 Message Date
Hirotaka Wakabayashi 2f52b2fddb Uses glance to get image_id when creating a cluster
This PR uses glance to get a valid image_id when creating a cluster.
Clusters API currently checks the "image_id" column in "datastore_versions"
table, which has no valid image_id(NULL) since Victoria due to the
following code and docs change[1].

The original problem of this patch is that nova api throws BadRequest
exception with "Block Device Mapping is Invalid" message when creating
a cluster.

[1]: 1d24b65052

Task: 45004
Story: 2009982
Change-Id: I2a2932e261f47d9c8ec275bf9bd41b26983230c7
2022-04-22 13:41:05 +09:00
Lingxian Kong c33fa67066 Support to create public trove instance
- The users need to specify the network to create Trove instance, but
  trove-taskmanager will create port in that network for Nova instance
  creation. Using port gives Trove more capabilities to define how the
  database service is exposed.
- Deprecate ICMP protocol for the instance.
- Restrict 'nics' parameter for creating instance.
- Add 'access' parameter for creating instance.
- Add 'public_network_id' option in order to create floating IP for the
  instance.
- Do not create records for security groups, but Trove can still delete
  existing instances for backward compatibility.
- Delete unreasonable Host, Account, Storage API.

Story: 2006500
Task: 36468
Task: 36466
Change-Id: I80827e1ad5e6b130cbf94c2bb7a909c44d5cf1e5
2019-09-11 11:28:00 +12:00
Zuul 3c363d24fd Merge "Add validation for galera_common grow." 2018-01-19 05:09:47 +00:00
zhanggang fdb3977ed3 Add validate_instances_network for cluster create.
Before create instance node for a cluster, it should validate
the flavor, the volume, the quotas and the networks. But only
galera_common valdiate the network, the other datastores miss.

Change-Id: I1233b47b57e2775d19627c1c7807988ddbe16130
2018-01-10 12:22:36 +00:00
zhanggang 5bc2231325 Add validation for galera_common grow.
Currently, galera_common cluster-create do the validation before call
_create_instances. But cluster-grow does not validate it. Add validation
could avoid some risks:
1.Flavor ID, nics NotFound exception. `Instance.create` also check this,
but do this thing before `Instance.create` is better.
2.Flavor, volume, nics of all intances NotEqual exception.
3.Quotas exteed exception. Although `Instance.create` check quotas for
single instance, we should check_quotas for all instances as a unit.

Since there already has a method `_validate_cluster_instances`.
Reuse the method could reduce code redundancy, but the method is not
so "common", unlike cluster-create, there is no num_instances limits for
cluster-grow. So, this patch move "check number of instances" code to
method `create`.

Change-Id: If25c3e66fc6f4ac83e434880d3f3fe66cb1d4fff
2017-12-04 21:38:42 -05:00
Zuul 3d1fe4ab41 Merge "Add timestamp to cluster instance name" 2017-12-02 06:10:26 +00:00
jiansong 6060dacde9 cluster-create support volume_type
Now we just parse the volume_type parameter in cluster/service.py,
but it is not passed in the creat instance, which will be
supported here.

Change-Id: Iae790e54ebf1bd6cb968c3be4c3f5cd53e1082f7
Partial-Bug: #1622957
2017-11-23 19:12:23 -08:00
wangyao 6d49485770 Add timestamp to cluster instance name
According bug description, when growing a database cluster,
instance names can overlap.  To solve this problem, use
timestamp as instanceName replace of increase numbers.

Change-Id: I6849390c56a26de9df96c16dec0e1c1a6e58e097
Closes-Bug: #1642416
2017-11-09 22:58:06 +08:00
zhanggang 86497c3e69 Wrong load removed node of galera cluster.
trove/common/strategies/cluster/experimental/galera_common/api.py.
Method "shrink" in class GaleraCommonCluster,when use DBInstance.find_all
should set argument deleted=False, otherwise it may missing raise a
ClusterShrinkMustNotLeaveClusterEmpty exception.
Same problem at galera_common/taskmanager.py. Method "shrink_cluster" in
GaleraCommonClusterTasks, call DBInstance.findall() with deleted=False
to exclude deleted nodes and that can avoid a NotFound error.

Change-Id: Ibb377630b830da06485fc17a1a723dc1055d9b01
Closes-Bug: 1699953
2017-06-27 02:37:40 -04:00
Gábor Antal be5732345c Handle log message interpolation by the logger in common/strategies/
According to OpenStack Guideline[1], logged string message should be
interpolated by the logger.

[1]: http://docs.openstack.org/developer/oslo.i18n/guidelines.html#adding-variables-to-log-messages

Change-Id: I4a900a56947eae9668f3af9c7374777621dcc76a
Related-Bug: #1642552
2017-03-03 15:13:30 +01:00
Petr Malik 9bca402ec3 Add configuration support for clusters
Implement configuration attach and detach API for clusters.

Implement rolling strategy for applying configuration changes
(both attach and detach follow the same pattern).

1. Persist the changes on all nodes (leaving nodes in RESTART_REQUIRED state).
2. Update Trove records.
3. Apply changes dynamically via one or all node(s) if possible
   (and remove RESTART_REQUIRED flag from all nodes).

Notes:

  The single instance implementation has been restructured (similar to above)
  such that it always leaves the instance in one of the three states:

    a) Unchanged
    b) Changes persisted but not applied
       (Instance has configuration attached but requires restart.
        It is safe restart manually or detach the group to avoid
        any changes)
    c) Changes persisted and applied (if possible)

  This implemenation should always leave the cluster (and each instance)
  in a consistent state.
  Runtime configuration will not be changed until it is first persisted
  on all nodes.

  If there is a failure during step 1) the cluster is still running
  the old configuration. Some instances may have new configuration
  persisted, but not applied.
  The cluster will not have configuration attached unless it can
  be applied to all nodes.
  The individual nodes will have configuration attached as soon as it is
  persisted on the guest.
  It is safe to retry, reapplying the same configuration on a node is
  noop.
  It is safe to detach. Removing configuration from nodes without one
  is a noop.
  It is safe to detach the configuration from individual nodes via
  single-instance API.
  It is safe to attach the configuration to remaining nodes via
  single-instance API and rerun cluster attach to update Trove records.

  If 3) fails for whatewer reason the instances are left
  in RESTART_REQUIRED state.
  It is safe to retry or detach configuration or restart the
  instances manually.

Also fixed various minor cluster issues.

Implements: blueprint cluster-configuration-groups
Change-Id: I7c0a22c6a0287128d0c37e100589c78173fd9c1a
2017-01-19 17:13:43 +00:00
Petr Malik 6e7fa196dc Add support for cluster restart
Implement cluster rolling restart strategy.
Add support for Cassandra and PXC.

Add some missing cluster upgrade infrastructure.

Implements: blueprint cluster-restart
Co-Authored-By: Petr Malik <pmalik@tesora.com>
Co-Authored-By: Peter Stachowski <peter@tesora.com>
Change-Id: I21e654a8dd2dc6a74aa095604f78db4e96c70d64
2017-01-13 11:41:09 -05:00
Morgan Jones fa778affc8 Fix Galera_common.grow/shrink to propogate exceptions
The grow and shrink operations in Galera_common were eating exceptions.
This change passes the exceptions back and adds unit tests to
ensure such.

Change-Id: I3202d6d4daa77a8a185a427b31b2187eab4d82e9
Closes-bug: 1634627
2016-11-21 12:14:45 -05:00
Jenkins 4fbe23bc14 Merge "Remove nic handling in galera cluster grow" 2016-11-20 07:52:30 +00:00
Morgan Jones 3f93ff110b 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: Petr Malik <pmalik@tesora.com>
Change-Id: I780de59dae5f90955139ab8393cf7d59ff3a21f6
2016-11-04 15:36:16 +00:00
Duk Loi 741b86b4cd Remove nic handling in galera cluster grow
Since the nic is required to be specified in the cluster grow,
remove the unnecessary nic handling in the Galera cluster grow.

This would make it consistent with the way all the other clusters
are handling the nic parameter.

Change-Id: I136141b3db78b7a0a1804bb5e3d4ca5cf4bc3bb3
Closes-Bug: #1634629
2016-10-21 11:35:45 -04:00
Petr Malik 4573969970 Use common methods for cluster validation
Use a common set of tested utility methods for validations
in the API.

Change-Id: Icd3ea6251ef2ea2dbdaa05ae07f78bc3bd965b16
2016-09-22 13:07:47 +00:00
Peter Stachowski b928ec680a Add support for modules in cluster create/grow
When the module support was added, passing the modules to the
actual create was not done on the server side. This has been added.

Partial Bug: #1578917

Change-Id: I80c8e230f8bff550851f5cad146aa5976f45e5c4
2016-09-08 18:55:20 +00:00
Peter Stachowski 51f2655770 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 server part of this feature.
'locality' can now be added to the ReST payload for a cluster-create
command and it is passed along as a scheduler hint to Nova.

The cluster scenario tests were enhanced to test that 'affinity'
works. Testing that 'anti-affinity' fails proved to be too
time consuming, since at present the only way for a cluster to
'fail' is to timeout (and that takes 10 hours).

The server-group is checked to make sure it is created properly,
and that it has been deleted after all the related instances are gone.

DocImpact: New functionality

Partially implements: blueprint replication-cluster-locality
Depends-On: Ie46cfa69ffe6a64760aca38c495563f5724bd0d0

Change-Id: I657bf5c023d0257e462cc39f57c16eb6ee83807a
2016-07-07 21:30:10 +00:00
Victor Stinner e60db53db7 Port galera and redis cluster tests to Python 3
* Replace map() with list-comprehension or regular loop to get the
  same behaviour on Python 2 and Python 3.
* Remove test_galera_cluster and test_redis_cluster from
  blacklist-py3.txt to run them on Python 3

Partially implements: blueprint trove-python3
Change-Id: Id373a0431b98ea7687dc82a48e82f16fedaac5a0
2016-06-29 15:55:18 +02:00
Craig Vyvial 15ea555624 Fix MariaDB clusters failing with TypeError
This would apply to any type of cluster that uses the galera strategy
while setting the nics on a create call. When we called cast to set()
the object was a list of lists. The set method can not has a list so
this was causesing a unhashable error.

The change is to make the instance_nics a list of strings (what we
originaly expected) to resolve this issue.

Change-Id: I6b04f8b580720e5791e0977a9347d031cdbf9710
Closes-Bug: #1570602
2016-05-14 12:38:23 +00:00
Morgan Jones 22c9c77be7 Implement MariaDB Clustering
For MariaDB 10.1, the Galera clustering is included as part of
the base installation, so clustering for MariaDB is implemented
within the MariaDB datastore directly (rather than as a separate
datastore as was done with pxc).

Change Manifest:
- refactor galera clustering support from pxc to galera_common
- incorporate the galera_common component into MariaDB datastore
- a little cleanup of how pxc and mariadb were implementing the
  mysql_common component
- refactored pxc unittests to pxc and galera specific tests
- implemented unittests for MariaDB
- implemented clustering unittests for MariaDB
- mariadb_supported scenario tests run (except replication
  due to slave_of issues)
- cluster scenario tests run successfully

Change-Id: Ieae77cf9ff797472ef13f2532fff1e64bc654151
Implements-blueprint: mariadb-clustering
2016-03-01 03:30:34 +00:00