execute fencecommand in seq for kvm, as there are only 5 default nio reading work threads on kvm agent. pinganswer may not be got serviced immediately, then agent will reconnect to mgt server again and again

This commit is contained in:
Edison Su 2012-01-20 17:04:17 -08:00
parent 3f07346087
commit ecab972060
3 changed files with 10 additions and 1 deletions

View File

@ -582,6 +582,8 @@ public class Agent implements HandlerFactory, IAgentControl {
try {
task.getLink().send(request.toBytes());
//if i can send pingcommand out, means the link is ok
setLastPingResponseTime();
} catch (final ClosedChannelException e) {
s_logger.warn("Unable to send request: " + request.toString());
}

View File

@ -29,12 +29,18 @@ public class FenceCommand extends Command {
String vmName;
String hostGuid;
String hostIp;
boolean inSeq;
public FenceCommand(VirtualMachine vm, Host host) {
super();
vmName = vm.getInstanceName();
hostGuid = host.getGuid();
hostIp = host.getPrivateIpAddress();
inSeq = false;
}
public void setSeq(boolean inseq) {
inSeq = inseq;
}
public String getVmName() {
@ -51,6 +57,6 @@ public class FenceCommand extends Command {
@Override
public boolean executeInSequence() {
return false;
return inSeq;
}
}

View File

@ -86,6 +86,7 @@ public class KVMFencer implements FenceBuilder {
List<HostVO> hosts = _resourceMgr.listAllHostsInCluster(host.getClusterId());
FenceCommand fence = new FenceCommand(vm, host);
fence.setSeq(true);
for (HostVO h : hosts) {
if (h.getHypervisorType() == HypervisorType.KVM) {