Example #1
0
 @Override
 public List<? extends StoragePool> getAssociatedPools(Volume volume) {
   return create()
       .select(STORAGE_POOL.fields())
       .from(STORAGE_POOL)
       .join(VOLUME_STORAGE_POOL_MAP)
       .on(VOLUME_STORAGE_POOL_MAP.STORAGE_POOL_ID.eq(STORAGE_POOL.ID))
       .where(
           VOLUME_STORAGE_POOL_MAP
               .REMOVED
               .isNull()
               .and(VOLUME_STORAGE_POOL_MAP.VOLUME_ID.eq(volume.getId())))
       .fetchInto(StoragePoolRecord.class);
 }
Example #2
0
 @Override
 public List<? extends StoragePool> getAssociatedUnmanagedPools(Host host) {
   return create()
       .select(STORAGE_POOL.fields())
       .from(STORAGE_POOL)
       .join(STORAGE_POOL_HOST_MAP)
       .on(STORAGE_POOL_HOST_MAP.STORAGE_POOL_ID.eq(STORAGE_POOL.ID))
       .where(
           STORAGE_POOL_HOST_MAP
               .REMOVED
               .isNull()
               .and(
                   STORAGE_POOL_HOST_MAP
                       .HOST_ID
                       .eq(host.getId())
                       .and(STORAGE_POOL.KIND.in(AllocatorUtils.UNMANGED_STORAGE_POOLS))))
       .fetchInto(StoragePoolRecord.class);
 }
Example #3
0
 @Override
 public boolean isInstanceImageKind(long instanceId, String kind) {
   return create()
           .select(STORAGE_POOL.fields())
           .from(STORAGE_POOL)
           .join(IMAGE_STORAGE_POOL_MAP)
           .on(STORAGE_POOL.ID.eq(IMAGE_STORAGE_POOL_MAP.STORAGE_POOL_ID))
           .join(IMAGE)
           .on(IMAGE.ID.eq(IMAGE_STORAGE_POOL_MAP.IMAGE_ID))
           .join(INSTANCE)
           .on(INSTANCE.IMAGE_ID.eq(IMAGE.ID))
           .where(
               INSTANCE
                   .ID
                   .eq(instanceId)
                   .and(IMAGE_STORAGE_POOL_MAP.REMOVED.isNull())
                   .and(STORAGE_POOL.KIND.eq(kind)))
           .fetch()
           .size()
       > 0;
 }