self.swarm = Swarm(swarm_xml);
self.tc = TrafficControl("openvz");
self.sshc = paramiko.SSHClient()
+ self.sshc.set_missing_host_key_policy(paramiko.AutoAddPolicy())
self.sshc.load_system_host_keys()
self.sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
try:
self.sshc.connect(hostname=hostname, username=username, port=port)
stdin, stdout, stderr = self.sshc.exec_command(comm)
+ print stdout.readlines()
except Exception as e:
print e
finally:
if response == ACK_MSG:
self.sendMsg(pickle.dumps(config_data))
response = self.recv_msg()
- if (DEBUG):
- print response
+ print "->>>>>>>>>>>>>>>>>>>>>>>>>", response
except Exception as e:
print e
finally:
return msg
def startDaemon(self, node):
- comm = "python StartMeUpBaby";
- self.printDummyCommand(node.public_address, node.public_port, node.ssh_port, comm)
- #sendSSHComm(node.public_address, node.username, node.ssh_port, comm)
+ comm = "PYTHONPATH=/home/p2p/cs-p2p-next/bt_comm:/home/p2p/cs-p2p-next/bt_comm/start-clients/ python /home/p2p/cs-p2p-next/bt_comm/server/Server.py start"
+
+ #self.printDummyCommand(node.public_address, node.public_port, node.ssh_port, comm)
+ self.sendSSHComm(node.public_address, node.username, int(node.ssh_port), comm)
+ self.sendSSHComm(node.public_address, node.username, int(node.ssh_port), "ps -ef | grep Server")
def applyTC(self, node):
si = self.swarm.getSIByNode(node)
}
self.printDummyCommand(node.public_address, node.listen_port, START_MSG, config_data)
- #sendComm(node.public_address, node.public_port, START_MSG, config_data)
+ self.sendComm(node.public_address, int(node.listen_port), START_MSG, config_data)
def printDummyCommand(self, public_address, public_port, option1, data):
print "----------------------"
def startAll(self):
for node in self.nodes.getNodes():
- self.applyTC(node)
+ #self.applyTC(node)
self.startDaemon(node)
for si in self.swarm.getSIs():
paramiko.util.log_to_file('/tmp/paramiko.log')
class SSHCommander:
- def __init__(self, hostname, username, password):
+ def __init__(self, hostname, username, port):
+ #self.sshclient = paramiko.Transport((hostname, port))
self.sshclient = paramiko.SSHClient()
+ self.sshclient.set_missing_host_key_policy(paramiko.AutoAddPolicy())
self.sshclient.load_system_host_keys()
+ #~ transport = paramiko.Transport((host, port))
+ #pkey_file = os.path.expanduser('~/.ssh/id_rsa')
+ #self.pkey = paramiko.RSAKey.from_private_key_file(pkey_file)
+ self.hostname = hostname
+ self.username = username
+ self.port = port
def connect(self):
- self.sshclient.connect(hostname=hostname, username=username, password=password)
+ self.sshclient.connect(hostname=self.hostname, username=self.username, port=self.port)
+ #self.sshclient.connect(username=self.username, pkey=self.pkey)
def emitCommand(self, comm):
stdin, stdout, stderr = self.sshclient.exec_command(comm)
self.sshclient.close()
-sshc = SSHCommander("141.85.37.93", "marius", "marius")
-sshc.emitCommand("transmissioncli -D -U \[isoHunt\]\ ubuntu-9.10-desktop-i386.iso.torrent &> out.log")
-#sshc.closeConnection()
+sshc = SSHCommander("141.85.224.204", "p2p", 20322)
+sshc.connect()
+sshc.emitCommand("ls -lh")
+sshc.closeConnection()
#~ #client.connect(hostname='p2p-next-07.grid.pub.ro', username='p2p')
#~ stdin, stdout, stderr = client.exec_command('touch gugu dudu')
<?xml version="1.0" encoding="ISO-8859-1"?>
<nodes>
<node id="1">
- <public_address>141.85.224.201</public_address>
+ <public_address>141.85.224.204</public_address>
<public_port>10150</public_port>
<public_iface>eth0</public_iface>
- <private_address>172.30.10.0</private_address>
- <private_port>10150</private_port>
- <private_iface>venet0</private_iface>
- <ssh_port>10122</ssh_port>
- <username>gogu</username>
- <listen_port></listen_port>
+ <private_address>172.16.20.3</private_address>
+ <private_port></private_port>
+ <private_iface>venet0:0</private_iface>
+ <ssh_port>20322</ssh_port>
+ <username>p2p</username>
+ <listen_port>10004</listen_port>
<clients>
<client id="tribler">
<base>/home/p2p/p2p-clients/tribler/</base>
</client>
</clients>
</node>
- <node id="2">
- <public_address>141.85.224.202</public_address>
- <public_port>10250</public_port>
- <public_iface>eth0</public_iface>
- <private_address>172.30.20.0</private_address>
- <private_port>10250</private_port>
- <private_iface>venet0</private_iface>
- <ssh_port>10222</ssh_port>
- <username>gicu</username>
- <listen_port></listen_port>
- <clients>
- <client id="tribler">
- <base>/home/p2p/p2p-clients/tribler/</base>
- </client>
- <client id="libtorrent">
- <base>/home/p2p/p2p-clients/libtorrent/</base>
- </client>
- <client id="transmission">
- <base>/home/p2p/p2p-clients/transmission/</base>
- </client>
- </clients>
- </node>
</nodes>
<?xml version="1.0" encoding="ISO-8859-1"?>
<swarm>
- <torrent_file>cucu</torrent_file>
+ <torrent_file>/home/p2p/p2p-meta/bbt316.torrent</torrent_file>
<instance id="1">
<node>1</node>
<client>tribler</client>
<upload_limit>512</upload_limit>
<download_limit>256</download_limit>
- <download_dir>/download/dir</download_dir>
- <log_dir>/log/dir</log_dir>
- <log_file>log_file</log_file>
- <output_dir>/output/dir</output_dir>
- <output_file>output_file</output_file>
+ <download_dir>/home/p2p/p2p-dld/tribler</download_dir>
+ <log_dir>/home/p2p/p2p-log/tribler</log_dir>
+ <log_file>tribler-bbt316.log</log_file>
+ <output_dir>/home/p2p/p2p-log/tribler</output_dir>
+ <output_file>tribler-bbt316.out</output_file>
<actions>
<action type="start" delay="00:05:00" />
<action type="stop" delay="00:10:00" />
<action type="start" delay="end" />
</actions>
</instance>
- <instance id="2">
- <node>2</node>
- <client>transmission</client>
- <upload_limit>128</upload_limit>
- <download_limit>64</download_limit>
- <download_dir>/download/dir</download_dir>
- <log_dir>/log/dir</log_dir>
- <log_file>log_file</log_file>
- <output_dir>/output/dir</output_dir>
- <output_file>output_file</output_file>
- <actions>
- <action type="start" delay="00:05:00" />
- <action type="stop" delay="01:00:00" />
- <action type="start" delay="02:00:00" />
- <action type="start" delay="end" />
- </actions>
- </instance>
</swarm>