@Override public List<? extends Host> getHosts(StoragePool pool) { return create() .select(HOST.fields()) .from(HOST) .join(STORAGE_POOL_HOST_MAP) .on(STORAGE_POOL_HOST_MAP.HOST_ID.eq(HOST.ID)) .where( STORAGE_POOL_HOST_MAP .REMOVED .isNull() .and(STORAGE_POOL_HOST_MAP.STORAGE_POOL_ID.eq(pool.getId()))) .fetchInto(HostRecord.class); }
@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); }