def main():

    xs.watch('@introduceDomain', 'reload')
    xs.watch('@releaseDomain', 'reload')
    setup_watches()
    while True:
        (path, token) = xs.read_watch()
        if token == 'reload':
            setup_watches()
        else:
            if path.endswith('/state'):
                handle_vbd_state(path)
def main():

    xs.watch("@introduceDomain", "reload")
    xs.watch("@releaseDomain", "reload")
    setup_watches()
    while True:
        (path, token) = xs.read_watch()
        if token == "reload":
            setup_watches()
        else:
            if path.endswith("/state"):
                handle_vbd_state(path)
예제 #3
0
    def receive(self):
        """Recieve message from hypervisor and package for upstream consumption

        ### Description

        Wait for the watch to return some data and then pass that data to the
        caller.

        """

        # TODO Add error handling that is appropriate here ...
        # TODO Split off the D and allow us to die ...
        path, token = xs.read_watch()
        logger.info("Recieved a watch event on %s with token, %s", path, token)

        transaction = self.xs.transaction_start()
        message = self.xs.read(transaction, path)
        logger.info("Received message, %s, from %s", message, path)
        self.xs.transaction_end()

        # TODO Define identifier ...

        return identifier, message