You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by mc...@apache.org on 2014/03/21 00:36:15 UTC

[2/2] git commit: updated refs/heads/4.4 to dcfe778

Revert "CLOUDSTACK-6170"

This reverts commit 7a7d9cff0d5bb40284506faa6e34138f97a12428.


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

Branch: refs/heads/4.4
Commit: dcfe77845c3b90b4f9b1b91ac62e797655ed8d36
Parents: bd69166
Author: Min Chen <mi...@citrix.com>
Authored: Thu Mar 20 16:28:47 2014 -0700
Committer: Min Chen <mi...@citrix.com>
Committed: Thu Mar 20 16:28:47 2014 -0700

----------------------------------------------------------------------
 .../service/VolumeOrchestrationService.java     |  3 -
 .../orchestration/VolumeOrchestrator.java       | 11 ----
 server/src/com/cloud/vm/UserVmManagerImpl.java  | 65 --------------------
 3 files changed, 79 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/dcfe7784/engine/api/src/org/apache/cloudstack/engine/orchestration/service/VolumeOrchestrationService.java
----------------------------------------------------------------------
diff --git a/engine/api/src/org/apache/cloudstack/engine/orchestration/service/VolumeOrchestrationService.java b/engine/api/src/org/apache/cloudstack/engine/orchestration/service/VolumeOrchestrationService.java
index 3b555e5..095d954 100644
--- a/engine/api/src/org/apache/cloudstack/engine/orchestration/service/VolumeOrchestrationService.java
+++ b/engine/api/src/org/apache/cloudstack/engine/orchestration/service/VolumeOrchestrationService.java
@@ -21,7 +21,6 @@ package org.apache.cloudstack.engine.orchestration.service;
 import java.util.Map;
 import java.util.Set;
 
-import org.apache.cloudstack.engine.subsystem.api.storage.DataStore;
 import org.apache.cloudstack.engine.subsystem.api.storage.VolumeInfo;
 
 import com.cloud.agent.api.to.VirtualMachineTO;
@@ -95,8 +94,6 @@ public interface VolumeOrchestrationService {
 
     void cleanupVolumes(long vmId) throws ConcurrentOperationException;
 
-    void disconnectVolumeFromHost(VolumeInfo volumeInfo, Host host, DataStore dataStore);
-
     void disconnectVolumesFromHost(long vmId, long hostId);
 
     void migrateVolumes(VirtualMachine vm, VirtualMachineTO vmTo, Host srcHost, Host destHost, Map<Volume, StoragePool> volumeToPool);

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/dcfe7784/engine/orchestration/src/org/apache/cloudstack/engine/orchestration/VolumeOrchestrator.java
----------------------------------------------------------------------
diff --git a/engine/orchestration/src/org/apache/cloudstack/engine/orchestration/VolumeOrchestrator.java b/engine/orchestration/src/org/apache/cloudstack/engine/orchestration/VolumeOrchestrator.java
index 767eab2..b8f9506 100644
--- a/engine/orchestration/src/org/apache/cloudstack/engine/orchestration/VolumeOrchestrator.java
+++ b/engine/orchestration/src/org/apache/cloudstack/engine/orchestration/VolumeOrchestrator.java
@@ -37,10 +37,8 @@ import org.apache.log4j.Logger;
 import org.apache.cloudstack.engine.orchestration.service.VolumeOrchestrationService;
 import org.apache.cloudstack.engine.subsystem.api.storage.ChapInfo;
 import org.apache.cloudstack.engine.subsystem.api.storage.DataStore;
-import org.apache.cloudstack.engine.subsystem.api.storage.DataStoreDriver;
 import org.apache.cloudstack.engine.subsystem.api.storage.DataStoreManager;
 import org.apache.cloudstack.engine.subsystem.api.storage.PrimaryDataStore;
-import org.apache.cloudstack.engine.subsystem.api.storage.PrimaryDataStoreDriver;
 import org.apache.cloudstack.engine.subsystem.api.storage.SnapshotDataFactory;
 import org.apache.cloudstack.engine.subsystem.api.storage.SnapshotInfo;
 import org.apache.cloudstack.engine.subsystem.api.storage.SnapshotService;
@@ -834,15 +832,6 @@ public class VolumeOrchestrator extends ManagerBase implements VolumeOrchestrati
     }
 
     @Override
-    public void disconnectVolumeFromHost(VolumeInfo volumeInfo, Host host, DataStore dataStore) {
-        DataStoreDriver dataStoreDriver = dataStore != null ? dataStore.getDriver() : null;
-
-        if (dataStoreDriver instanceof PrimaryDataStoreDriver) {
-            ((PrimaryDataStoreDriver)dataStoreDriver).disconnectVolumeFromHost(volumeInfo, host, dataStore);
-        }
-    }
-
-    @Override
     public void disconnectVolumesFromHost(long vmId, long hostId) {
         HostVO host = _hostDao.findById(hostId);
 

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/dcfe7784/server/src/com/cloud/vm/UserVmManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/vm/UserVmManagerImpl.java b/server/src/com/cloud/vm/UserVmManagerImpl.java
index f92eaca..b4888a8 100755
--- a/server/src/com/cloud/vm/UserVmManagerImpl.java
+++ b/server/src/com/cloud/vm/UserVmManagerImpl.java
@@ -70,8 +70,6 @@ import org.apache.cloudstack.engine.cloud.entity.api.VirtualMachineEntity;
 import org.apache.cloudstack.engine.orchestration.service.NetworkOrchestrationService;
 import org.apache.cloudstack.engine.orchestration.service.VolumeOrchestrationService;
 import org.apache.cloudstack.engine.service.api.OrchestrationService;
-import org.apache.cloudstack.engine.subsystem.api.storage.DataStore;
-import org.apache.cloudstack.engine.subsystem.api.storage.DataStoreManager;
 import org.apache.cloudstack.engine.subsystem.api.storage.TemplateDataFactory;
 import org.apache.cloudstack.engine.subsystem.api.storage.VolumeDataFactory;
 import org.apache.cloudstack.engine.subsystem.api.storage.VolumeInfo;
@@ -83,13 +81,11 @@ import org.apache.cloudstack.framework.config.Configurable;
 import org.apache.cloudstack.framework.config.dao.ConfigurationDao;
 import org.apache.cloudstack.framework.jobs.AsyncJobManager;
 import org.apache.cloudstack.managed.context.ManagedContextRunnable;
-import org.apache.cloudstack.storage.command.DettachCommand;
 import org.apache.cloudstack.storage.datastore.db.PrimaryDataStoreDao;
 import org.apache.cloudstack.storage.datastore.db.StoragePoolVO;
 
 import com.cloud.agent.AgentManager;
 import com.cloud.agent.api.Answer;
-import com.cloud.agent.api.Command;
 import com.cloud.agent.api.GetVmDiskStatsAnswer;
 import com.cloud.agent.api.GetVmDiskStatsCommand;
 import com.cloud.agent.api.GetVmStatsAnswer;
@@ -98,8 +94,6 @@ import com.cloud.agent.api.PvlanSetupCommand;
 import com.cloud.agent.api.StartAnswer;
 import com.cloud.agent.api.VmDiskStatsEntry;
 import com.cloud.agent.api.VmStatsEntry;
-import com.cloud.agent.api.to.DataTO;
-import com.cloud.agent.api.to.DiskTO;
 import com.cloud.agent.api.to.NicTO;
 import com.cloud.agent.api.to.VirtualMachineTO;
 import com.cloud.agent.manager.Commands;
@@ -205,7 +199,6 @@ import com.cloud.storage.SnapshotVO;
 import com.cloud.storage.Storage;
 import com.cloud.storage.Storage.ImageFormat;
 import com.cloud.storage.Storage.TemplateType;
-import com.cloud.storage.DataStoreRole;
 import com.cloud.storage.StorageManager;
 import com.cloud.storage.StoragePool;
 import com.cloud.storage.StoragePoolStatus;
@@ -455,8 +448,6 @@ public class UserVmManagerImpl extends ManagerBase implements UserVmManager, Vir
     DeploymentPlanningManager _planningMgr;
     @Inject
     VolumeApiService _volumeService;
-    @Inject
-    DataStoreManager _dataStoreMgr;
 
     protected ScheduledExecutorService _executor = null;
     protected int _expungeInterval;
@@ -4660,9 +4651,6 @@ public class UserVmManagerImpl extends ManagerBase implements UserVmManager, Vir
         /* Detach and destory the old root volume */
 
         _volsDao.detachVolume(root.getId());
-
-        handleManagedStorage(vm, root);
-
         volumeMgr.destroyVolume(root);
 
         // For VMware hypervisor since the old root volume is replaced by the new root volume, force expunge old root volume if it has been created in storage
@@ -4710,59 +4698,6 @@ public class UserVmManagerImpl extends ManagerBase implements UserVmManager, Vir
 
     }
 
-    private void handleManagedStorage(UserVmVO vm, VolumeVO root) {
-        StoragePoolVO storagePool = _storagePoolDao.findById(root.getPoolId());
-
-        if (storagePool.isManaged()) {
-            Long hostId = vm.getHostId() != null ? vm.getHostId() : vm.getLastHostId();
-
-            if (hostId != null) {
-                DataTO volTO = volFactory.getVolume(root.getId()).getTO();
-                DiskTO disk = new DiskTO(volTO, root.getDeviceId(), root.getPath(), root.getVolumeType());
-
-                // it's OK in this case to send a detach command to the host for a root volume as this
-                // will simply lead to the SR that supports the root volume being removed
-                DettachCommand cmd = new DettachCommand(disk, vm.getInstanceName());
-
-                cmd.setManaged(true);
-
-                cmd.setStorageHost(storagePool.getHostAddress());
-                cmd.setStoragePort(storagePool.getPort());
-
-                cmd.set_iScsiName(root.get_iScsiName());
-
-                Commands cmds = new Commands(Command.OnError.Stop);
-
-                cmds.addCommand(cmd);
-
-                try {
-                    _agentMgr.send(hostId, cmds);
-                }
-                catch (Exception ex) {
-                    throw new CloudRuntimeException(ex.getMessage());
-                }
-
-                if (!cmds.isSuccessful()) {
-                    for (Answer answer : cmds.getAnswers()) {
-                        if (!answer.getResult()) {
-                            s_logger.warn("Failed to reset vm due to: " + answer.getDetails());
-
-                            throw new CloudRuntimeException("Unable to reset " + vm + " due to " + answer.getDetails());
-                        }
-                    }
-                }
-
-                if (hostId != null) {
-                    // root.getPoolId() should be null if the VM we are attaching the disk to has never been started before
-                    DataStore dataStore = root.getPoolId() != null ? _dataStoreMgr.getDataStore(root.getPoolId(), DataStoreRole.Primary) : null;
-                    Host host = this._hostDao.findById(hostId);
-
-                    volumeMgr.disconnectVolumeFromHost(volFactory.getVolume(root.getId()), host, dataStore);
-                }
-            }
-        }
-    }
-
     @Override
     public void prepareStop(VirtualMachineProfile profile) {
         UserVmVO vm = _vmDao.findById(profile.getId());