Updated Branches:
  refs/heads/object_store dfd6a29fb -> 993187622

create volume command needs to send to vmwareresource


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

Branch: refs/heads/object_store
Commit: 36146e7f65e6a7d55027c522ef899a179dc1507f
Parents: 90de46c
Author: Edison Su <sudi...@gmail.com>
Authored: Fri May 10 19:22:09 2013 -0700
Committer: Edison Su <sudi...@gmail.com>
Committed: Fri May 10 19:26:44 2013 -0700

----------------------------------------------------------------------
 .../src/com/cloud/hypervisor/guru/VMwareGuru.java  |   22 ++++++++++++++-
 server/src/com/cloud/server/StatsCollector.java    |    2 +-
 2 files changed, 22 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/36146e7f/plugins/hypervisors/vmware/src/com/cloud/hypervisor/guru/VMwareGuru.java
----------------------------------------------------------------------
diff --git 
a/plugins/hypervisors/vmware/src/com/cloud/hypervisor/guru/VMwareGuru.java 
b/plugins/hypervisors/vmware/src/com/cloud/hypervisor/guru/VMwareGuru.java
index 3388fc7..95521e8 100644
--- a/plugins/hypervisors/vmware/src/com/cloud/hypervisor/guru/VMwareGuru.java
+++ b/plugins/hypervisors/vmware/src/com/cloud/hypervisor/guru/VMwareGuru.java
@@ -42,6 +42,9 @@ import com.cloud.agent.api.storage.CopyVolumeCommand;
 import com.cloud.agent.api.storage.CreateVolumeOVACommand;
 import com.cloud.agent.api.storage.PrepareOVAPackingCommand;
 import com.cloud.agent.api.storage.PrimaryStorageDownloadCommand;
+import com.cloud.agent.api.to.DataObjectType;
+import com.cloud.agent.api.to.DataStoreTO;
+import com.cloud.agent.api.to.DataTO;
 import com.cloud.agent.api.to.NicTO;
 import com.cloud.agent.api.to.VirtualMachineTO;
 import com.cloud.cluster.ClusterManager;
@@ -64,6 +67,7 @@ import com.cloud.network.dao.NetworkDao;
 import com.cloud.network.dao.NetworkVO;
 import com.cloud.secstorage.CommandExecLogDao;
 import com.cloud.secstorage.CommandExecLogVO;
+import com.cloud.storage.DataStoreRole;
 import com.cloud.storage.GuestOSVO;
 import com.cloud.storage.dao.GuestOSDao;
 import com.cloud.storage.secondary.SecondaryStorageVmManager;
@@ -289,7 +293,23 @@ public class VMwareGuru extends HypervisorGuruBase 
implements HypervisorGuru {
                 cmd instanceof PrepareOVAPackingCommand ||
                 cmd instanceof CreateVolumeFromSnapshotCommand ||
                 cmd instanceof CopyCommand) {
-            needDelegation = true;
+            if (cmd instanceof CopyCommand) {
+                CopyCommand cpyCommand = (CopyCommand)cmd;
+                DataTO srcData = cpyCommand.getSrcTO();
+                DataStoreTO srcStoreTO = srcData.getDataStore();
+                DataTO destData = cpyCommand.getDestTO();
+                DataStoreTO destStoreTO = destData.getDataStore();
+                
+                if (destData.getObjectType() == DataObjectType.VOLUME && 
destStoreTO.getRole() == DataStoreRole.Primary &&
+                        srcData.getObjectType() == DataObjectType.TEMPLATE && 
srcStoreTO.getRole() == DataStoreRole.Primary) {
+                    needDelegation = false;
+                } else {
+                    needDelegation = true;
+                }
+            } else {
+                needDelegation = true;
+            }
+            
         }
         /* Fang: remove this before checking in */
         // needDelegation = false;

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/36146e7f/server/src/com/cloud/server/StatsCollector.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/server/StatsCollector.java 
b/server/src/com/cloud/server/StatsCollector.java
index 1398672..3feb10b 100755
--- a/server/src/com/cloud/server/StatsCollector.java
+++ b/server/src/com/cloud/server/StatsCollector.java
@@ -321,7 +321,7 @@ public class StatsCollector extends ManagerBase implements 
ComponentMethodInterc
                                        GetStorageStatsCommand command = new 
GetStorageStatsCommand(pool.getUuid(), pool.getPoolType(), pool.getPath());
                                        long poolId = pool.getId();
                                        try {
-                                       Answer answer = 
_storageManager.sendToPool(pool.getId(), command);
+                                       Answer answer = 
_storageManager.sendToPool(pool, command);
                                        if (answer != null && 
answer.getResult()) {
                                                
storagePoolStats.put(pool.getId(), (StorageStats)answer);
 

Reply via email to