mirror of
https://github.com/apache/cloudstack.git
synced 2025-11-02 11:52:28 +01:00
DeleteStoragePool command fix
1. not delete SR in xenserver side, only delete it in database.
2. remove a storagepool, adding it back fails
This commit is contained in:
parent
e851353ebe
commit
d41f7d78d9
@ -4379,15 +4379,9 @@ public abstract class CitrixResourceBase implements StoragePoolResource, ServerR
|
||||
try {
|
||||
Connection conn = getConnection();
|
||||
SR sr = getStorageRepository(conn, poolTO);
|
||||
sr.setNameLabel(conn, pool.getUuid());
|
||||
sr.setNameDescription(conn, pool.getName());
|
||||
|
||||
removeSR(sr);
|
||||
Answer answer = new Answer(cmd, true, "success");
|
||||
return answer;
|
||||
} catch (XenAPIException e) {
|
||||
String msg = "DeleteStoragePoolCommand XenAPIException:" + e.toString() + " host:" + _host.uuid + " pool: " + pool.getName() + pool.getHostAddress() + pool.getPath();
|
||||
s_logger.warn(msg, e);
|
||||
return new Answer(cmd, false, msg);
|
||||
} catch (Exception e) {
|
||||
String msg = "DeleteStoragePoolCommand XenAPIException:" + e.getMessage() + " host:" + _host.uuid + " pool: " + pool.getName() + pool.getHostAddress() + pool.getPath();
|
||||
s_logger.warn(msg, e);
|
||||
|
||||
@ -225,7 +225,7 @@ public class StoragePoolDaoImpl extends GenericDaoBase<StoragePoolVO, Long> imp
|
||||
sc.setParameters("hostAddress", host);
|
||||
sc.setParameters("path", path);
|
||||
|
||||
return listIncludingRemovedBy(sc);
|
||||
return listBy(sc);
|
||||
}
|
||||
|
||||
public StoragePoolVO listById(Integer id)
|
||||
|
||||
@ -1469,6 +1469,8 @@ public class StorageManagerImpl implements StorageManager {
|
||||
|
||||
// if not records exist, delete the given pool (base case)
|
||||
if (hostPoolRecords.size() == 0) {
|
||||
sPool.setUuid(null);
|
||||
_storagePoolDao.update(id, sPool);
|
||||
_storagePoolDao.remove(id);
|
||||
return true;
|
||||
} else {
|
||||
@ -1514,7 +1516,8 @@ public class StorageManagerImpl implements StorageManager {
|
||||
for (StoragePoolHostVO host : hostPoolRecords) {
|
||||
_storagePoolHostDao.deleteStoragePoolHostDetails(host.getHostId(),host.getPoolId());
|
||||
}
|
||||
|
||||
sPool.setUuid(null);
|
||||
_storagePoolDao.update(id, sPool);
|
||||
_storagePoolDao.remove(id);
|
||||
return true;
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user