44
44
try :
45
45
from ccmlib .dse_cluster import DseCluster
46
46
from ccmlib .cluster import Cluster as CCMCluster
47
+ from ccmlib .scylla_cluster import ScyllaCluster as CCMSCyllaCluster
47
48
from ccmlib .cluster_factory import ClusterFactory as CCMClusterFactory
48
49
from ccmlib import common
49
50
except ImportError as e :
@@ -174,8 +175,12 @@ def _get_dse_version_from_cass(cass_version):
174
175
try :
175
176
cassandra_version = Version (cv_string ) # env var is set to test-dse for DDAC
176
177
except :
177
- # fallback to MAPPED_CASSANDRA_VERSION
178
- cassandra_version = Version (mcv_string )
178
+ try :
179
+ # fallback to MAPPED_CASSANDRA_VERSION
180
+ cassandra_version = Version (mcv_string )
181
+ except :
182
+ cassandra_version = Version ('3.11.4' )
183
+ cv_string = '3.11.4'
179
184
180
185
CASSANDRA_VERSION = Version (mcv_string ) if mcv_string else cassandra_version
181
186
CCM_VERSION = mcv_string if mcv_string else cv_string
@@ -184,20 +189,27 @@ def _get_dse_version_from_cass(cass_version):
184
189
CASSANDRA_DIR = os .getenv ('CASSANDRA_DIR' , None )
185
190
186
191
CCM_KWARGS = {}
192
+ IS_SCYLLA = False
187
193
if DSE_VERSION :
188
194
log .info ('Using DSE version: %s' , DSE_VERSION )
189
195
if not CASSANDRA_DIR :
190
196
CCM_KWARGS ['version' ] = DSE_VERSION
191
197
if DSE_CRED :
192
198
log .info ("Using DSE credentials file located at {0}" .format (DSE_CRED ))
193
199
CCM_KWARGS ['dse_credentials_file' ] = DSE_CRED
200
+
194
201
elif CASSANDRA_DIR :
195
202
log .info ("Using Cassandra dir: %s" , CASSANDRA_DIR )
196
203
CCM_KWARGS ['install_dir' ] = CASSANDRA_DIR
197
- else :
204
+ elif os . environ . get ( 'CASSANDRA_VERSION' ) :
198
205
log .info ('Using Cassandra version: %s' , CCM_VERSION )
199
206
CCM_KWARGS ['version' ] = CCM_VERSION
200
-
207
+ elif os .getenv ('INSTALL_DIRECTORY' ):
208
+ CCM_KWARGS ['install_dir' ] = os .path .join (os .getenv ('INSTALL_DIRECTORY' ))
209
+ IS_SCYLLA = True
210
+ elif os .getenv ('SCYLLA_VERSION' ):
211
+ CCM_KWARGS ['cassandra_version' ] = os .path .join (os .getenv ('SCYLLA_VERSION' ))
212
+ IS_SCYLLA = True
201
213
202
214
#This changes the default contact_point parameter in Cluster
203
215
def set_default_cass_ip ():
@@ -447,10 +459,10 @@ def is_current_cluster(cluster_name, node_counts, workloads):
447
459
if CCM_CLUSTER and CCM_CLUSTER .name == cluster_name :
448
460
if [len (list (nodes )) for dc , nodes in
449
461
groupby (CCM_CLUSTER .nodelist (), lambda n : n .data_center )] == node_counts :
450
- for node in CCM_CLUSTER .nodelist ():
451
- if set (node .workloads ) != set (workloads ):
452
- print ("node workloads don't match creating new cluster" )
453
- return False
462
+ # for node in CCM_CLUSTER.nodelist():
463
+ # if set(node.workloads) != set(workloads):
464
+ # print("node workloads don't match creating new cluster")
465
+ # return False
454
466
return True
455
467
return False
456
468
@@ -559,8 +571,14 @@ def use_cluster(cluster_name, nodes, ipformat=None, start=True, workloads=None,
559
571
560
572
CCM_CLUSTER .set_dse_configuration_options (dse_options )
561
573
else :
562
- CCM_CLUSTER = CCMCluster (path , cluster_name , ** ccm_options )
574
+ if IS_SCYLLA :
575
+ CCM_CLUSTER = CCMSCyllaCluster (path , cluster_name , ** ccm_options )
576
+ else :
577
+ CCM_CLUSTER = CCMCluster (path , cluster_name , ** ccm_options )
563
578
CCM_CLUSTER .set_configuration_options ({'start_native_transport' : True })
579
+ if IS_SCYLLA :
580
+ CCM_CLUSTER .set_configuration_options ({'experimental' : True })
581
+
564
582
if Version (cassandra_version ) >= Version ('2.2' ):
565
583
CCM_CLUSTER .set_configuration_options ({'enable_user_defined_functions' : True })
566
584
if Version (cassandra_version ) >= Version ('3.0' ):
@@ -574,9 +592,9 @@ def use_cluster(cluster_name, nodes, ipformat=None, start=True, workloads=None,
574
592
575
593
# This will enable the Mirroring query handler which will echo our custom payload k,v pairs back
576
594
577
- if 'graph' not in workloads :
578
- if PROTOCOL_VERSION >= 4 :
579
- jvm_args = [" -Dcassandra.custom_query_handler_class=org.apache.cassandra.cql3.CustomPayloadMirroringQueryHandler" ]
595
+ # if 'graph' not in workloads:
596
+ # if PROTOCOL_VERSION >= 4:
597
+ # jvm_args = [" -Dcassandra.custom_query_handler_class=org.apache.cassandra.cql3.CustomPayloadMirroringQueryHandler"]
580
598
if len (workloads ) > 0 :
581
599
for node in CCM_CLUSTER .nodes .values ():
582
600
node .set_workloads (workloads )
0 commit comments