Commit 27830fed authored by Antoine Millet's avatar Antoine Millet
Browse files

Added register and unregister methods to the HypervisorHandler handler.

parent b6a133dc
Loading
Loading
Loading
Loading
+34 −1
Original line number Diff line number Diff line
@@ -78,7 +78,40 @@ class HypervisorHandler(OnlineCCHandler):
    '''
    Handler binded to 'node' role.
    '''
    pass

    @listed
    def register(self, conn, obj_id, role):
        '''
        Register an object managed by the calling node.

        .. note:
           the obj_id argument passed to this handler is the object id of the
           registered object (not the fully qualified id, the server will
           preprend the id by "node_id." itself).

        :param obj_id: the id of the object to register
        :param role: the role of the object to register
        '''

        client = self._server.search_client_by_connection(conn)
        self._server.sub_register(client.login, obj_id, role)

    @listed
    def unregister(self, conn, obj_id):
        '''
        Unregister an object managed by the calling node.

        .. note:
           the obj_id argument passed to this handler is the object id of the
           unregistered object (not the fully qualified id, the server will
           preprend the id by "node_id." itself).

        :param obj_id: the id of the object to unregister
        '''

        client = self._server.search_client_by_connection(conn)
        oid = '%s.%s' % (client.login, obj_id)
        self._server.sub_unregister(oid)


class ClientHandler(OnlineCCHandler):