Skip to content

Commit 36146e7

Browse files
committed
create volume command needs to send to vmwareresource
1 parent 90de46c commit 36146e7

2 files changed

Lines changed: 22 additions & 2 deletions

File tree

plugins/hypervisors/vmware/src/com/cloud/hypervisor/guru/VMwareGuru.java

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,9 @@
4242
import com.cloud.agent.api.storage.CreateVolumeOVACommand;
4343
import com.cloud.agent.api.storage.PrepareOVAPackingCommand;
4444
import com.cloud.agent.api.storage.PrimaryStorageDownloadCommand;
45+
import com.cloud.agent.api.to.DataObjectType;
46+
import com.cloud.agent.api.to.DataStoreTO;
47+
import com.cloud.agent.api.to.DataTO;
4548
import com.cloud.agent.api.to.NicTO;
4649
import com.cloud.agent.api.to.VirtualMachineTO;
4750
import com.cloud.cluster.ClusterManager;
@@ -64,6 +67,7 @@
6467
import com.cloud.network.dao.NetworkVO;
6568
import com.cloud.secstorage.CommandExecLogDao;
6669
import com.cloud.secstorage.CommandExecLogVO;
70+
import com.cloud.storage.DataStoreRole;
6771
import com.cloud.storage.GuestOSVO;
6872
import com.cloud.storage.dao.GuestOSDao;
6973
import com.cloud.storage.secondary.SecondaryStorageVmManager;
@@ -289,7 +293,23 @@ public long getCommandHostDelegation(long hostId, Command cmd) {
289293
cmd instanceof PrepareOVAPackingCommand ||
290294
cmd instanceof CreateVolumeFromSnapshotCommand ||
291295
cmd instanceof CopyCommand) {
292-
needDelegation = true;
296+
if (cmd instanceof CopyCommand) {
297+
CopyCommand cpyCommand = (CopyCommand)cmd;
298+
DataTO srcData = cpyCommand.getSrcTO();
299+
DataStoreTO srcStoreTO = srcData.getDataStore();
300+
DataTO destData = cpyCommand.getDestTO();
301+
DataStoreTO destStoreTO = destData.getDataStore();
302+
303+
if (destData.getObjectType() == DataObjectType.VOLUME && destStoreTO.getRole() == DataStoreRole.Primary &&
304+
srcData.getObjectType() == DataObjectType.TEMPLATE && srcStoreTO.getRole() == DataStoreRole.Primary) {
305+
needDelegation = false;
306+
} else {
307+
needDelegation = true;
308+
}
309+
} else {
310+
needDelegation = true;
311+
}
312+
293313
}
294314
/* Fang: remove this before checking in */
295315
// needDelegation = false;

server/src/com/cloud/server/StatsCollector.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -321,7 +321,7 @@ public void run() {
321321
GetStorageStatsCommand command = new GetStorageStatsCommand(pool.getUuid(), pool.getPoolType(), pool.getPath());
322322
long poolId = pool.getId();
323323
try {
324-
Answer answer = _storageManager.sendToPool(pool.getId(), command);
324+
Answer answer = _storageManager.sendToPool(pool, command);
325325
if (answer != null && answer.getResult()) {
326326
storagePoolStats.put(pool.getId(), (StorageStats)answer);
327327

0 commit comments

Comments
 (0)