use of com.cloud.storage.StoragePoolHostVO in project cloudstack by apache.
the class ElastistorPrimaryDataStoreLifeCycle method deleteDataStore.
@SuppressWarnings("finally")
@Override
public boolean deleteDataStore(DataStore store) {
List<StoragePoolHostVO> hostPoolRecords = _storagePoolHostDao.listByPoolId(store.getId());
StoragePool pool = (StoragePool) store;
// find the hypervisor where the storage is attached to.
HypervisorType hType = null;
if (hostPoolRecords.size() > 0) {
hType = getHypervisorType(hostPoolRecords.get(0).getHostId());
}
StoragePoolVO storagePoolVO = _storagePoolDao.findById(store.getId());
if (!(storagePoolVO.isManaged())) {
// Remove the SR associated with the Xenserver
for (StoragePoolHostVO host : hostPoolRecords) {
DeleteStoragePoolCommand deleteCmd = new DeleteStoragePoolCommand(pool);
final Answer answer = agentMgr.easySend(host.getHostId(), deleteCmd);
if (answer != null && answer.getResult()) {
// to all the kvm hosts.
if (HypervisorType.KVM != hType) {
break;
}
} else {
if (answer != null) {
s_logger.error("Failed to delete storage pool: " + answer.getResult());
}
}
}
}
// delete the Elastistor volume at backend
deleteElastistorVolume(pool, storagePoolVO.isManaged());
return _dataStoreHelper.deletePrimaryDataStore(store);
}
use of com.cloud.storage.StoragePoolHostVO in project cloudstack by apache.
the class DeploymentPlanningManagerImpl method hostCanAccessSPool.
protected boolean hostCanAccessSPool(Host host, StoragePool pool) {
boolean hostCanAccessSPool = false;
StoragePoolHostVO hostPoolLinkage = _poolHostDao.findByPoolHost(pool.getId(), host.getId());
if (hostPoolLinkage != null) {
hostCanAccessSPool = true;
}
s_logger.debug("Host: " + host.getId() + (hostCanAccessSPool ? " can" : " cannot") + " access pool: " + pool.getId());
return hostCanAccessSPool;
}
Aggregations