Adding support for trove new clustering datastore - percona cluster

Adding support for percona xtradb cluster server for trove.

Change-Id: Id7751f7f45817fe89ac454eb795967cb60a029c8
Co-Authored-By: Craig Vyvial <cp16net@gmail.com>
This commit is contained in:
Duk Loi 2016-02-17 14:24:10 -05:00
parent 2f1ea93f68
commit ba59637824
3 changed files with 20 additions and 22 deletions

View File

@ -174,19 +174,10 @@ class LaunchForm(forms.SelfHandlingForm):
valid_flavor = []
for ds in self.datastores(request):
# TODO(michayu): until capabilities lands
if (db_capability.is_mongodb_datastore(ds.name) or
db_capability.is_redis_datastore(ds.name)):
versions = self.datastore_versions(request, ds.name)
for version in versions:
if version.name == "inactive":
continue
valid_flavor = self.datastore_flavors(request, ds.name,
versions[0].name)
if valid_flavor:
self.fields['flavor'].choices = sorted(
[(f.id, "%s" % f.name) for f in valid_flavor])
field_name = 'flavor'
if db_capability.is_vertica_datastore(ds.name):
field_name = 'vertica_flavor'
versions = self.datastore_versions(request, ds.name)
for version in versions:
if version.name == "inactive":
@ -194,7 +185,7 @@ class LaunchForm(forms.SelfHandlingForm):
valid_flavor = self.datastore_flavors(request, ds.name,
versions[0].name)
if valid_flavor:
self.fields['vertica_flavor'].choices = sorted(
self.fields[field_name].choices = sorted(
[(f.id, "%s" % f.name) for f in valid_flavor])
@memoized.memoized_method

View File

@ -128,6 +128,8 @@ def get_size(cluster):
'RAM': sizeformat.mbformat(cluster.full_flavor.ram),
'instances': len(cluster.instances)}
return size_string % vals
elif hasattr(cluster, "instances"):
return "%s instances" % len(cluster.instances)
return _("Not available")

View File

@ -14,16 +14,21 @@
MONGODB = "mongodb"
PERCONA_CLUSTER = "pxc"
REDIS = "redis"
VERTICA = "vertica"
_cluster_capable_datastores = (MONGODB, REDIS, VERTICA)
_cluster_capable_datastores = (MONGODB, PERCONA_CLUSTER, REDIS, VERTICA)
def is_mongodb_datastore(datastore):
return (datastore is not None) and (MONGODB in datastore.lower())
def is_percona_cluster_datastore(datastore):
return (datastore is not None) and (PERCONA_CLUSTER in datastore.lower())
def is_redis_datastore(datastore):
return (datastore is not None) and (REDIS in datastore.lower())