251
252
serv.report_state()
253
254
self.assert_(not serv.model_disconnected)
256
def test_compute_can_update_available_resource(self):
257
"""Confirm compute updates their record of compute-service table."""
259
binary = 'nova-compute'
262
# Any mocks are not working without UnsetStubs() here.
263
self.mox.UnsetStubs()
264
ctxt = context.get_admin_context()
265
service_ref = db.service_create(ctxt, {'host': host,
268
serv = service.Service(host,
271
'nova.compute.manager.ComputeManager')
273
# This testcase want to test calling update_available_resource.
274
# No need to call periodic call, then below variable must be set 0.
275
serv.report_interval = 0
276
serv.periodic_interval = 0
279
self.mox.StubOutWithMock(service.rpc.Connection, 'instance')
280
service.rpc.Connection.instance(new=mox.IgnoreArg())
281
service.rpc.Connection.instance(new=mox.IgnoreArg())
282
self.mox.StubOutWithMock(serv.manager.driver,
283
'update_available_resource')
284
serv.manager.driver.update_available_resource(mox.IgnoreArg(), host)
286
# Just doing start()-stop(), not confirm new db record is created,
287
# because update_available_resource() works only in
288
# libvirt environment. This testcase confirms
289
# update_available_resource() is called. Otherwise, mox complains.
294
db.service_destroy(ctxt, service_ref['id'])