Revert "looks like lock tables don't return the tables locked"

This reverts commit 76781c10f8534acdd6f81c46952f88ade941e269.
This commit is contained in:
Alex Huang 2011-08-02 03:48:57 -07:00
parent 91550836cf
commit 79ddba246d
2 changed files with 10 additions and 7 deletions

View File

@ -385,6 +385,10 @@ public class SecurityGroupManagerImpl implements SecurityGroupManager, SecurityG
try {
PreparedStatement pstmt = txn.prepareAutoCloseStatement("LOCK TABLES op_vm_ruleset_log WRITE, op_nwgrp_work WRITE");
int tablesLocked = pstmt.executeUpdate();
if (tablesLocked != 2) {
s_logger.warn("Unable to get locks on both tables: " + tablesLocked);
return;
}
for (Long vmId : affectedVms) {
if (s_logger.isTraceEnabled()) {
s_logger.trace("Security Group Mgr: scheduling ruleset updates for " + vmId);
@ -423,6 +427,7 @@ public class SecurityGroupManagerImpl implements SecurityGroupManager, SecurityG
try {
PreparedStatement pstmt = txn.prepareAutoCloseStatement("UNLOCK TABLES");
int tablesUnlocked = pstmt.executeUpdate();
assert (tablesUnlocked == 2) : "Less than two tables unlocked: " + tablesUnlocked;
} catch (SQLException e) {
s_logger.warn("Unable to unlock tables");
}

View File

@ -1728,13 +1728,11 @@ public class VirtualMachineManagerImpl implements VirtualMachineManager, Listene
@Override
public boolean processAnswers(long agentId, long seq, Answer[] answers) {
for (final Answer answer : answers) {
if (answer.getClass() == StopAnswer.class) {
if (!answer.getResult()) {
s_logger.warn("Cleanup failed due to " + answer.getDetails());
} else {
if (s_logger.isDebugEnabled()) {
s_logger.debug("Cleanup succeeded. Details " + answer.getDetails());
}
if (!answer.getResult()) {
s_logger.warn("Cleanup failed due to " + answer.getDetails());
} else {
if (s_logger.isDebugEnabled()) {
s_logger.debug("Cleanup succeeded. Details " + answer.getDetails());
}
}
}