Skip to content

Commit

Permalink
nothing
Browse files Browse the repository at this point in the history
  • Loading branch information
root committed Jan 11, 2013
1 parent 854cf9d commit 6a9bd63
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 22 deletions.
1 change: 0 additions & 1 deletion ChunkServer.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
import random

PARAM = None

LVNAME='lv_softsan_'
VGNAME='VolGroup'

Expand Down
36 changes: 19 additions & 17 deletions chkclient_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
from mds import Object
import libiscsi
import scandev
import config,util

def configuration():
global PARAM
Expand Down Expand Up @@ -35,42 +36,43 @@ def test_with_chkserv():
global PARAM

# logging.basicConfig(level=logging.DEBUG)
# socket=gevent.socket.socket()
# socket.connect((PARAM.MDS_IP, int(PARAM.MDS_PORT)))
# s1=gevent.socket.socket()
# s1.connect((PARAM.MDS_IP, int(PARAM.MDS_PORT)))
# guid=msg.Guid()
# guid.a=10
# guid.b=22
# guid.c=30
# guid.d=40
# stub=rpc.RpcStub(guid, socket, mds.MDS)
# stub=rpc.RpcStub(guid, s1, mds.MDS)
# arg=msg.GetChunkServers_Request()
# ret=stub.callMethod('GetChunkServers', arg)

# s2=gevent.socket.socket()
# s2.connect((ret.random[0].ServiceAddress, ret.random[0].ServicePort))
# stub2=rpc.RpcStub(guid, s2, ChunkServer.ChunkServer)

client = Client(PARAM.MDS_IP, int(PARAM.MDS_PORT))
mdsip='192.168.0.149'
mdsport='6789'
client = Client.Client(PARAM.MDS_IP, int(PARAM.MDS_PORT))
serlist = client.mds.GetChunkServers()
print len(serlist)
print serlist[0].ServiceAddress, serlist[0].ServicePort

chkaddr = serlist[0].ServiceAddress
chkport = serlist[0].ServicePort
chkclient = ChunkServerClient(client.guid, chkaddr, chkport)
chklist = chkclient.NewChunk(32, 1)
print chklist
# chkaddr = serlist[0].ServiceAddress
# chkport = serlist[0].ServicePort
# chkclient = ChunkServerClient(client.guid, chkaddr, chkport)
# chklist = chkclient.NewChunk(32, 1)
# print chklist


volume = Object()
volume.size = 50
volume.guid = Guid.toStr(chklist.guids[0])
target = chkclient.AssembleChunk(volume)
print target
# volume = Object()
# volume.size = 50
# volume.guid = Guid.toStr(chklist.guids[0])
# target = chkclient.AssembleChunk(volume)
# print target

chkclient.DisassembleChunk(target.access_point)
# chkclient.DisassembleChunk(target.access_point)

chkclient.DeleteChunk(volume)
# chkclient.DeleteChunk(volume)

if __name__=='__main__':
configuration()
Expand Down
2 changes: 1 addition & 1 deletion rpc.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ def __init__(self, guid, socket=None, Interface=None, MethodInfo=None):
else:
self.methodInfo=BuildMethodInfo(Interface)
logging.info(self.methodInfo.keys())

def callMethod(self, name, argument, socket=None):
MI=self.methodInfo[name]
assert type(argument)==MI[0]
Expand All @@ -141,7 +142,6 @@ def callMethod(self, name, argument, socket=None):
assert name_==name
self.token=token+1
ret=MI[1].FromString(body_)

return ret


Expand Down
3 changes: 0 additions & 3 deletions test.conf
Original file line number Diff line number Diff line change
@@ -1,3 +0,0 @@
[default]
MDS_IP=192.168.0.149
MDS_PORT=2534

0 comments on commit 6a9bd63

Please sign in to comment.