Permalink
Browse files

Add drain command

  • Loading branch information...
1 parent 5ae7056 commit 4fbdfa2a42915be67304a6171aefff8fce510342 @pcmanus committed Jul 17, 2012
Showing with 20 additions and 3 deletions.
  1. +3 −0 ccmlib/cluster.py
  2. +7 −2 ccmlib/cmds/cluster_cmds.py
  3. +6 −0 ccmlib/cmds/node_cmds.py
  4. +4 −1 ccmlib/node.py
View
@@ -304,6 +304,9 @@ def flush(self):
def compact(self):
self.nodetool("compact")
+ def drain(self):
+ self.nodetool("drain")
+
def repair(self):
self.nodetool("repair")
@@ -108,7 +108,7 @@ def get_parser(self):
help="Set the storage (cassandra internal) host and port for the node (format: host[:port])")
parser.add_option('-j', '--jmx-port', type="string", dest="jmx_port",
help="JMX port for the node", default="7199")
- parser.add_option('-r', '--remote-debug-port', type="string", dest="remote_debug_port",
+ parser.add_option('-r', '--remote-debug-port', type="string", dest="remote_debug_port",
help="Remote Debugging Port for the node", default="2000")
parser.add_option('-n', '--token', type="string", dest="initial_token",
help="Initial token for the node", default=None)
@@ -154,7 +154,7 @@ def get_parser(self):
help="Number of nodes to populate with (a single int or a colon-separate list of ints for multi-dc setups)")
parser.add_option('-d', '--debug', action="store_true", dest="debug",
help="Enable remote debugging options", default=False)
- return parser
+ return parser
def validate(self, parser, options, args):
Cmd.validate(self, parser, options, args, load_cluster=True)
@@ -388,6 +388,11 @@ class ClusterCompactCmd(_ClusterNodetoolCmd):
nodetool_cmd = 'compact'
descr_text = "Compact all (running) node of the cluster"
+class ClusterDrainCmd(_ClusterNodetoolCmd):
+ usage = "usage: ccm cluster drain [options] name"
+ nodetool_cmd = 'drain'
+ descr_text = "Drain all (running) node of the cluster"
+
class ClusterStressCmd(Cmd):
def description(self):
return "Run stress using all live nodes"
View
@@ -15,6 +15,7 @@ def node_cmds():
"ring",
"flush",
"compact",
+ "drain",
"cleanup",
"repair",
"scrub",
@@ -197,6 +198,11 @@ class NodeCompactCmd(_NodeToolCmd):
nodetool_cmd = 'compact'
descr_text = "Compact node name"
+class NodeDrainCmd(_NodeToolCmd):
+ usage = "usage: ccm node_name drain [options]"
+ nodetool_cmd = 'drain'
+ descr_text = "Drain node name"
+
class NodeCleanupCmd(_NodeToolCmd):
usage = "usage: ccm node_name cleanup [options]"
nodetool_cmd = 'cleanup'
View
@@ -515,13 +515,16 @@ def data_size(self, live_data=True):
for root, dirs, files in os.walk(os.path.join(self.get_path(), 'data', ks)):
size += sum((os.path.getsize(os.path.join(root, f)) for f in files if os.path.isfile(os.path.join(root, f))))
return size
-
+
def flush(self):
self.nodetool("flush")
def compact(self):
self.nodetool("compact")
+ def drain(self):
+ self.nodetool("drain")
+
def repair(self):
self.nodetool("repair")

0 comments on commit 4fbdfa2

Please sign in to comment.