Esempio n. 1
0
    def run(self):
        try:
            #读取配置文件
            self.agent_port = int(
                self.config.get('network', 'agent-port', '9099'))
            self.debug_mode = self.config.getboolean('system', 'debug')
            self.multi_thread = self.config.getboolean('system',
                                                       'multi-thread')

            # Tell switch server about what service is online
            # self.tell_online_services()
            # self.post_ip()
            # 获取磁盘信息保存到全局变量中
            self.post_host_info()
            # vmpath=self.global_wrapper('json@storage:disk')
            vmpath = {
                'disk': [get_vm_disks_for_enc(),
                         getip(), self.agent_port]
            }
            post_url('%s/oVirt/initRegister' % remote_base_url, payload=vmpath)
            post_url('%s/oVirt/nodeRegister' % remote_base_url,
                     payload=get_sytem_info())
            print 'value: ', vmpath
            print 'system: ', get_sytem_info()
            # vmpath.write()
            # Run services
            self.app.run(host='0.0.0.0',
                         port=self.agent_port,
                         debug=self.debug_mode,
                         use_reloader=self.debug_mode,
                         threaded=self.multi_thread)
        except Exception, e:
            print_exception(__name__, e)
Esempio n. 2
0
    def run(self):
        try:
            self.agent_port = int(
                self.config.get('network', 'agent-port', '9099'))
            self.debug_mode = self.config.getboolean('system', 'debug')
            self.multi_thread = self.config.getboolean('system',
                                                       'multi-thread')
            # 不用注册远程方法了
            # self.tell_online_services()

            # 暂时不用
            # self.post_ip()
            # self.post_host_info()
            result = post_url('%s/openStack/initRegister' % remote_base_url,
                              payload=get_nfs_disk())
            post_url('%s/openStack/nodeRegister' % remote_base_url,
                     payload=get_sytem_info())
            print('register result: ', result)
            self.app.run(host='0.0.0.0',
                         port=self.agent_port,
                         debug=self.debug_mode,
                         use_reloader=self.debug_mode,
                         threaded=self.multi_thread)
        except Exception as e:
            print_exception(__name__, e)
Esempio n. 3
0
 def post_host_info(self):
     from host_info import get_sytem_info
     print '%s/nodeRegister' % remote_base_url
     post_url('%s/nodeRegister' % remote_base_url, payload=get_sytem_info())