mirror of https://github.com/apache/cloudstack.git
fix register local storage: if host is reinstalled, local storage uuid is changed, we need to register a new local storage in db
This commit is contained in:
parent
9528b4de4f
commit
2279f8f962
|
|
@ -82,7 +82,7 @@ public class LocalStoragePoolListener implements Listener {
|
|||
}
|
||||
|
||||
try {
|
||||
StoragePoolVO pool = _storagePoolDao.findPoolByHostPath(host.getDataCenterId(), host.getPodId(), pInfo.getHost(), pInfo.getHostPath());
|
||||
StoragePoolVO pool = _storagePoolDao.findPoolByHostPath(host.getDataCenterId(), host.getPodId(), pInfo.getHost(), pInfo.getHostPath(), pInfo.getUuid());
|
||||
if (pool == null) {
|
||||
long poolId = _storagePoolDao.getNextInSequence(Long.class, "id");
|
||||
String name = cmd.getName() == null ? (host.getName() + " Local Storage") : cmd.getName();
|
||||
|
|
|
|||
|
|
@ -89,7 +89,7 @@ public interface StoragePoolDao extends GenericDao<StoragePoolVO, Long> {
|
|||
|
||||
List<StoragePoolVO> listByStorageHost(String hostFqdnOrIp);
|
||||
|
||||
StoragePoolVO findPoolByHostPath(long dcId, Long podId, String host, String path);
|
||||
StoragePoolVO findPoolByHostPath(long dcId, Long podId, String host, String path, String uuid);
|
||||
|
||||
List<StoragePoolVO> listPoolByHostPath(String host, String path);
|
||||
|
||||
|
|
|
|||
|
|
@ -115,6 +115,7 @@ public class StoragePoolDaoImpl extends GenericDaoBase<StoragePoolVO, Long> imp
|
|||
HostPathDcPodSearch.and("path", HostPathDcPodSearch.entity().getPath(), SearchCriteria.Op.EQ);
|
||||
HostPathDcPodSearch.and("datacenterId", HostPathDcPodSearch.entity().getDataCenterId(), Op.EQ);
|
||||
HostPathDcPodSearch.and("podId", HostPathDcPodSearch.entity().getPodId(), Op.EQ);
|
||||
HostPathDcPodSearch.and("uuid", HostPathDcPodSearch.entity().getUuid(), Op.EQ);
|
||||
HostPathDcPodSearch.done();
|
||||
|
||||
HostPathDcSearch = createSearchBuilder();
|
||||
|
|
@ -145,6 +146,8 @@ public class StoragePoolDaoImpl extends GenericDaoBase<StoragePoolVO, Long> imp
|
|||
sc.setParameters("uuid", uuid);
|
||||
return findOneIncludingRemovedBy(sc);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public List<StoragePoolVO> findIfDuplicatePoolsExistByUUID(String uuid) {
|
||||
|
|
@ -193,12 +196,13 @@ public class StoragePoolDaoImpl extends GenericDaoBase<StoragePoolVO, Long> imp
|
|||
}
|
||||
|
||||
@Override
|
||||
public StoragePoolVO findPoolByHostPath(long datacenterId, Long podId, String host, String path) {
|
||||
public StoragePoolVO findPoolByHostPath(long datacenterId, Long podId, String host, String path, String uuid) {
|
||||
SearchCriteria<StoragePoolVO> sc = HostPathDcPodSearch.create();
|
||||
sc.setParameters("hostAddress", host);
|
||||
sc.setParameters("path", path);
|
||||
sc.setParameters("datacenterId", datacenterId);
|
||||
sc.setParameters("podId", podId);
|
||||
sc.setParameters("uuid", uuid);
|
||||
|
||||
return findOneBy(sc);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue