Comment 1 for bug 1361186

Revision history for this message
RedBaron (dheeraj-gupta4) wrote :

To my mind, this bug occurs because both cases
1. When a service is to be deleted at the top level
2. Deletion has to be initiated at the top level (A nova service-delete command for instance)
are handled by the same function in the nova.compute.cells_api.HostAPI method

def service_delete(self, context, service_id):
        """Deletes the specified service."""
        self.cells_rpcapi.service_delete(context, service_id)

The method does the correct thing when the command is executed/initiated - Strips the cellname and service name and forwards the message to the concerned cell. The target cell on receiving the message calls appropriate method in nova.cells.messaging._TargetedMessageMethods

def service_delete(self, message, service_id):
        """Deletes the specified service."""
        self.host_api.service_delete(message.ctxt, service_id)

For child cells this is fine since self.host_api points to nova.compute.HostAPI but for an API cell the self.host_api is nova.compute.cells_api.HostAPI which initiated the message in the first place. The top level cell thus has no way of knowing that the user wants to delete a service on _this_ cell and forwards the request (like it did in the beginning).

As an example,If the service ID to delete is 'toplevel@4' i.e. in API cell, the API cell splits out the cell and service using cells.utils function and gets cell_name:toplevel, service_id:4. It then forwards the message to itself. On receiving this message it only gets service_id:4 and (again), tries to split it for forwarding. Now spliting returns a cell_name: None and hence the eroor occurs while trying to route the message.

The same problem exists in service_update method too.