Skip to content

Commit

Permalink
Merge pull request #68 from MissionCriticalCloud/fix/kvm_blocking_sna…
Browse files Browse the repository at this point in the history
…pshots

Make snapshotting on KVM non-blocking
  • Loading branch information
wilderrodrigues authored Sep 1, 2016
2 parents 1de9a7e + b1f6a06 commit 08741e0
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions cosmic-core/server/src/main/java/com/cloud/hypervisor/KVMGuru.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import com.cloud.agent.api.Command;
import com.cloud.agent.api.to.DataObjectType;
import com.cloud.agent.api.to.DataTO;
import com.cloud.agent.api.to.VirtualMachineTO;
import com.cloud.host.HostVO;
import com.cloud.host.dao.HostDao;
Expand Down Expand Up @@ -33,8 +34,14 @@ protected KVMGuru() {

@Override
public Pair<Boolean, Long> getCommandHostDelegation(final long hostId, final Command cmd) {

if (cmd instanceof StorageSubSystemCommand) {
final StorageSubSystemCommand c = (StorageSubSystemCommand) cmd;
c.setExecuteInSequence(false);
}
if (cmd instanceof CopyCommand) {
final CopyCommand c = (CopyCommand) cmd;
final DataTO srcData = c.getSrcTO();
boolean inSeq = true;
if (c.getSrcTO().getObjectType() == DataObjectType.SNAPSHOT ||
c.getDestTO().getObjectType() == DataObjectType.SNAPSHOT) {
Expand All @@ -44,11 +51,11 @@ public Pair<Boolean, Long> getCommandHostDelegation(final long hostId, final Com
inSeq = false;
}
c.setExecuteInSequence(inSeq);
if (srcData.getHypervisorType() == HypervisorType.KVM) {
return new Pair<>(true, new Long(hostId));
}
}
if (cmd instanceof StorageSubSystemCommand) {
final StorageSubSystemCommand c = (StorageSubSystemCommand) cmd;
c.setExecuteInSequence(false);
}

return new Pair<>(false, new Long(hostId));
}

Expand Down

0 comments on commit 08741e0

Please sign in to comment.