예제 #1
0
 def delete(self, req, tenant_id, id):
     """Delete a single instance."""
     LOG.info(
         _LI("Deleting database instance '%(instance_id)s' for tenant "
             "'%(tenant_id)s'"), {
                 'instance_id': id,
                 'tenant_id': tenant_id
             })
     LOG.debug("req : '%s'\n\n", req)
     context = req.environ[wsgi.CONTEXT_KEY]
     instance = models.load_any_instance(context, id)
     context.notification = notification.DBaaSInstanceDelete(context,
                                                             request=req)
     with StartNotification(context, instance_id=instance.id):
         marker = 'foo'
         while marker:
             instance_modules, marker = module_models.InstanceModules.load(
                 context, instance_id=id)
             for instance_module in instance_modules:
                 instance_module = module_models.InstanceModule.load(
                     context, instance_module['instance_id'],
                     instance_module['module_id'])
                 module_models.InstanceModule.delete(
                     context, instance_module)
         instance.delete()
     return wsgi.Result(None, 202)
예제 #2
0
 def delete(self, req, tenant_id, id):
     """Delete a single instance."""
     LOG.info(_LI("Deleting database instance '%(instance_id)s' for tenant "
                  "'%(tenant_id)s'"),
              {'instance_id': id, 'tenant_id': tenant_id})
     LOG.debug("req : '%s'\n\n", req)
     # TODO(hub-cap): turn this into middleware
     context = req.environ[wsgi.CONTEXT_KEY]
     instance = models.load_any_instance(context, id)
     context.notification = notification.DBaaSInstanceDelete(context,
                                                             request=req)
     with StartNotification(context, instance_id=instance.id):
         instance.delete()
     # TODO(cp16net): need to set the return code correctly
     return wsgi.Result(None, 202)