cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sate...@apache.org
Subject git commit: updated refs/heads/master to 6ba9754
Date Tue, 31 Dec 2013 06:35:52 GMT
Updated Branches:
  refs/heads/master 6c9b51792 -> 6ba975420


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 <sateesh@apache.org>


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

Branch: refs/heads/master
Commit: 6ba9754201eeb96ec8f34c1b746c4dcf173a9b29
Parents: 6c9b517
Author: Sateesh Chodapuneedi <sateesh@apache.org>
Authored: Tue Dec 31 06:21:32 2013 +0530
Committer: Sateesh Chodapuneedi <sateesh@apache.org>
Committed: Tue Dec 31 06:31:43 2013 +0530

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


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/6ba97542/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/6ba97542/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 315f279..99f5714 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
@@ -361,7 +361,7 @@ public class 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/6ba97542/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 37ed055..6582f46 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
@@ -304,6 +304,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;
@@ -339,9 +340,6 @@ public class VmwareResource implements StoragePoolResource, ServerResource,
Vmwa
 
     protected final int _shutdownWaitMs = 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;
@@ -4360,7 +4358,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;
@@ -4372,13 +4370,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.


Mime
View raw message