From 462a37d1b4d394c9b600ee68c0ea877b0eee1af0 Mon Sep 17 00:00:00 2001 From: Rohit Yadav Date: Mon, 25 Mar 2019 13:57:21 +0530 Subject: [PATCH] server: make snapshotting on KVM non-blocking (#3209) * server: make snapshotting on KVM non-blocking This references and uses an already fixed solution from https://github.com/MissionCriticalCloud/cosmic/pull/68 to make snapshotting on KVM non-blocking. Signed-off-by: Rohit Yadav * move StorageSubSystemCommand instanceof check above as CopyCommand is a type of StorageSubSystemCommand Signed-off-by: Rohit Yadav --- .../src/main/java/com/cloud/hypervisor/KVMGuru.java | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/server/src/main/java/com/cloud/hypervisor/KVMGuru.java b/server/src/main/java/com/cloud/hypervisor/KVMGuru.java index df6038d715a..c512f06a4fd 100644 --- a/server/src/main/java/com/cloud/hypervisor/KVMGuru.java +++ b/server/src/main/java/com/cloud/hypervisor/KVMGuru.java @@ -126,6 +126,10 @@ public class KVMGuru extends HypervisorGuruBase implements HypervisorGuru { @Override public Pair getCommandHostDelegation(long hostId, Command cmd) { + if (cmd instanceof StorageSubSystemCommand) { + StorageSubSystemCommand c = (StorageSubSystemCommand)cmd; + c.setExecuteInSequence(false); + } if (cmd instanceof CopyCommand) { CopyCommand c = (CopyCommand) cmd; boolean inSeq = true; @@ -137,12 +141,11 @@ public class KVMGuru extends HypervisorGuruBase implements HypervisorGuru { inSeq = false; } c.setExecuteInSequence(inSeq); + if (c.getSrcTO().getHypervisorType() == HypervisorType.KVM) { + return new Pair<>(true, hostId); + } } - if (cmd instanceof StorageSubSystemCommand) { - StorageSubSystemCommand c = (StorageSubSystemCommand)cmd; - c.setExecuteInSequence(false); - } - return new Pair(false, new Long(hostId)); + return new Pair<>(false, hostId); } @Override