Пример #1
0
 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
Пример #2
0
  def _updateLiveVms (self):  # updates and returns self.vms dict - internal use
    dct = get_active_kvm_ports()  # returns pid / ports dict

    for pid, ports in dct.iteritems():
        mid = ports2mid (ports)
        if mid: assert isinstance (mid, basestring), type(mid)
        try:
            self.vms [mid].update (pid, ports)
        except Exception, e:
            print 'WARNING: Running VM not declared, pid: %s, ports: %s (%s)' % (pid, ports, e) #, mid
Пример #3
0
def _update_live_vms():    # updates and returns vms dict - internal use
    global vms
    dct = get_active_kvm_ports()  # returns pid / ports dict

    for pid, ports in dct.iteritems():
        mid = ports2mid (ports)
        print pid, ports
        if mid: assert isinstance (mid, basestring), type(mid)
        try:
            #print self.vms, mid, `mid`
            vms [mid].update (pid, ports)
        except Exception, e:
            print 'WARNING: Running VM not declared, pid: %s, ports: %s (%s)' % (pid, ports, `e`) #, mid