cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From anthon...@apache.org
Subject [22/27] git commit: updated refs/heads/master to d4d5cab
Date Fri, 28 Mar 2014 23:35:29 GMT
CLOUDSTACK-5432:sync vm and storage commands on mgt server for kvm

Conflicts:

	engine/orchestration/src/com/cloud/vm/VirtualMachineManagerImpl.java
	server/src/com/cloud/hypervisor/KVMGuru.java


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/504a6cde
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/504a6cde
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/504a6cde

Branch: refs/heads/master
Commit: 504a6cdee253a5e964b093e37df32902923df5e5
Parents: bd752c2
Author: Edison Su <sudison@gmail.com>
Authored: Thu Mar 27 16:10:28 2014 -0700
Committer: Anthony Xu <anthony.xu@citrix.com>
Committed: Fri Mar 28 16:24:07 2014 -0700

----------------------------------------------------------------------
 .../storage/command/AttachCommand.java          |  6 ++++
 .../command/AttachPrimaryDataStoreCmd.java      |  5 ++++
 .../cloudstack/storage/command/CopyCommand.java |  4 +++
 .../storage/command/CreateObjectCommand.java    |  4 +++
 .../command/CreatePrimaryDataStoreCmd.java      |  4 +++
 .../storage/command/DeleteCommand.java          |  4 +++
 .../storage/command/DettachCommand.java         |  5 ++++
 .../storage/command/ForgetObjectCmd.java        |  5 ++++
 .../storage/command/IntroduceObjectCmd.java     |  5 ++++
 .../command/StorageSubSystemCommand.java        |  2 +-
 .../com/cloud/vm/VirtualMachineManagerImpl.java | 31 +++++++++++++++-----
 server/src/com/cloud/hypervisor/KVMGuru.java    | 13 ++++++++
 12 files changed, 79 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/504a6cde/core/src/org/apache/cloudstack/storage/command/AttachCommand.java
----------------------------------------------------------------------
diff --git a/core/src/org/apache/cloudstack/storage/command/AttachCommand.java b/core/src/org/apache/cloudstack/storage/command/AttachCommand.java
index 7e47ba4..303457b 100644
--- a/core/src/org/apache/cloudstack/storage/command/AttachCommand.java
+++ b/core/src/org/apache/cloudstack/storage/command/AttachCommand.java
@@ -24,6 +24,7 @@ import com.cloud.agent.api.to.DiskTO;
 public final class AttachCommand extends Command implements StorageSubSystemCommand {
     private DiskTO disk;
     private String vmName;
+    private boolean inSeq = false;
 
     public AttachCommand(DiskTO disk, String vmName) {
         super();
@@ -51,4 +52,9 @@ public final class AttachCommand extends Command implements StorageSubSystemComm
     public void setVmName(String vmName) {
         this.vmName = vmName;
     }
+
+    @Override
+    public void setExecuteInSequence(boolean inSeq) {
+        this.inSeq = inSeq;
+    }
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/504a6cde/core/src/org/apache/cloudstack/storage/command/AttachPrimaryDataStoreCmd.java
----------------------------------------------------------------------
diff --git a/core/src/org/apache/cloudstack/storage/command/AttachPrimaryDataStoreCmd.java
b/core/src/org/apache/cloudstack/storage/command/AttachPrimaryDataStoreCmd.java
index 2083876..25679ba 100644
--- a/core/src/org/apache/cloudstack/storage/command/AttachPrimaryDataStoreCmd.java
+++ b/core/src/org/apache/cloudstack/storage/command/AttachPrimaryDataStoreCmd.java
@@ -21,6 +21,11 @@ package org.apache.cloudstack.storage.command;
 import com.cloud.agent.api.Command;
 
 public final class AttachPrimaryDataStoreCmd extends Command implements StorageSubSystemCommand
{
+    @Override
+    public void setExecuteInSequence(boolean inSeq) {
+
+    }
+
     private final String dataStore;
 
     public AttachPrimaryDataStoreCmd(String uri) {

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/504a6cde/core/src/org/apache/cloudstack/storage/command/CopyCommand.java
----------------------------------------------------------------------
diff --git a/core/src/org/apache/cloudstack/storage/command/CopyCommand.java b/core/src/org/apache/cloudstack/storage/command/CopyCommand.java
index 446c61f..96822a4 100644
--- a/core/src/org/apache/cloudstack/storage/command/CopyCommand.java
+++ b/core/src/org/apache/cloudstack/storage/command/CopyCommand.java
@@ -78,4 +78,8 @@ public final class CopyCommand extends Command implements StorageSubSystemComman
         return options;
     }
 
+    @Override
+    public void setExecuteInSequence(boolean inSeq) {
+        this.executeInSequence = inSeq;
+    }
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/504a6cde/core/src/org/apache/cloudstack/storage/command/CreateObjectCommand.java
----------------------------------------------------------------------
diff --git a/core/src/org/apache/cloudstack/storage/command/CreateObjectCommand.java b/core/src/org/apache/cloudstack/storage/command/CreateObjectCommand.java
index 121a7ee..8c239b5 100644
--- a/core/src/org/apache/cloudstack/storage/command/CreateObjectCommand.java
+++ b/core/src/org/apache/cloudstack/storage/command/CreateObjectCommand.java
@@ -42,4 +42,8 @@ public final class CreateObjectCommand extends Command implements StorageSubSyst
         return this.data;
     }
 
+    @Override
+    public void setExecuteInSequence(boolean inSeq) {
+
+    }
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/504a6cde/core/src/org/apache/cloudstack/storage/command/CreatePrimaryDataStoreCmd.java
----------------------------------------------------------------------
diff --git a/core/src/org/apache/cloudstack/storage/command/CreatePrimaryDataStoreCmd.java
b/core/src/org/apache/cloudstack/storage/command/CreatePrimaryDataStoreCmd.java
index b536028..21716cf 100644
--- a/core/src/org/apache/cloudstack/storage/command/CreatePrimaryDataStoreCmd.java
+++ b/core/src/org/apache/cloudstack/storage/command/CreatePrimaryDataStoreCmd.java
@@ -35,4 +35,8 @@ public final class CreatePrimaryDataStoreCmd extends Command implements
StorageS
         return false;
     }
 
+    @Override
+    public void setExecuteInSequence(boolean inSeq) {
+
+    }
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/504a6cde/core/src/org/apache/cloudstack/storage/command/DeleteCommand.java
----------------------------------------------------------------------
diff --git a/core/src/org/apache/cloudstack/storage/command/DeleteCommand.java b/core/src/org/apache/cloudstack/storage/command/DeleteCommand.java
index 76696da..7445050 100644
--- a/core/src/org/apache/cloudstack/storage/command/DeleteCommand.java
+++ b/core/src/org/apache/cloudstack/storage/command/DeleteCommand.java
@@ -42,4 +42,8 @@ public final class DeleteCommand extends Command implements StorageSubSystemComm
         return this.data;
     }
 
+    @Override
+    public void setExecuteInSequence(boolean inSeq) {
+
+    }
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/504a6cde/core/src/org/apache/cloudstack/storage/command/DettachCommand.java
----------------------------------------------------------------------
diff --git a/core/src/org/apache/cloudstack/storage/command/DettachCommand.java b/core/src/org/apache/cloudstack/storage/command/DettachCommand.java
index 61cb88b..1e501d9 100644
--- a/core/src/org/apache/cloudstack/storage/command/DettachCommand.java
+++ b/core/src/org/apache/cloudstack/storage/command/DettachCommand.java
@@ -87,4 +87,9 @@ public class DettachCommand extends Command implements StorageSubSystemCommand
{
     public int getStoragePort() {
         return _storagePort;
     }
+
+    @Override
+    public void setExecuteInSequence(boolean inSeq) {
+
+    }
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/504a6cde/core/src/org/apache/cloudstack/storage/command/ForgetObjectCmd.java
----------------------------------------------------------------------
diff --git a/core/src/org/apache/cloudstack/storage/command/ForgetObjectCmd.java b/core/src/org/apache/cloudstack/storage/command/ForgetObjectCmd.java
index ffee0ab..981a098 100644
--- a/core/src/org/apache/cloudstack/storage/command/ForgetObjectCmd.java
+++ b/core/src/org/apache/cloudstack/storage/command/ForgetObjectCmd.java
@@ -36,4 +36,9 @@ public class ForgetObjectCmd extends Command implements StorageSubSystemCommand
     public boolean executeInSequence() {
         return false;
     }
+
+    @Override
+    public void setExecuteInSequence(boolean inSeq) {
+
+    }
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/504a6cde/core/src/org/apache/cloudstack/storage/command/IntroduceObjectCmd.java
----------------------------------------------------------------------
diff --git a/core/src/org/apache/cloudstack/storage/command/IntroduceObjectCmd.java b/core/src/org/apache/cloudstack/storage/command/IntroduceObjectCmd.java
index c6c6d23..b463b2c 100644
--- a/core/src/org/apache/cloudstack/storage/command/IntroduceObjectCmd.java
+++ b/core/src/org/apache/cloudstack/storage/command/IntroduceObjectCmd.java
@@ -36,4 +36,9 @@ public class IntroduceObjectCmd extends Command implements StorageSubSystemComma
     public boolean executeInSequence() {
         return false;
     }
+
+    @Override
+    public void setExecuteInSequence(boolean inSeq) {
+
+    }
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/504a6cde/core/src/org/apache/cloudstack/storage/command/StorageSubSystemCommand.java
----------------------------------------------------------------------
diff --git a/core/src/org/apache/cloudstack/storage/command/StorageSubSystemCommand.java b/core/src/org/apache/cloudstack/storage/command/StorageSubSystemCommand.java
index d14161a..fb7b373 100644
--- a/core/src/org/apache/cloudstack/storage/command/StorageSubSystemCommand.java
+++ b/core/src/org/apache/cloudstack/storage/command/StorageSubSystemCommand.java
@@ -19,5 +19,5 @@
 package org.apache.cloudstack.storage.command;
 
 public interface StorageSubSystemCommand {
-
+    void setExecuteInSequence(boolean inSeq);
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/504a6cde/engine/orchestration/src/com/cloud/vm/VirtualMachineManagerImpl.java
----------------------------------------------------------------------
diff --git a/engine/orchestration/src/com/cloud/vm/VirtualMachineManagerImpl.java b/engine/orchestration/src/com/cloud/vm/VirtualMachineManagerImpl.java
index e842d95..6a2a5f8 100755
--- a/engine/orchestration/src/com/cloud/vm/VirtualMachineManagerImpl.java
+++ b/engine/orchestration/src/com/cloud/vm/VirtualMachineManagerImpl.java
@@ -996,7 +996,9 @@ public class VirtualMachineManagerImpl extends ManagerBase implements
VirtualMac
                     handlePath(vmTO.getDisks(), vm.getHypervisorType());
 
                     cmds = new Commands(Command.OnError.Stop);
-                    cmds.addCommand(new StartCommand(vmTO, dest.getHost(), ExecuteInSequence.value()));
+
+                    cmds.addCommand(new StartCommand(vmTO, dest.getHost(), getExecuteInSequence(vm.getHypervisorType())));
+
 
                     vmGuru.finalizeDeployment(cmds, vmProfile, dest, ctx);
 
@@ -1045,9 +1047,10 @@ public class VirtualMachineManagerImpl extends ManagerBase implements
VirtualMac
                                 s_logger.info("The guru did not like the answers so stopping
" + vm);
                             }
 
-                            StopCommand cmd = new StopCommand(vm, ExecuteInSequence.value());
-                            StopAnswer answer = (StopAnswer)_agentMgr.easySend(destHostId,
cmd);
-                            if (answer != null) {
+                            StopCommand cmd = new StopCommand(vm, getExecuteInSequence(vm.getHypervisorType()));
+                            StopAnswer answer = (StopAnswer) _agentMgr.easySend(destHostId,
cmd);
+                            if ( answer != null ) {
+
                                 if (vm.getType() == VirtualMachine.Type.User) {
                                     String platform = answer.getPlatform();
                                     if (platform != null) {
@@ -1213,9 +1216,18 @@ public class VirtualMachineManagerImpl extends ManagerBase implements
VirtualMac
         }
     }
 
+
+    protected boolean getExecuteInSequence(HypervisorType hypervisorType) {
+        if (HypervisorType.KVM == hypervisorType) {
+            return false;
+        } else {
+            return ExecuteInSequence.value();
+        }
+    }
+
     protected boolean sendStop(VirtualMachineGuru guru, VirtualMachineProfile profile, boolean
force) {
         VirtualMachine vm = profile.getVirtualMachine();
-        StopCommand stop = new StopCommand(vm, ExecuteInSequence.value());
+        StopCommand stop = new StopCommand(vm, getExecuteInSequence(vm.getHypervisorType()));
         try {
             StopAnswer answer = (StopAnswer)_agentMgr.send(vm.getHostId(), stop);
             if (answer != null) {
@@ -1475,7 +1487,9 @@ public class VirtualMachineManagerImpl extends ManagerBase implements
VirtualMac
         }
 
         vmGuru.prepareStop(profile);
-        StopCommand stop = new StopCommand(vm, ExecuteInSequence.value());
+
+        StopCommand stop = new StopCommand(vm, getExecuteInSequence(vm.getHypervisorType()));
+
         boolean stopped = false;
         StopAnswer answer = null;
         try {
@@ -2450,11 +2464,12 @@ public class VirtualMachineManagerImpl extends ManagerBase implements
VirtualMac
     }
 
     public Command cleanup(VirtualMachine vm) {
-        return new StopCommand(vm, ExecuteInSequence.value());
+        return new StopCommand(vm, getExecuteInSequence(vm.getHypervisorType()));
     }
 
     public Command cleanup(String vmName) {
-        return new StopCommand(vmName, ExecuteInSequence.value());
+        return new StopCommand(vmName, getExecuteInSequence(null));
+
     }
 
     public Commands fullHostSync(final long hostId, StartupRoutingCommand startup) {

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/504a6cde/server/src/com/cloud/hypervisor/KVMGuru.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/hypervisor/KVMGuru.java b/server/src/com/cloud/hypervisor/KVMGuru.java
index e47e699..174b32d 100644
--- a/server/src/com/cloud/hypervisor/KVMGuru.java
+++ b/server/src/com/cloud/hypervisor/KVMGuru.java
@@ -19,11 +19,14 @@ package com.cloud.hypervisor;
 import javax.ejb.Local;
 import javax.inject.Inject;
 
+import com.cloud.agent.api.Command;
 import com.cloud.agent.api.to.VirtualMachineTO;
 import com.cloud.hypervisor.Hypervisor.HypervisorType;
 import com.cloud.storage.GuestOSVO;
 import com.cloud.storage.dao.GuestOSDao;
+import com.cloud.utils.Pair;
 import com.cloud.vm.VirtualMachineProfile;
+import org.apache.cloudstack.storage.command.StorageSubSystemCommand;
 
 @Local(value = HypervisorGuru.class)
 public class KVMGuru extends HypervisorGuruBase implements HypervisorGuru {
@@ -40,6 +43,7 @@ public class KVMGuru extends HypervisorGuruBase implements HypervisorGuru
{
     }
 
     @Override
+
     public VirtualMachineTO implement(VirtualMachineProfile vm) {
         VirtualMachineTO to = toVirtualMachineTO(vm);
 
@@ -51,6 +55,15 @@ public class KVMGuru extends HypervisorGuruBase implements HypervisorGuru
{
     }
 
     @Override
+    public Pair<Boolean, Long> getCommandHostDelegation(long hostId, Command cmd) {
+        if (cmd instanceof StorageSubSystemCommand) {
+            StorageSubSystemCommand c = (StorageSubSystemCommand)cmd;
+            c.setExecuteInSequence(false);
+        }
+        return new Pair<Boolean, Long>(false, new Long(hostId));
+    }
+
+    @Override
     public boolean trackVmHostChange() {
         return false;
     }


Mime
View raw message