Change in vdsm[master]: [WIP] Add text-based console support

Xu He Jie xuhj at linux.vnet.ibm.com
Tue Sep 4 06:10:37 UTC 2012


Xu He Jie has posted comments on this change.

Change subject: [WIP] Add text-based console support
......................................................................


Patch Set 2: (9 inline comments)

Thanks for both of your review!

....................................................
File vdsm/consoleServer.py
Line 26: import select
Line 27: import os
Line 28: import threading
Line 29: import errno
Line 30: 
zheng sheng, thanks for your explain!
Line 31: import paramiko
Line 32: 
Line 33: from vdsm import constants
Line 34: from vdsm.betterPopen import BetterPopen


Line 76:                 sock.close()
Line 77:                 continue
Line 78:             return p, sock
Line 79: 
Line 80:         raise Exception("can not allocated any port on %s", self._addr)
Done
Line 81: 
Line 82:     def setTicket(self, passwd, timeout, connAct):
Line 83:         try:
Line 84:             return self._crabRPCProxy.callCrabRPCFunction(10, "setTicket",


Line 107:                                       str(self._rpcProxyRd),
Line 108:                                       str(self._rpcServerWr),
Line 109:                                       self._hostKeyFile],
Line 110:                                      close_fds=False, env=env)
Line 111:         finally:
just raise the exception to up-level, There is nothing to do for it's failure.
Line 112:             pty.close()
Line 113: 
Line 114:     def isOpen(self):
Line 115:         return self._prog != None and self._prog.poll() == None


Line 111:         finally:
Line 112:             pty.close()
Line 113: 
Line 114:     def isOpen(self):
Line 115:         return self._prog != None and self._prog.poll() == None
poll is used for checking subprocess is alive or not with non-block. if the process is dead, poll will get return code.
Line 116: 
Line 117:     def close(self):
Line 118:         if self.isOpen():
Line 119:             self._prog.terminate()


....................................................
File vdsm/libvirtvm.py
Line 1283:         self.guestAgent = guestIF.GuestAgent(self._guestSocketFile,
Line 1284:             self.cif.channelListener, self.log,
Line 1285:             connect=utils.tobool(self.conf.get('vmchannel', 'true')))
Line 1286: 
Line 1287:         if utils.tobool(self.conf.get("enableConsole", False)):
I prefer 'consoleEnable' or 'textConsoleEnable' now. When sort the attr in schema, ahead console will be easy to find.
Line 1288:             self.log.info("vm console enabled")
Line 1289: 
Line 1290:             supervdsm.getProxy().changePtyOwner(
Line 1291:                 int(os.path.basename(self.conf["consolePath"])))


Line 1989:         hooks.before_vm_set_ticket(self._lastXMLDesc, self.conf, params)
Line 1990: 
Line 1991:         if actOn == "graphics":
Line 1992:             graphics = xml.dom.minidom.parseString(self._dom.XMLDesc(0)) \
Line 1993:                               .childNodes[0].getElementsByTagName('graphics')[0]
I guess rebase error.
Line 1994:             graphics.setAttribute('passwd', otp)
Line 1995:             if int(seconds) > 0:
Line 1996:                 validto = time.strftime('%Y-%m-%dT%H:%M:%S',
Line 1997:                                         time.gmtime(time.time() + float(seconds)))


Line 2007:                     return {'status':
Line 2008:                             {'code': errCode['ticketErr']['status']['code'],
Line 2009:                              'message': 'setTicket failed on console'}}
Line 2010:             else:
Line 2011:                 self.log.error("console was disable")
Done
Line 2012:                 return {'status': {'code':
Line 2013:                                    errCode['ticketErr']['status']['code'],
Line 2014:                                'message': 'console was disable'}}
Line 2015:         else:


....................................................
File vdsm/supervdsmServer.py
Line 282:     def changePtyOwner(self, ptyNum):
Line 283:         if type(ptyNum) != int:
Line 284:             raise TypeError("ptyNum must be integer")
Line 285: 
Line 286:         cmd = [EXT_CHOWN, "vdsm:kvm", "/dev/pts/" + str(ptyNum)]
Done
Line 287:         rc, out, err = storage.misc.execCmd(cmd, sudo=False)
Line 288:         if rc:
Line 289:             raise OSError(errno.EINVAL, "can not change own of /dev/pts/%d, " \
Line 290:                           "out: %s\nerr: %s" %


Line 285: 
Line 286:         cmd = [EXT_CHOWN, "vdsm:kvm", "/dev/pts/" + str(ptyNum)]
Line 287:         rc, out, err = storage.misc.execCmd(cmd, sudo=False)
Line 288:         if rc:
Line 289:             raise OSError(errno.EINVAL, "can not change own of /dev/pts/%d, " \
Done
Line 290:                           "out: %s\nerr: %s" %
Line 291:                           (ptyNum, out, err))
Line 292: 
Line 293: 


--
To view, visit http://gerrit.ovirt.org/7165
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: I69904bf7aafd4f764a256d4075c9bf71d988e7c5
Gerrit-PatchSet: 2
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Xu He Jie <xuhj at linux.vnet.ibm.com>
Gerrit-Reviewer: Adam Litke <agl at us.ibm.com>
Gerrit-Reviewer: Dan Kenigsberg <danken at redhat.com>
Gerrit-Reviewer: Mark Wu <wudxw at linux.vnet.ibm.com>
Gerrit-Reviewer: Royce Lv <lvroyce at linux.vnet.ibm.com>
Gerrit-Reviewer: Ryan Harper <ryanh at us.ibm.com>
Gerrit-Reviewer: ShaoHe Feng <shaohef at linux.vnet.ibm.com>
Gerrit-Reviewer: Xu He Jie <xuhj at linux.vnet.ibm.com>
Gerrit-Reviewer: Zhou Zheng Sheng <zhshzhou at linux.vnet.ibm.com>
Gerrit-Reviewer: oVirt Jenkins CI Server


More information about the vdsm-patches mailing list