Add lock state to node listing

Also make waitfornodes in the devstack script to wait for unlocked
nodes.

Change-Id: I76f35d46f66f9e3beafe9f5f5a93049256a8df44
This commit is contained in:
David Shrewsbury 2017-02-15 12:05:03 -05:00
parent d884a35937
commit 4e6dedfd0f
2 changed files with 19 additions and 4 deletions

View File

@ -33,21 +33,36 @@ def node_list(zk, node_id=None):
t = PrettyTable(["ID", "Provider", "AZ", "Label",
"Launcher", "Hostname", "Server ID",
"Public IPv4", "Private IPv4", "IPv6",
"State", "Age", "Comment"])
"State", "Age", "Locked", "Comment"])
t.align = 'l'
if node_id:
node = zk.getNode(node_id)
if node:
locked = "unlocked"
try:
zk.lockNode(node, blocking=False)
except Exception:
locked = "locked"
else:
zk.unlockNode(node)
t.add_row([node.id, node.provider, node.az, node.type,
node.launcher, node.hostname, node.external_id,
node.public_ipv4, node.private_ipv4, node.public_ipv6,
node.state, age(node.state_time), node.comment])
node.state, age(node.state_time), locked, node.comment])
else:
for node in zk.nodeIterator():
locked = "unlocked"
try:
zk.lockNode(node, blocking=False)
except Exception:
locked = "locked"
else:
zk.unlockNode(node)
t.add_row([node.id, node.provider, node.az, node.type,
node.launcher, node.hostname, node.external_id,
node.public_ipv4, node.private_ipv4, node.public_ipv6,
node.state, age(node.state_time), node.comment])
node.state, age(node.state_time), locked, node.comment])
return str(t)

View File

@ -31,7 +31,7 @@ function waitfornode {
name=$1
state='ready'
while ! $NODEPOOL list | grep $name | grep $state; do
while ! $NODEPOOL list | grep $name | grep $state | grep "unlocked"; do
$NODEPOOL image-list > /tmp/.nodepool-image-list.txt
$NODEPOOL list > /tmp/.nodepool-list.txt
sudo mv /tmp/.nodepool-image-list.txt $WORKSPACE/logs/nodepool-image-list.txt