Exemplo n.º 1
0
 def refresh(self):
     clients = self.group.get_clients().values()
     if len(clients) == 0:
         raise VirtRuntimeError(
             "Pool discovery needs at least one client in the node group.")
     self.client = clients[0]
     pool_list = self.client.get_pool_list()
     if self.name not in pool_list:
         raise VirtRuntimeError("Can't find pool %s in pool list (%s)" %
                                (self.name, pool_list))
     vol_list = self.client.get_vol_list(self.name)
     for vol_name in vol_list:
         vol_info = self.parse_volume_name(vol_name)
         if vol_info is None:
             logger.debug("%s does not match rules for pool %s", vol_name,
                          self.name)
             continue
         if vol_name not in self.volumes.keys():
             self.volumes[vol_name] = Volume(self.conf, vol_name,
                                             self.group, self)
     for volume in self.volumes.values():
         volume.refresh()
Exemplo n.º 2
0
 def __init__(self, conf, name, group, pool):
     self.conf = conf
     self.name = name
     self.group = group
     self.pool = pool
     data = self.pool.parse_volume_name(self.name)
     if data is None:
         raise VirtRuntimeError(
             "Failed to parse the name of the volume " +
             "'%s' with the pool %s", (self.name, self.pool.get_name()))
     self.vm_name = data['vm_name']
     self.role = data['vol_role']
     self.client = None
     self.capacity_bytes = 0L
     self.allocation_bytes = 0L
     self.path = ""
Exemplo n.º 3
0
 def refresh(self):
     clients = list(self.group.get_clients().values())
     if len(clients) == 0:
         raise VirtRuntimeError(
             "Volume discovery needs at least one client in the node group.")
     self.client = clients[0]
     pool_name = self.pool.get_name()
     vol_list = self.client.get_vol_list(pool_name)
     if self.name in vol_list:
         self.state = "PRESENT"
         self.capacity_bytes = self.client.get_vol_capacity_bytes(
             pool_name, self.name)
         self.allocation_bytes = self.client.get_vol_allocation_bytes(
             pool_name, self.name)
         self.path = self.client.get_vol_path(pool_name, self.name)
     else:
         self.state = "MISSING"
         self.capacity_bytes = 0
         self.allocation_bytes = 0
         self.path = ""