1. return message to UI if adding primary storage failed

2. delete primary storage entry if if adding primary storage failed
This commit is contained in:
anthony 2011-06-22 18:38:20 -07:00
parent 7f8b129dc5
commit 4bbed17d02
2 changed files with 7 additions and 8 deletions

View File

@ -1426,11 +1426,6 @@ public class AgentManagerImpl implements AgentManager, HandlerFactory, Manager {
return null;
}
if (!answer.getResult()) {
s_logger.warn("Unable to execute command: " + cmd.toString() + " due to " + answer.getDetails());
return null;
}
if (s_logger.isDebugEnabled() && answer.getDetails() != null) {
s_logger.debug("Details from executing " + cmd.getClass().toString() + ": " + answer.getDetails());
}

View File

@ -1420,12 +1420,16 @@ public class StorageManagerImpl implements StorageManager, StorageService, Manag
if (answer != null && answer.getResult()) {
return true;
} else {
_storagePoolDao.expunge(pool.getId());
String msg = "";
if (answer != null) {
s_logger.warn(" can not create strorage pool through host " + hostId + " due to " + answer.getDetails());
msg = "Can not create strorage pool through host " + hostId + " due to " + answer.getDetails();
s_logger.warn(msg);
} else {
s_logger.warn(" can not create strorage pool through host " + hostId + " due to CreateStoragePoolCommand returns null");
msg = "Can not create strorage pool through host " + hostId + " due to CreateStoragePoolCommand returns null";
s_logger.warn(msg);
}
return false;
throw new CloudRuntimeException(msg);
}
}