Commit 8dbba78b authored by Antoine Millet's avatar Antoine Millet
Browse files

Now using RemoteTag on hypervisor children

parent 8369066d
Loading
Loading
Loading
Loading
+9 −2
Original line number Diff line number Diff line
@@ -2,6 +2,7 @@ import threading

from ccserver.handlers import listed
from ccserver.clients import Client, RegisteredCCHandler
from ccserver.db import RemoteTag

from cloudcontrol.common.tql.db.object import TqlObject
from cloudcontrol.common.tql.db.tag import StaticTag, CallbackTag
@@ -153,8 +154,8 @@ class HvClient(Client):
        :param value: value of the tag
        """

        callback = partial(self.get_child_remote_tags, obj_id, name)
        tag = CallbackTag(name, callback, ttl=ttl)
        callback = partial(self.async_remote_sub_tags, obj_id)
        tag = RemoteTag(name, callback, ttl=ttl)
        self._children[obj_id].register(tag)

    def sub_tags_unregister(self, obj_id, name):
@@ -192,5 +193,11 @@ class HvClient(Client):
            if ttl is not None:
                tag.ttl = ttl

    def async_remote_sub_tags(self, obj_id, watcher, robj, tags):
        """ Asynchronously update sub tags from the remote client using
            specified watcher.
        """
        watcher.register(self.conn, 'sub_tags', obj_id, tags, _data=robj)


Client.register_client_class(HvClient)