Some more commands with improper transactions

reviewed-by: Marvin
This commit is contained in:
Prasanna Santhanam 2012-08-27 20:23:50 +05:30
parent b1a4ebd84d
commit d87711f20e
2 changed files with 3 additions and 2 deletions

View File

@ -588,10 +588,10 @@ public class MockStorageManagerImpl implements MockStorageManager {
return new GetStorageStatsAnswer(cmd, "Can't find the secondary storage:" + secUrl); return new GetStorageStatsAnswer(cmd, "Can't find the secondary storage:" + secUrl);
} }
Long totalUsed = _mockVolumeDao.findTotalStorageId(secondary.getId()); Long totalUsed = _mockVolumeDao.findTotalStorageId(secondary.getId());
txn.commit();
return new GetStorageStatsAnswer(cmd, secondary.getCapacity(), totalUsed); return new GetStorageStatsAnswer(cmd, secondary.getCapacity(), totalUsed);
} else { } else {
MockStoragePoolVO pool = _mockStoragePoolDao.findByUuid(uuid); MockStoragePoolVO pool = _mockStoragePoolDao.findByUuid(uuid);
txn.commit();
if (pool == null) { if (pool == null) {
return new GetStorageStatsAnswer(cmd, "Can't find the pool"); return new GetStorageStatsAnswer(cmd, "Can't find the pool");
} }
@ -599,6 +599,7 @@ public class MockStorageManagerImpl implements MockStorageManager {
if (totalUsed == null) { if (totalUsed == null) {
totalUsed = 0L; totalUsed = 0L;
} }
txn.commit();
return new GetStorageStatsAnswer(cmd, pool.getCapacity(), totalUsed); return new GetStorageStatsAnswer(cmd, pool.getCapacity(), totalUsed);
} }
} catch (Exception ex) { } catch (Exception ex) {

View File

@ -149,7 +149,7 @@ public class SimulatorManagerImpl implements SimulatorManager {
@DB @DB
@Override @Override
public Answer simulate(Command cmd, String hostGuid) { public Answer simulate(Command cmd, String hostGuid) {
Transaction txn = Transaction.currentTxn(); Transaction txn = Transaction.open(Transaction.SIMULATOR_DB);
txn.transitToUserManagedConnection(_concierge.conn()); txn.transitToUserManagedConnection(_concierge.conn());
try { try {