1 # #!/usr/local/bin/python
3 # This script restarts the cluster nodes. It can optionally cleanup the persistent data.
4 # --------------------------------------------------------------------------------------
6 # This script takes a list of hosts as parameter
9 # -------------------------------------------------------------------------------------------------------------
12 from remote_host import RemoteHost
14 parser = argparse.ArgumentParser(description='Cluster Restart')
15 parser.add_argument("--rootdir", default="/root",
16 help="the root directory on the remote host where the distribution is deployed", required=True)
17 parser.add_argument("--hosts", default="",
18 help="a comma separated list of host names or ip addresses", required=True)
19 parser.add_argument("--clean", action="store_true", default=False,
20 help="clean the persistent data for the current deployment")
21 parser.add_argument("--user", default="root", help="the SSH username for the remote host(s)")
22 parser.add_argument("--password", default="Ecp123", help="the SSH password for the remote host(s)")
23 args = parser.parse_args()
27 hosts = args.hosts.split(",")
28 for x in range(0, len(hosts)):
29 # Connect to the remote host and start doing operations
30 remote = RemoteHost(hosts[x], args.user, args.password, args.rootdir)
31 remote.kill_controller()
33 remote.exec_cmd("rm -rf " + args.rootdir + "/deploy/current/odl/journal")
34 remote.exec_cmd("rm -rf " + args.rootdir + "/deploy/current/odl/snapshots")
35 remote.start_controller(args.rootdir + "/deploy/current")