mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
List clusters was using the name of the command rather than the name of the cluster to search for clusters, which was resulting in no clusters returned. Fixed. CreateStoragePool was returning an array of one pool every time, simplified it to just return the pool and changed the UI to expect one pool rather than an array. Fixed the backend code for creating a storage pool to (a) generate a UUID based on host name, path, and a timestamp and (b) to list only active storage pools when checking for duplicates. This allows a storage pool to be create with the same path as a pool that had previously been deleted.
This commit is contained in:
parent
1a54c52d5e
commit
ebd06ae6f3
@ -29,27 +29,23 @@ import java.util.Set;
|
||||
import javax.ejb.Local;
|
||||
import javax.naming.ConfigurationException;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import com.cloud.host.HostVO;
|
||||
import com.cloud.host.Status;
|
||||
import com.cloud.storage.Storage.StoragePoolType;
|
||||
import com.cloud.storage.StoragePoolDetailVO;
|
||||
import com.cloud.storage.StoragePoolVO;
|
||||
import com.cloud.storage.Storage.StoragePoolType;
|
||||
import com.cloud.utils.component.ComponentLocator;
|
||||
import com.cloud.utils.db.DB;
|
||||
import com.cloud.utils.db.GenericDaoBase;
|
||||
import com.cloud.utils.db.GenericSearchBuilder;
|
||||
import com.cloud.utils.db.SearchBuilder;
|
||||
import com.cloud.utils.db.SearchCriteria;
|
||||
import com.cloud.utils.db.Transaction;
|
||||
import com.cloud.utils.db.SearchCriteria.Func;
|
||||
import com.cloud.utils.db.SearchCriteria.Op;
|
||||
import com.cloud.utils.db.Transaction;
|
||||
import com.cloud.utils.exception.CloudRuntimeException;
|
||||
|
||||
@Local(value={StoragePoolDao.class}) @DB(txn=false)
|
||||
public class StoragePoolDaoImpl extends GenericDaoBase<StoragePoolVO, Long> implements StoragePoolDao {
|
||||
private static final Logger s_logger = Logger.getLogger(StoragePoolDaoImpl.class);
|
||||
protected final SearchBuilder<StoragePoolVO> NameSearch;
|
||||
protected final SearchBuilder<StoragePoolVO> UUIDSearch;
|
||||
protected final SearchBuilder<StoragePoolVO> DatacenterSearch;
|
||||
@ -210,7 +206,7 @@ public class StoragePoolDaoImpl extends GenericDaoBase<StoragePoolVO, Long> imp
|
||||
sc.setParameters("hostAddress", host);
|
||||
sc.setParameters("path", path);
|
||||
|
||||
return listBy(sc);
|
||||
return listActiveBy(sc);
|
||||
}
|
||||
|
||||
public StoragePoolVO listById(Integer id)
|
||||
|
||||
@ -143,7 +143,6 @@ public class ListHostsCmd extends BaseListCmd {
|
||||
hostResponse.setIpAddress(host.getPrivateIpAddress());
|
||||
hostResponse.setVersion(host.getVersion());
|
||||
|
||||
// TODO: implement
|
||||
GuestOSCategoryVO guestOSCategory = ApiDBUtils.getHostGuestOSCategory(host.getId());
|
||||
if (guestOSCategory != null) {
|
||||
hostResponse.setOsCategoryId(guestOSCategory.getId());
|
||||
|
||||
@ -2765,7 +2765,7 @@ public class ManagementServerImpl implements ManagementServer {
|
||||
SearchCriteria<ClusterVO> sc = _clusterDao.createSearchCriteria();
|
||||
|
||||
Object id = cmd.getId();
|
||||
Object name = cmd.getName();
|
||||
Object name = cmd.getClusterName();
|
||||
Object podId = cmd.getPodId();
|
||||
Object zoneId = cmd.getZoneId();
|
||||
|
||||
|
||||
@ -1299,7 +1299,7 @@ public class StorageManagerImpl implements StorageManager {
|
||||
throw new ResourceAllocationException("No host exists to associate a storage pool with");
|
||||
}
|
||||
long poolId = _storagePoolDao.getNextInSequence(Long.class, "id");
|
||||
String uuid = UUID.nameUUIDFromBytes(new String(storageHost + hostPath).getBytes()).toString();
|
||||
String uuid = UUID.nameUUIDFromBytes(new String(storageHost + hostPath + System.currentTimeMillis()).getBytes()).toString();
|
||||
if (s_logger.isDebugEnabled()) {
|
||||
s_logger.debug("In createPool Setting poolId - " +poolId+ " uuid - " +uuid+ " zoneId - " +zoneId+ " podId - " +podId+ " poolName - " +cmd.getStoragePoolName());
|
||||
}
|
||||
|
||||
@ -1940,7 +1940,7 @@ function showStorageTab(domainId, targetTab) {
|
||||
dataType: "json",
|
||||
success: function(json) {
|
||||
var json = json.createstoragepoolresponse;
|
||||
poolJSONToTemplate(json.storagepool[0], template);
|
||||
poolJSONToTemplate(json, template);
|
||||
changeGridRowsTotal(submenuContent.find("#grid_rows_total"), 1);
|
||||
loadingImg.hide();
|
||||
rowContainer.show();
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user