/** * Copyright (C) 2010 Cloud.com, Inc. All rights reserved. * * This software is licensed under the GNU General Public License v3 or later. * * It is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or any later version. * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * */ package com.cloud.storage.dao; import java.util.ArrayList; import java.util.List; import java.util.Map; import com.cloud.host.Status; import com.cloud.storage.StoragePoolStatus; import com.cloud.storage.StoragePoolVO; import com.cloud.utils.db.GenericDao; /** * Data Access Object for storage_pool table */ public interface StoragePoolDao extends GenericDao { /** * @param datacenterId -- the id of the datacenter (availability zone) * @return the list of storage pools in the datacenter */ List listByDataCenterId(long datacenterId); /** * @param datacenterId -- the id of the datacenter (availability zone) * @param podId the id of the pod * @return the list of storage pools in the datacenter */ List listBy(long datacenterId, long podId, Long clusterId); /** * Set capacity of storage pool in bytes * @param id pool id. * @param capacity capacity in bytes */ void updateCapacity(long id, long capacity); /** * Set available bytes of storage pool in bytes * @param id pool id. * @param available available capacity in bytes */ void updateAvailable(long id, long available); StoragePoolVO persist(StoragePoolVO pool, Map details); /** * Find pool by name. * * @param name name of pool. * @return the single StoragePoolVO */ List findPoolByName(String name); /** * Find pools by the pod that matches the details. * * @param podId pod id to find the pools in. * @param details details to match. All must match for the pool to be returned. * @return List of StoragePoolVO */ List findPoolsByDetails(long dcId, long podId, Long clusterId, Map details); List findPoolsByTags(long dcId, long podId, Long clusterId, String[] tags, Boolean shared); /** * Find pool by UUID. * * @param uuid uuid of pool. * @return the single StoragePoolVO */ StoragePoolVO findPoolByUUID(String uuid); List listByStorageHost(String hostFqdnOrIp); StoragePoolVO findPoolByHostPath(long dcId, Long podId, String host, String path, String uuid); List listPoolByHostPath(String host, String path); void deleteStoragePoolRecords(ArrayList ids); void updateDetails(long poolId, Map details); Map getDetails(long poolId); List searchForStoragePoolDetails(long poolId, String value); List findIfDuplicatePoolsExistByUUID(String uuid); List listByStatus(StoragePoolStatus status); long countPoolsByStatus(StoragePoolStatus... statuses); }