def shutdown(self, req): # execute xm shutdown req.vm_id shutdown = "xm shutdown " + str(req.vm_id) pexpect.run(shutdown) msg = Message.ShutdownRes(msg="Success", hostname=req.node, vm_id=req.vm_id) Client.sendonly_message(self.server.pm_relation.parent_addr)
def HypervisorReqHandler(self, request): print request if request.type == 'ubuntu': VM_initializer = VM_initializer_ubuntu(request.id, request.owner, request.group_num, request.vm_num, request.mem, request.disk, request.cores, request.hostmachine) VM_initializer.start() res = Message.NodeHypervisorRt(status = 'Success', msg = str(request.id) + '-' + request.owner, vm_id = request.id) print res.status print res.msg print request.id Client.sendonly_message(self.server.pm_relation.parent_addr,res)
def sendStartupRequest(self, entry): #''' ===== still have prombles I need to debug ===== ''' print("Send request to {addr}".format(addr=entry.strAddr())) script_dir = "/mnt/images/nfs/new_roystonea_script/roystonea_script/" script_file = self.convnameType2Script(entry.level) script_ab_file = script_dir + script_file log_ab_file = script_dir + "log/{host}-{port}-printout.txt".format(host=entry.host, port=entry.port) ssh_cmd = "nohup python {script_absolute_filepath} {host} {port} console_off > {log_ab} &".format( script_absolute_filepath=script_ab_file, host=entry.host, port=entry.port, log_ab=log_ab_file ) print(ssh_cmd) account = "ot32em" passwd = "" remote = pxssh.pxssh() t = remote.login(entry.host, account, passwd) print("Login done") remote.sendline(ssh_cmd) remote.prompt() remote.logout() print("Update the PM Relation to {host}:{port}.".format(host=entry.host, port=entry.port)) entry.dump_pretty() req = Message.CmdUpdatePMRelationReq(pm_relation=entry) res = Client.send_message(entry.addr, req)
def sendStartupRequest(self, entry) : #''' ===== still have prombles I need to debug ===== ''' print("Send request to {addr}".format( addr = entry.strAddr() )) script_dir = '/mnt/images/nfs/new_roystonea_script/roystonea_script/' script_file = self.convnameType2Script(entry.level) script_ab_file = script_dir + script_file log_ab_file = script_dir + "log/{host}-{port}-printout.txt".format(host=entry.host, port=entry.port); ssh_cmd = "nohup python {script_absolute_filepath} {host} {port} console_off > {log_ab} &".format( script_absolute_filepath = script_ab_file, host=entry.host, port=entry.port, log_ab=log_ab_file ) print( ssh_cmd) account = 'ot32em' passwd = '' remote = pxssh.pxssh() t = remote.login( entry.host, account, passwd ) print("Login done") remote.sendline( ssh_cmd ) remote.prompt() remote.logout() print("Update the PM Relation to {host}:{port}.".format(host=entry.host, port=entry.port) ) entry.dump_pretty() req = Message.CmdUpdatePMRelationReq(pm_relation=entry) res = Client.send_message( entry.addr, req )
def HypervisorReqHandler(self, request): print request if request.type == 'ubuntu': VM_initializer = VM_initializer_ubuntu(request.id, request.owner, request.group_num, request.vm_num, request.mem, request.disk, request.cores, request.hostmachine) VM_initializer.start() res = Message.NodeHypervisorRt(status='Success', msg=str(request.id) + '-' + request.owner, vm_id=request.id) print res.status print res.msg print request.id Client.sendonly_message(self.server.pm_relation.parent_addr, res)
def sendShutdownRequest(self, entry): cmdreq = Message.CmdShutdownReq(after_secs=0) cmdres = Client.send_object(entry.addr, cmdreq)
def sendReconfigRequest(self, entry): # reconfig cmdreq = Message.CmdSetPMRelationReq(pm_relation=entry) cmdres = Client.send_object(entry.addr, cmdreq)
def sendShutdownRequest(self, entry) : cmdreq = Message.CmdShutdownReq(after_secs=0) cmdres = Client.send_object( entry.addr, cmdreq )
def sendReconfigRequest(self, entry) : # reconfig cmdreq = Message.CmdSetPMRelationReq(pm_relation=entry) cmdres = Client.send_object( entry.addr, cmdreq )
def shutdown(self, req): # execute xm shutdown req.vm_id shutdown = "xm shutdown "+ str(req.vm_id) pexpect.run(shutdown) msg = Message.ShutdownRes(msg = "Success", hostname = req.node, vm_id = req.vm_id) Client.sendonly_message(self.server.pm_relation.parent_addr)