def getLiveVm (self, thepid, getargs = True): # deprecated if thepid: #dct = self.getLivePorts() dct = get_active_kvm_ports() if dct: vm = VirtualMachine (pid=thepid, ports=dct [thepid]) if getargs: vm.init (meta.get (os.path.join (vmbase, vm.dirname), 'parms.sh')) return vm
def getLiveVmByPort (self, theport, getargs = True): lst = Cmd_netstat()() if not lst: return None #if self.trace: print 'getLiveVmByPort:', theport, lst for port, pid in lst: # will return a flawed VM, with only this port showing, but this will work for now if port == int (theport): #if self.trace: print 'getLiveVmByPort 2:', port, pid #return VirtualMachine (pid=pid, ports=[port]) vm = VirtualMachine (pid=pid, ports=[port]) if getargs: vm.init (meta.get (os.path.join (vmbase, vm.dirname), 'parms.sh')) return vm