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:
anthony 2010-10-15 13:54:53 -07:00
parent 182c3de665
commit 1b477750e0
3 changed files with 4 additions and 9 deletions

View File

@ -4099,15 +4099,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);

View File

@ -199,7 +199,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)

View File

@ -1359,7 +1359,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;
}