Exemplo n.º 1
0
 def _create_monitor(self, info):
     guest = GuestMonitor(self.config, info, self.hypervisor_iface)
     if self._threaded:
         thread = GuestMonitorThread(info, guest)
         thread.start()
     else:
         thread = None
     return GuestData(guest, thread)
Exemplo n.º 2
0
 def spawn_guest_monitors(self, domain_list):
     """
     Get the list of running domains and spawn GuestMonitors for any guests
     we are not already tracking.  The GuestMonitor constructor might block
     so don't hold guests_sem while calling it.
     """
     self.guests_sem.acquire()
     spawn_list = set(domain_list) - set(self.guests)
     self.guests_sem.release()
     for id in spawn_list:
         guest = GuestMonitor(self.config, id, self.libvirt_iface)
         if guest.isAlive():
             self.guests_sem.acquire()
             if id not in self.guests:
                 self.guests[id] = guest
             else:
                 del guest
             self.guests_sem.release()
Exemplo n.º 3
0
 def spawn_guest_monitors(self, domain_list):
     """
     Get the list of running domains and spawn GuestMonitors for any guests
     we are not already tracking.  The GuestMonitor constructor might block
     so don't hold guests_sem while calling it.
     """
     self.guests_sem.acquire()
     spawn_list = set(domain_list) - set(self.guests)
     self.guests_sem.release()
     for id in spawn_list:
         info = self.hypervisor_iface.getVmInfo(id)
         if info is None:
             self.logger.error("Failed to get guest:%s information -- monitor "\
                 "can't start", id)
             continue
         guest = GuestMonitor(self.config, info, self.hypervisor_iface)
         if guest.isAlive():
             self.guests_sem.acquire()
             if id not in self.guests:
                 self.guests[id] = guest
             else:
                 del guest
             self.guests_sem.release()
Exemplo n.º 4
0
 def spawn_guest_monitors(self, domain_list):
     """
     Get the list of running domains and spawn GuestMonitors for any guests
     we are not already tracking.  The GuestMonitor constructor might block
     so don't hold guests_sem while calling it.
     """
     self.guests_sem.acquire()
     spawn_list = set(domain_list) - set(self.guests)
     self.guests_sem.release()
     for id in spawn_list:
         info = self.hypervisor_iface.getVmInfo(id)
         if info is None:
             self.logger.error("Failed to get guest:%s information -- monitor "\
                 "can't start", id)
             continue
         guest = GuestMonitor(self.config, info, self.hypervisor_iface)
         if guest.isAlive():
             self.guests_sem.acquire()
             if id not in self.guests:
                 self.guests[id] = guest
             else:
                 del guest
             self.guests_sem.release()