def test_AllocationPersistence(self):
self.launchDeviceManager("/nodes/test_multiDomain_exec/DeviceManager.dcd.xml", domainManager=self._domainManager_1)
self.launchDeviceManager("/nodes/test_multiDomain_uses/DeviceManager.dcd.xml", domainManager=self._domainManager_2)
self._domainManager_1.registerRemoteDomainManager(self._domainManager_2)
allocMgr_1 = self._domainManager_1._get_allocationMgr()
# Make a couple of allocation requests that we know will have to be
# split across the two domains
execcap = {'DCE:8dcef419-b440-4bcf-b893-cab79b6024fb':1000,
'DCE:4f9a57fc-8fb3-47f6-b779-3c2692f52cf9':50.0}
usescap = {'DCE:8cad8ca5-c155-4d1d-ae40-e194aa1d855f':1}
requests = [allocMgrHelpers.createRequest('exec', properties.props_from_dict(execcap)),
allocMgrHelpers.createRequest('uses', properties.props_from_dict(usescap))]
results = dict((r.requestID, r) for r in allocMgr_1.allocate(requests))
self.assertEqual(len(requests), len(results))
usesId = results['uses'].allocationID
execId = results['exec'].allocationID
# Save the current allocation state
pre = dict((al.allocationID, al) for al in allocMgr_1.allocations([]))
# Kill the DomainManager
os.kill(self._domainBooter_1.pid, signal.SIGTERM)
if not self.waitTermination(self._domainBooter_1):
self.fail("Domain Manager Failed to Die")
# Re-launch and check that the allocation state remains the same
self.launchDomainManager(endpoint='giop:tcp::5679', dbURI=self._dbfile)
post = dict((al.allocationID, al) for al in allocMgr_1.allocations([]))
self.assertEqual(len(pre), len(post))
self.assertEqual(pre.keys(), post.keys())
for allocId, status in pre.iteritems():
self.assert_(allocMgrHelpers.compareAllocationStatus(status, post[allocId]))
评论列表
文章目录