def kill(self): """Destroy the service object in the datastore.""" self.stop() try: db.service_destroy(context.get_admin_context(), self.service_id) except exception.NotFound: LOG.warning('Service killed that has no database entry.')
def kill(self): """Destroy the service object in the datastore.""" self.stop() try: db.service_destroy(context.get_admin_context(), self.service_id) except exception.NotFound: LOG.warn(_LW('Service killed that has no database entry'))
def test_service_disabled_on_create_based_on_flag(self): self.flags(enable_new_services=False) host = 'foo' binary = 'manila-fake' app = service.Service.create(host=host, binary=binary) app.start() app.stop() ref = db.service_get(context.get_admin_context(), app.service_id) db.service_destroy(context.get_admin_context(), app.service_id) self.assertTrue(ref['disabled'])
def cleanup(self): """Remove manila services reporting as 'down'.""" ctxt = context.get_admin_context() services = db.service_get_all(ctxt) for svc in services: if utils.service_is_up(svc): continue db.service_destroy(ctxt, svc['id']) print("Cleaned up service %s" % svc['host'])
def test_service_enabled_on_create_based_on_flag(self): self.flags(enable_new_services=True) host = "foo" binary = "manila-fake" app = service.Service.create(host=host, binary=binary) app.start() app.stop() ref = db.service_get(context.get_admin_context(), app.service_id) db.service_destroy(context.get_admin_context(), app.service_id) self.assertFalse(ref["disabled"])