Exemplo n.º 1
0
 def pending_elasticity_tickets(self):
   tickets = []
   for t in Session.query(PoolTicket).filter_by(pool=self).all():
     if not t.done and t.action_id in [PoolTicketActions.expand.value, PoolTicketActions.shrink.value]:
       tickets.append(t)
       print("found ticket: {}".format(t.done))
   return tickets
Exemplo n.º 2
0
 def pending_elasticity_tickets(self):
     tickets = []
     for t in Session.query(PoolTicket).filter_by(pool=self).all():
         if not t.done and t.action_id in [
                 PoolTicketActions.expand.value,
                 PoolTicketActions.shrink.value
         ]:
             tickets.append(t)
             print("found ticket: {}".format(t.done))
     return tickets
Exemplo n.º 3
0
def all_pools_and_members():
  """
  Gets all pools efficiently by caching VMs per zone
  :return: A array of pool, member_array tuples
  """
  a = []
  zone_vm_cache = {}
  for pool in Session.query(VirtualMachinePool).all():
    if not pool.cluster.zone.name in zone_vm_cache:
      logging.info("VM cache for zone {} doesn't exist...".format(pool.cluster.zone.name))
      one_proxy = OneProxy(pool.cluster.zone.xmlrpc_uri, pool.cluster.zone.session_string, verify_certs=False)
      zone_vm_cache[pool.cluster.zone.name] = {vm.id: vm for vm in one_proxy.get_vms(INCLUDING_DONE)}
      logging.info("VM cache for zone {} populated with {} entries".format(
        pool.cluster.zone.name, len(zone_vm_cache[pool.cluster.zone.name])))
    a.append((pool, pool.get_memberships(vm_cache=zone_vm_cache[pool.cluster.zone.name])))
  return a
Exemplo n.º 4
0
 def get_peer_pools(self):
   return Session.query(VirtualMachinePool).filter_by(cluster=self.cluster)
Exemplo n.º 5
0
 def get_all(cluster):
   return Session.query(VirtualMachinePool).filter_by(cluster=cluster)
Exemplo n.º 6
0
 def pending_ticket(self):
   return Session.query(PoolTicket).filter_by(pool=self, done=False).first()
Exemplo n.º 7
0
 def get_peer_pools(self):
     return Session.query(VirtualMachinePool).filter_by(
         cluster=self.cluster)
Exemplo n.º 8
0
 def get_all(cluster):
     return Session.query(VirtualMachinePool).filter_by(cluster=cluster)
Exemplo n.º 9
0
 def pending_ticket(self):
     return Session.query(PoolTicket).filter_by(pool=self,
                                                done=False).first()