Merge "Use seprate log package for NodescanRequest messages"
This commit is contained in:
commit
dfd2877c81
|
@ -294,8 +294,7 @@ class StateMachineNodeLauncher(stats.StatsReporter):
|
||||||
self.nodescan_request = NodescanRequest(
|
self.nodescan_request = NodescanRequest(
|
||||||
node,
|
node,
|
||||||
label.host_key_checking,
|
label.host_key_checking,
|
||||||
self.manager.provider.boot_timeout,
|
self.manager.provider.boot_timeout)
|
||||||
self.log)
|
|
||||||
self.manager.nodescan_worker.addRequest(self.nodescan_request)
|
self.manager.nodescan_worker.addRequest(self.nodescan_request)
|
||||||
except kze.SessionExpiredError:
|
except kze.SessionExpiredError:
|
||||||
# Our node lock is gone, leaving the node state as BUILDING.
|
# Our node lock is gone, leaving the node state as BUILDING.
|
||||||
|
@ -1240,13 +1239,12 @@ class NodescanRequest:
|
||||||
# For unit testing
|
# For unit testing
|
||||||
FAKE = False
|
FAKE = False
|
||||||
|
|
||||||
def __init__(self, node, host_key_checking, timeout, log):
|
def __init__(self, node, host_key_checking, timeout):
|
||||||
self.state = self.START
|
self.state = self.START
|
||||||
self.iteration = 'init'
|
self.iteration = 'init'
|
||||||
self.node = node
|
self.node = node
|
||||||
self.host_key_checking = host_key_checking
|
self.host_key_checking = host_key_checking
|
||||||
self.timeout = timeout
|
self.timeout = timeout
|
||||||
self.log = log
|
|
||||||
self.complete = False
|
self.complete = False
|
||||||
self.keys = []
|
self.keys = []
|
||||||
if (node.connection_type == 'ssh' or
|
if (node.connection_type == 'ssh' or
|
||||||
|
@ -1271,6 +1269,10 @@ class NodescanRequest:
|
||||||
self.exception = None
|
self.exception = None
|
||||||
self.connect_start_time = None
|
self.connect_start_time = None
|
||||||
|
|
||||||
|
logger = logging.getLogger("nodepool.NodescanRequest")
|
||||||
|
self.log = get_annotated_logger(logger,
|
||||||
|
node_id=node.id)
|
||||||
|
|
||||||
def setWorker(self, worker):
|
def setWorker(self, worker):
|
||||||
"""Store a reference to the worker thread so we register and unregister
|
"""Store a reference to the worker thread so we register and unregister
|
||||||
the socket file descriptor from the polling object"""
|
the socket file descriptor from the polling object"""
|
||||||
|
|
|
@ -13,8 +13,6 @@
|
||||||
# See the License for the specific language governing permissions and
|
# See the License for the specific language governing permissions and
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
import logging
|
|
||||||
|
|
||||||
from nodepool import tests
|
from nodepool import tests
|
||||||
from nodepool.nodeutils import iterate_timeout
|
from nodepool.nodeutils import iterate_timeout
|
||||||
from nodepool.zk.zookeeper import Node
|
from nodepool.zk.zookeeper import Node
|
||||||
|
@ -113,8 +111,7 @@ class TestNodescanWorker(tests.BaseTestCase):
|
||||||
node.connection_port = 22
|
node.connection_port = 22
|
||||||
node.connection_type = 'ssh'
|
node.connection_type = 'ssh'
|
||||||
worker.start()
|
worker.start()
|
||||||
log = logging.getLogger('nodepool.test')
|
request = NodescanRequest(node, True, 300)
|
||||||
request = NodescanRequest(node, True, 300, log)
|
|
||||||
worker.addRequest(request)
|
worker.addRequest(request)
|
||||||
for _ in iterate_timeout(30, Exception, 'nodescan'):
|
for _ in iterate_timeout(30, Exception, 'nodescan'):
|
||||||
if request.complete:
|
if request.complete:
|
||||||
|
@ -141,8 +138,7 @@ class TestNodescanWorker(tests.BaseTestCase):
|
||||||
node.connection_port = 22
|
node.connection_port = 22
|
||||||
node.connection_type = 'ssh'
|
node.connection_type = 'ssh'
|
||||||
worker.start()
|
worker.start()
|
||||||
log = logging.getLogger('nodepool.test')
|
request = NodescanRequest(node, True, 1)
|
||||||
request = NodescanRequest(node, True, 1, log)
|
|
||||||
worker.addRequest(request)
|
worker.addRequest(request)
|
||||||
for _ in iterate_timeout(30, Exception, 'nodescan'):
|
for _ in iterate_timeout(30, Exception, 'nodescan'):
|
||||||
if request.complete:
|
if request.complete:
|
||||||
|
@ -169,8 +165,7 @@ class TestNodescanWorker(tests.BaseTestCase):
|
||||||
node.connection_port = 22
|
node.connection_port = 22
|
||||||
node.connection_type = 'ssh'
|
node.connection_type = 'ssh'
|
||||||
worker.start()
|
worker.start()
|
||||||
log = logging.getLogger('nodepool.test')
|
request = NodescanRequest(node, True, 1)
|
||||||
request = NodescanRequest(node, True, 1, log)
|
|
||||||
worker.addRequest(request)
|
worker.addRequest(request)
|
||||||
for _ in iterate_timeout(30, Exception, 'nodescan'):
|
for _ in iterate_timeout(30, Exception, 'nodescan'):
|
||||||
if request.complete:
|
if request.complete:
|
||||||
|
@ -210,9 +205,8 @@ class TestNodescanWorker(tests.BaseTestCase):
|
||||||
node2.connection_port = 22
|
node2.connection_port = 22
|
||||||
node2.connection_type = 'ssh'
|
node2.connection_type = 'ssh'
|
||||||
|
|
||||||
log = logging.getLogger('nodepool.test')
|
request1 = NodescanRequest(node1, True, 300)
|
||||||
request1 = NodescanRequest(node1, True, 300, log)
|
request2 = NodescanRequest(node2, True, 300)
|
||||||
request2 = NodescanRequest(node2, True, 300, log)
|
|
||||||
worker.addRequest(request1)
|
worker.addRequest(request1)
|
||||||
worker.addRequest(request2)
|
worker.addRequest(request2)
|
||||||
worker.start()
|
worker.start()
|
||||||
|
|
Loading…
Reference in New Issue