Skip to content

Commit

Permalink
Closes-Bug: #1591449
Browse files Browse the repository at this point in the history
When we moved to use cqlsh from cassandra-cli, we didn't change the port.
When we moved to use ContrailAnalyticsCql from ContrailAnalytics, we didn't
take care in drop_analytics_keyspace. And the ip used is control_ip and
not mgmt_ip.

Change-Id: Idc058a750dc34cf1930a3a3c53d7acf49f48ed36
(cherry picked from commit 5d8e120)
  • Loading branch information
Raj Reddy committed Jun 14, 2016
1 parent 80fa21d commit f9eaf67
Showing 1 changed file with 17 additions and 4 deletions.
21 changes: 17 additions & 4 deletions fabfile/tasks/services.py
Expand Up @@ -6,6 +6,7 @@
get_esxi_contrail_vms
from fabric.contrib.files import exists
from fabfile.utils.host import hstr_to_ip
from fabfile.utils.host import get_control_host_string

@task
@roles('cfgm')
Expand Down Expand Up @@ -429,12 +430,24 @@ def reboot_nova_instance():
@task
def drop_analytics_keyspace_node(*args):
for host_string in args:
with settings(host_string=host_string):
CASSANDRA_CMD = 'cqlsh %s 9160 -f ' % hstr_to_ip(host_string)
with settings(host_string=host_string, warn_only=True):
CASSANDRA_CMD = 'cqlsh %s -f ' % hstr_to_ip(get_control_host_string(host_string))
print "Dropping analytics keyspace.. this may take a while.."
sudo("echo 'drop keyspace \"ContrailAnalytics\";' > /tmp/cassandra_commands_file")

sudo("echo 'describe keyspace \"ContrailAnalytics\";' > /tmp/cassandra_commands_file")
if sudo(CASSANDRA_CMD + '/tmp/cassandra_commands_file').succeeded:
sudo("echo 'drop keyspace \"ContrailAnalytics\";' > /tmp/cassandra_commands_file")
if not sudo(CASSANDRA_CMD + '/tmp/cassandra_commands_file').succeeded:
print "WARN: Drop keyspace ContrailAnalytics failed.."
else:
print "INFO: keyspace ContrailAnalytics is dropped.."
print "INFO: if snapshots are created, manual deletion may be required to free up disk.."
sudo("echo 'drop keyspace \"ContrailAnalyticsCql\";' > /tmp/cassandra_commands_file")
if not sudo(CASSANDRA_CMD + '/tmp/cassandra_commands_file').succeeded:
print "WARN: Drop analytics keyspace failed.."
print "WARN: Drop keyspace ContrailAnalyticsCql failed.."
else:
print "INFO: keyspace ContrailAnalyticsCql is dropped.."
print "INFO: if snapshots are created, manual deletion may be required to free up disk.."

@task
@roles('build')
Expand Down

0 comments on commit f9eaf67

Please sign in to comment.