コード例 #1
0
 def __init__(self):
     self.logger = Log("vps_mgr", config=conf)
     self.logger_net = Log("vps_mgr_net", config=conf)
     self.logger_misc = Log("misc", config=conf)
     self.logger_debug = Log("debug", config=conf)
     self.host_id = conf.HOST_ID
     self.vpsops = VPSOps(self.logger)
     self.handlers = {
         CMD.OPEN: self.__class__.vps_open,
         CMD.REBOOT: self.__class__.vps_reboot,
         CMD.CLOSE: self.__class__.vps_close,
         CMD.OS: self.__class__.vps_reinstall_os,
         CMD.UPGRADE: self.__class__.vps_upgrade,
         CMD.BANDWIDTH: self.__class__.vps_set_bandwidth,
         CMD.RM: self.__class__.vps_delete,
         CMD.PRE_SYNC: self.__class__.vps_hot_sync,
         CMD.MIGRATE: self.__class__.vps_migrate,
         CMD.RESET_PW: self.__class__.vps_reset_pw,
     }
     self._locker = threading.Lock()
     self._vps_locker = dict()
     self.xenstat = XenStat()
     self.timer = TimerEvents(time.time, self.logger_misc)
     assert conf.MONITOR_COLLECT_INV > 0
     self.last_netflow = None
     self.last_diskstat = None
     self.monitor_inv = conf.MONITOR_COLLECT_INV
     self.last_monitor_ts = None
     self.timer.add_timer(conf.MONITOR_COLLECT_INV, self.monitor_vps)
     self.timer.add_timer(12 * 3600, self.refresh_host_space)
     self.workers = []
     self.running = False
コード例 #2
0
 def __init__(self):
     self.logger = Log("vps_mgr", config=conf)
     self.logger_err = Log("vps_mgr_err", config=conf)
     self.logger_misc = Log("misc", config=conf)
     self.host_id = conf.HOST_ID
     self.handlers = {
         Cmd.OPEN: self.__class__.vps_open,
         Cmd.REBOOT: self.__class__.vps_reboot,
         Cmd.CLOSE: self.__class__.vps_close,
         Cmd.OS: self.__class__.vps_reinstall_os,
     }
     self.timer = TimerEvents(time.time, self.logger_misc)
     assert conf.NETFLOW_COLLECT_INV > 0
     self.timer.add_timer(conf.NETFLOW_COLLECT_INV, self.send_netflow)
     self.timer.add_timer(12 * 3600, self.refresh_host_space)
     self.workers = []
     self.running = False