Skip to content

Commit

Permalink
Fix the endpoint urls for workers and mgmt interface and also fix dat…
Browse files Browse the repository at this point in the history
…astore polling
  • Loading branch information
dnaeon committed Aug 20, 2013
1 parent 8cf2c95 commit 124ed8e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 10 deletions.
5 changes: 2 additions & 3 deletions src/vm-pollerd-client
Original file line number Diff line number Diff line change
Expand Up @@ -36,18 +36,17 @@ def main():
context = zmq.Context()
socket = context.socket(zmq.REQ)

socket.connect("tcp://localhost:9999")
socket.connect("tcp://localhost:11555")

msg = { "type": "datastores",
"vcenter": "sof-vc0-mnik",
"name": "datastore1",
"ds_url": "ds:///vmfs/volumes/5190e2a7-d2b7c58e-b1e2-90b11c29079d/",
"property": "summary.capacity",
"cmd": "poll",
}

socket.send_json(msg)
msg_in = socket.recv_pyobj()
msg_in = socket.recv_json()

if msg_in['status'] != 0:
print msg_in['reason']
Expand Down
14 changes: 7 additions & 7 deletions src/vmpollerd/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ class VMPollerDaemon(Daemon):
Prepares all VMPoller Agents to be ready for polling from the vCenters.
Creates two sockets, one connected to the ZeroMQ proxy to receive client requests,
the second socket is bound to tcp://localhost:15560 and is used for management.
the second socket is bound to tcp://localhost:11560 and is used for management.
Extends:
Daemon class
Expand Down Expand Up @@ -94,16 +94,16 @@ def run(self, config_dir="/etc/vm-poller"):
self.worker = self.zcontext.socket(zmq.REP)

try:
self.worker.connect("tcp://localhost:15556")
self.worker.connect("tcp://localhost:11556")
except zmq.ZMQError as e:
raise VMPollerException, "Cannot connect worker to proxy: %s" % e

# A management socket, used to control the VMPoller daemon
self.mgmt = self.zcontext.socket(zmq.REP)

try:
self.mgmt.bind("tcp://localhost:15560")
except zmq.ZMQError as we:
self.mgmt.bind("tcp://127.0.0.1:11560")
except zmq.ZMQError as e:
raise VMPollerException, "Cannot bind management socket: %s" % e

# Create a poll set for our two sockets
Expand All @@ -113,7 +113,7 @@ def run(self, config_dir="/etc/vm-poller"):

# Process messages from both sockets
while True:
socks = self.zpoller.poll()
socks = dict(self.zpoller.poll())

# Process worker message
if socks.get(self.worker) == zmq.POLLIN:
Expand Down Expand Up @@ -338,7 +338,7 @@ def get_datastore_property(self, msg):
d = dict(props)

# break if we have a match
if d['info.name'] == name and d['info.url'] == url:
if d['info.name'] == msg['name'] and d['info.url'] == msg['ds_url']:
break
else:
return { "status": -1, "reason": "Unable to find the datastore" }
Expand Down Expand Up @@ -371,7 +371,7 @@ def run(self):
# Socket facing workers
# TODO: The endpoint we bind should be configurable
self.backend = self.zcontext.socket(zmq.DEALER)
self.backend.bind("tcp://*:15556")
self.backend.bind("tcp://*:11556")

# Start the proxy
syslog.syslog("Starting the VMPoller Proxy")
Expand Down

0 comments on commit 124ed8e

Please sign in to comment.