Pass requestor data to Nodes
Propagate the NodeRequest.requestor to a new property Node.requestor which usually holds the zuul_system_id, or "NodePool:min_ready". This is set initially when first creating a node, and is updated when a ready node is assigned to a request. This is to always know for which requestor is a node got allocated. Change-Id: Ifd54a94bae39f31a70bdedce384a64c2a04495c1
This commit is contained in:
parent
c6c9f1a7c7
commit
7ae6b34e71
|
@ -466,6 +466,7 @@ class NodeRequestHandler(NodeRequestHandlerNotifications,
|
|||
got_a_node = True
|
||||
node.allocated_to = self.request.id
|
||||
node.tenant_name = self.request.tenant_name
|
||||
node.requestor = self.request.requestor
|
||||
self.zk.storeNode(node)
|
||||
self.nodeset.append(node)
|
||||
self._satisfied_types.add(ntype, node.id)
|
||||
|
@ -514,6 +515,7 @@ class NodeRequestHandler(NodeRequestHandlerNotifications,
|
|||
node.launcher = self.launcher_id
|
||||
node.allocated_to = self.request.id
|
||||
node.tenant_name = self.request.tenant_name
|
||||
node.requestor = self.request.requestor
|
||||
|
||||
# This sets static data defined in the config file in the
|
||||
# ZooKeeper Node object.
|
||||
|
|
|
@ -49,6 +49,8 @@ class TestLauncher(tests.DBTestCase):
|
|||
req = zk.NodeRequest()
|
||||
req.state = zk.REQUESTED
|
||||
req.node_types.append('fake-label')
|
||||
req.tenant_name = 'tenant-1'
|
||||
req.requestor = 'unit-test'
|
||||
self.zk.storeNodeRequest(req)
|
||||
|
||||
req = self.waitForNodeRequest(req)
|
||||
|
@ -67,6 +69,8 @@ class TestLauncher(tests.DBTestCase):
|
|||
self.assertEqual(node.connection_type, 'ssh')
|
||||
self.assertEqual(node.connection_port, 22)
|
||||
self.assertEqual(node.python_path, '/usr/bin/python3')
|
||||
self.assertEqual(node.tenant_name, 'tenant-1')
|
||||
self.assertEqual(node.requestor, 'unit-test')
|
||||
p = "{path}/{id}".format(
|
||||
path=self.zk._imageUploadPath(image.image_name,
|
||||
image.build_id,
|
||||
|
|
|
@ -599,6 +599,7 @@ class Node(BaseModel):
|
|||
self.python_path = None
|
||||
self.tenant_name = None
|
||||
self.driver_data = None
|
||||
self.requestor = None
|
||||
|
||||
def __repr__(self):
|
||||
d = self.toDict()
|
||||
|
@ -641,7 +642,8 @@ class Node(BaseModel):
|
|||
self.attributes == other.attributes and
|
||||
self.python_path == other.python_path and
|
||||
self.tenant_name == other.tenant_name and
|
||||
self.driver_data == other.driver_data)
|
||||
self.driver_data == other.driver_data and
|
||||
self.requestor == other.requestor)
|
||||
else:
|
||||
return False
|
||||
|
||||
|
@ -695,6 +697,7 @@ class Node(BaseModel):
|
|||
d['python_path'] = self.python_path
|
||||
d['tenant_name'] = self.tenant_name
|
||||
d['driver_data'] = self.driver_data
|
||||
d['requestor'] = self.requestor
|
||||
return d
|
||||
|
||||
@staticmethod
|
||||
|
@ -763,6 +766,7 @@ class Node(BaseModel):
|
|||
self.shell_type = d.get('shell_type')
|
||||
self.tenant_name = d.get('tenant_name')
|
||||
self.driver_data = d.get('driver_data')
|
||||
self.requestor = d.get('requestor')
|
||||
|
||||
|
||||
class ZooKeeper(object):
|
||||
|
|
Loading…
Reference in New Issue