Require a target name when instantiating a node

This is effectively a required db field; without it, the watermark
calculation can be wrong until it's filled in, so make sure it's
there to start.

Also some minor logging changes.

Change-Id: Idc5a9cd40fe330f7a1aea4a5513267ee3c254f60
This commit is contained in:
James E. Blair 2013-08-16 00:16:27 +00:00
parent 33346b37ac
commit a7144ff7d1
3 changed files with 7 additions and 4 deletions

View File

@ -115,10 +115,12 @@ class SnapshotImage(object):
class Node(object):
def __init__(self, provider_name, image_name, hostname=None,
external_id=None, ip=None, state=BUILDING):
def __init__(self, provider_name, image_name, target_name,
hostname=None, external_id=None, ip=None,
state=BUILDING):
self.provider_name = provider_name
self.image_name = image_name
self.target_name = target_name
self.external_id = external_id
self.ip = ip
self.hostname = hostname

View File

@ -112,6 +112,7 @@ class NodeUpdateListener(threading.Thread):
self.log.debug("Unable to find node with nodename: %s" %
nodename)
return
self.log.info("Setting node id: %s to USED" % node.id)
node.state = nodedb.USED
self.nodepool.updateStats(node.provider_name)
@ -627,7 +628,7 @@ class NodePool(threading.Thread):
def launchNode(self, provider, image, target):
provider = self.config.providers[provider.name]
image = provider.images[image.name]
node = self.db.createNode(provider.name, image.name)
node = self.db.createNode(provider.name, image.name, target.name)
t = NodeLauncher(self, provider, image, target, node.id)
t.start()

View File

@ -156,7 +156,7 @@ def ssh_connect(ip, username, connect_kwargs={}, timeout=60):
client = SSHClient(ip, username, **connect_kwargs)
break
except socket.error, e:
if e[0] != 111:
if e[0] not in [111, 113]:
log.exception('Exception while testing ssh access:')
out = client.ssh("test ssh access", "echo access okay")