Esempio n. 1
0
    def run(self):
        Compute.deregister_instance_dns()
        Compute.register_instance_dns()
        JBoxd.publish_perf_counters()

        JBoxd.log_debug("Setting up signal handlers")
        signal.signal(signal.SIGINT, JBoxd.signal_handler)
        signal.signal(signal.SIGTERM, JBoxd.signal_handler)

        if VolMgr.has_update_for_user_home_image():
            VolMgr.update_user_home_image(fetch=False)

        while True:
            self.log_debug("JBox daemon waiting for commands...")
            try:
                offline, reply_req = JBoxd.QUEUE.poll(self._is_scheduled(JBoxAsyncJob.CMD_REQ_RESP, ()))
            except ValueError:
                self.log_exception("Exception reading command. Will retry after 10 seconds")
                time.sleep(10)
                continue

            if offline:
                try:
                    self.process_offline()
                except:
                    self.log_exception("Exception scheduling request")

            if reply_req:
                JBoxd.schedule_thread(JBoxAsyncJob.CMD_REQ_RESP, JBoxd.process_and_respond, ())
Esempio n. 2
0
    def run(self):
        if VolMgr.has_update_for_user_home_image():
            VolMgr.update_user_home_image(fetch=False)

        while True:
            self.log_debug("JBox daemon waiting for commands...")
            cmd, data = self.queue.recv()

            if cmd == JBoxAsyncJob.CMD_BACKUP_CLEANUP:
                args = (data, )
                fn = JBoxd.backup_and_cleanup
            elif cmd == JBoxAsyncJob.CMD_LAUNCH_SESSION:
                args = (data[0], data[1], data[2])
                fn = JBoxd.launch_session
            elif cmd == JBoxAsyncJob.CMD_AUTO_ACTIVATE:
                args = ()
                fn = JBoxd.auto_activate
            elif cmd == JBoxAsyncJob.CMD_UPDATE_USER_HOME_IMAGE:
                args = ()
                fn = JBoxd.update_user_home_image
            elif cmd == JBoxAsyncJob.CMD_REFRESH_DISKS:
                args = ()
                fn = JBoxd.refresh_disks
            elif cmd == JBoxAsyncJob.CMD_COLLECT_STATS:
                args = ()
                fn = JBoxd.collect_stats
            else:
                self.log_error("Unknown command " + str(cmd))
                continue

            JBoxd.schedule_thread(cmd, fn, args)
Esempio n. 3
0
    def run(self):
        if VolMgr.has_update_for_user_home_image():
            VolMgr.update_user_home_image(fetch=False)

        while True:
            self.log_debug("JBox daemon waiting for commands...")
            cmd, data = self.queue.recv()

            if cmd == JBoxAsyncJob.CMD_BACKUP_CLEANUP:
                args = (data,)
                fn = JBoxd.backup_and_cleanup
            elif cmd == JBoxAsyncJob.CMD_LAUNCH_SESSION:
                args = (data[0], data[1], data[2])
                fn = JBoxd.launch_session
            elif cmd == JBoxAsyncJob.CMD_AUTO_ACTIVATE:
                args = ()
                fn = JBoxd.auto_activate
            elif cmd == JBoxAsyncJob.CMD_UPDATE_USER_HOME_IMAGE:
                args = ()
                fn = JBoxd.update_user_home_image
            elif cmd == JBoxAsyncJob.CMD_REFRESH_DISKS:
                args = ()
                fn = JBoxd.refresh_disks
            elif cmd == JBoxAsyncJob.CMD_COLLECT_STATS:
                args = ()
                fn = JBoxd.collect_stats
            else:
                self.log_error("Unknown command " + str(cmd))
                continue

            JBoxd.schedule_thread(cmd, fn, args)
Esempio n. 4
0
    def run(self):
        if VolMgr.has_update_for_user_home_image():
            VolMgr.update_user_home_image(fetch=False)

        while True:
            self.log_debug("JBox daemon waiting for commands...")
            try:
                offline, reply_req = JBoxd.QUEUE.poll(
                    self._is_scheduled(JBoxAsyncJob.CMD_REQ_RESP, ()))
            except ValueError:
                self.log_exception(
                    "Exception reading command. Will retry after 10 seconds")
                time.sleep(10)
                continue

            if offline:
                try:
                    self.process_offline()
                except:
                    self.log_exception("Exception scheduling request")

            if reply_req:
                JBoxd.schedule_thread(JBoxAsyncJob.CMD_REQ_RESP,
                                      JBoxd.process_and_respond, ())
Esempio n. 5
0
 def do_update_user_home_image():
     if VolMgr.has_update_for_user_home_image():
         if not VolMgr.update_user_home_image(fetch=False):
             JBoxContainer.async_update_user_home_image()
Esempio n. 6
0
 def do_update_user_home_image():
     if VolMgr.has_update_for_user_home_image():
         if not VolMgr.update_user_home_image(fetch=False):
             JBoxContainer.async_update_user_home_image()
Esempio n. 7
0
 def update_user_home_image():
     VolMgr.update_user_home_image(fetch=True)
     VolMgr.refresh_user_home_image()
Esempio n. 8
0
 def update_user_home_image():
     try:
         VolMgr.update_user_home_image(fetch=True)
         JBoxLoopbackVol.refresh_all_disks()
     finally:
         JBoxd.finish_thread()
Esempio n. 9
0
 def update_user_home_image():
     VolMgr.update_user_home_image(fetch=True)
     JBoxLoopbackVol.refresh_all_disks()
Esempio n. 10
0
 def update_user_home_image():
     try:
         VolMgr.update_user_home_image(fetch=True)
         JBoxLoopbackVol.refresh_all_disks()
     finally:
         JBoxd.finish_thread()