示例#1
0
 def run(self):
     q = GlobalQueue.get(self.hostUuid).get('statMem')
     hostid = uuid2hostid(self.db, self.hostUuid)
     m = MirrorMem(self.db, hostid)
     while True:
         attr = q.get()
         m.append(attr)
示例#2
0
def processStartUp(request):

    param = json.loads(request.body)
    
    hostUuid = param.get('hostUuid')
    if not GlobalDb.get(hostUuid):
        GlobalDb.put(hostUuid, getdb())
        
    db = GlobalDb.get(hostUuid)
    
    with getlock(db) as mylock:
        puth(db,hostUuid,param.get('hostClass'))
        hostid = uuid2hostid(db, hostUuid)
        putc(db, hostid, param.get('cpuClass'))
        putms(db, hostid, param.get('memClass'))
        putns(db, hostid, param.get('netClass'))
        putds(db, hostid, param.get('diskClass'))
    
    if not GlobalQueue.get(hostUuid):
        loadQueue(hostUuid, GlobalQueue)
        
    if not GlobalThread.get(hostUuid):
        loadThread(hostUuid, GlobalThread)
    
    return jresponse('0','ready',request,200)
示例#3
0
 def run(self):
     q = GlobalQueue.get(self.hostUuid).get('statMem')
     hostid = uuid2hostid(self.db, self.hostUuid)
     m = MirrorMem(self.db,hostid)
     while True:
         attr = q.get()
         m.append(attr)
示例#4
0
def processStartUp(request):

    param = json.loads(request.body)

    hostUuid = param.get('hostUuid')
    if not GlobalDb.get(hostUuid):
        GlobalDb.put(hostUuid, getdb())

    db = GlobalDb.get(hostUuid)

    with getlock(db) as mylock:
        puth(db, hostUuid, param.get('hostClass'))
        hostid = uuid2hostid(db, hostUuid)
        putc(db, hostid, param.get('cpuClass'))
        putms(db, hostid, param.get('memClass'))
        putns(db, hostid, param.get('netClass'))
        putds(db, hostid, param.get('diskClass'))

    if not GlobalQueue.get(hostUuid):
        loadQueue(hostUuid, GlobalQueue)

    if not GlobalThread.get(hostUuid):
        loadThread(hostUuid, GlobalThread)

    return jresponse('0', 'ready', request, 200)
def db_flask_query_dynamic_class(db, hostUuid, className):

    host_id = uuid2hostid(db, hostUuid)

    if stat_dict.has_key(className):
        return stat_dict[className](db, host_id)

    return []
示例#6
0
 def run(self):
     q = GlobalQueue.get(self.hostUuid).get('statService')
     hostid = uuid2hostid(self.db, self.hostUuid)
     m = MirrorService(self.db,hostid)
     while True:
         attr = q.get()
         print attr
         m.append(attr)
示例#7
0
 def run(self):
     q = GlobalQueue.get(self.hostUuid).get('statStorage')
     hostid = uuid2hostid(self.db, self.hostUuid)
     m = MirrorStorage(self.db, hostid)
     while True:
         attr = q.get()
         print attr
         m.append(attr)
def db_flask_query_dynamic_class(db,hostUuid,className):
        
    host_id = uuid2hostid(db, hostUuid)
    
    if stat_dict.has_key(className):
        return stat_dict[className](db,host_id)
    
    return []
def db_flask_query_service(db,hostUuid):
        
    host_id = uuid2hostid(db, hostUuid)    
    return query_service(db, host_id)
示例#10
0
def db_flask_query_service(db, hostUuid):

    host_id = uuid2hostid(db, hostUuid)
    return query_service(db, host_id)