You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by sa...@apache.org on 2013/12/31 07:26:09 UTC

git commit: updated refs/heads/4.3 to 57cb023

Updated Branches:
  refs/heads/4.3 577ec61b6 -> 57cb023eb


CLOUDSTACK-5447 [Automation] Volume migration failing with NullPointerException in vmware and KVM
Instead of injecting object of VolumeOrchestrationService into VmwareResource, we now populate the command object (MigrateVolumeCommand here) with required information. Thus we dont need volume orchestration service to query that information from resource.
Signed-off-by: Sateesh Chodapuneedi <sa...@apache.org>


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

Branch: refs/heads/4.3
Commit: 57cb023eb8493009982233bc2e0df869fb4f7b59
Parents: 577ec61
Author: Sateesh Chodapuneedi <sa...@apache.org>
Authored: Tue Dec 31 06:21:32 2013 +0530
Committer: Sateesh Chodapuneedi <sa...@apache.org>
Committed: Tue Dec 31 06:21:32 2013 +0530

----------------------------------------------------------------------
 .../cloud/agent/api/storage/MigrateVolumeCommand.java   | 12 ++++++++++++
 .../storage/motion/AncientDataMotionStrategy.java       |  2 +-
 .../hypervisor/vmware/resource/VmwareResource.java      |  9 ++-------
 3 files changed, 15 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/57cb023e/core/src/com/cloud/agent/api/storage/MigrateVolumeCommand.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/storage/MigrateVolumeCommand.java b/core/src/com/cloud/agent/api/storage/MigrateVolumeCommand.java
index b82d848..b73a48a 100644
--- a/core/src/com/cloud/agent/api/storage/MigrateVolumeCommand.java
+++ b/core/src/com/cloud/agent/api/storage/MigrateVolumeCommand.java
@@ -25,6 +25,7 @@ public class MigrateVolumeCommand extends Command {
     long volumeId;
     String volumePath;
     StorageFilerTO pool;
+    String attachedVmName;
 
     public MigrateVolumeCommand(long volumeId, String volumePath, StoragePool pool) {
         this.volumeId = volumeId;
@@ -32,6 +33,13 @@ public class MigrateVolumeCommand extends Command {
         this.pool = new StorageFilerTO(pool);
     }
 
+    public MigrateVolumeCommand(long volumeId, String volumePath, StoragePool pool, String attachedVmName) {
+        this.volumeId = volumeId;
+        this.volumePath = volumePath;
+        this.pool = new StorageFilerTO(pool);
+        this.attachedVmName = attachedVmName;
+    }
+
     @Override
     public boolean executeInSequence() {
         return true;
@@ -48,4 +56,8 @@ public class MigrateVolumeCommand extends Command {
     public StorageFilerTO getPool() {
         return pool;
     }
+
+    public String getAttachedVmName() {
+        return attachedVmName;
+    }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/57cb023e/engine/storage/datamotion/src/org/apache/cloudstack/storage/motion/AncientDataMotionStrategy.java
----------------------------------------------------------------------
diff --git a/engine/storage/datamotion/src/org/apache/cloudstack/storage/motion/AncientDataMotionStrategy.java b/engine/storage/datamotion/src/org/apache/cloudstack/storage/motion/AncientDataMotionStrategy.java
index e9c185a..c2792c7 100644
--- a/engine/storage/datamotion/src/org/apache/cloudstack/storage/motion/AncientDataMotionStrategy.java
+++ b/engine/storage/datamotion/src/org/apache/cloudstack/storage/motion/AncientDataMotionStrategy.java
@@ -359,7 +359,7 @@ AncientDataMotionStrategy implements DataMotionStrategy {
     protected Answer migrateVolumeToPool(DataObject srcData, DataObject destData) {
         VolumeInfo volume = (VolumeInfo)srcData;
         StoragePool destPool = (StoragePool)dataStoreMgr.getDataStore(destData.getDataStore().getId(), DataStoreRole.Primary);
-        MigrateVolumeCommand command = new MigrateVolumeCommand(volume.getId(), volume.getPath(), destPool);
+        MigrateVolumeCommand command = new MigrateVolumeCommand(volume.getId(), volume.getPath(), destPool, volume.getAttachedVmName());
         EndPoint ep = selector.select(volume.getDataStore());
         Answer answer = null;
         if (ep == null) {

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/57cb023e/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/resource/VmwareResource.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/resource/VmwareResource.java b/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/resource/VmwareResource.java
index 45803b5..f254c5c 100755
--- a/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/resource/VmwareResource.java
+++ b/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/resource/VmwareResource.java
@@ -112,7 +112,6 @@ import com.vmware.vim25.VirtualMachineRuntimeInfo;
 import com.vmware.vim25.VirtualSCSISharing;
 import com.vmware.vim25.VmwareDistributedVirtualSwitchVlanIdSpec;
 
-import org.apache.cloudstack.engine.orchestration.VolumeOrchestrator;
 import org.apache.cloudstack.engine.orchestration.service.VolumeOrchestrationService;
 import org.apache.cloudstack.storage.command.DeleteCommand;
 import org.apache.cloudstack.storage.command.StorageSubSystemCommand;
@@ -283,6 +282,7 @@ import com.cloud.network.rules.FirewallRule;
 import com.cloud.resource.ServerResource;
 import com.cloud.serializer.GsonHelper;
 import com.cloud.storage.Storage;
+import com.cloud.storage.StoragePool;
 import com.cloud.storage.Storage.StoragePoolType;
 import com.cloud.storage.Volume;
 import com.cloud.storage.resource.StoragePoolResource;
@@ -318,9 +318,6 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa
 
     protected final int _shutdown_waitMs = 300000;		// wait up to 5 minutes for shutdown
 
-    @Inject
-    protected VolumeOrchestrationService volMgr;
-
     // out an operation
     protected final int _retry = 24;
     protected final int _sleep = 10000;
@@ -4357,7 +4354,7 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa
             s_logger.info("Executing resource MigrateVolumeCommand: " + _gson.toJson(cmd));
         }
 
-        final String vmName = volMgr.getVmNameFromVolumeId(cmd.getVolumeId());
+        final String vmName = cmd.getAttachedVmName();
 
         VirtualMachineMO vmMo = null;
         VmwareHypervisorHost srcHyperHost = null;
@@ -4369,13 +4366,11 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa
         VirtualMachineRelocateSpecDiskLocator diskLocator = null;
 
         String srcDiskName = "";
-        String srcDsName = "";
         String tgtDsName = "";
 
         try {
             srcHyperHost = getHyperHost(getServiceContext());
             morDc = srcHyperHost.getHyperHostDatacenter();
-            srcDsName = volMgr.getStoragePoolOfVolume(cmd.getVolumeId());
             tgtDsName = poolTo.getUuid().replace("-", "");
 
             // find VM in this datacenter not just in this cluster.