Repository: cloudstack Updated Branches: refs/heads/master 50b5e2e24 -> a1831bc86
Revert "CLOUDSTACK-6170" due to unit test failure. This reverts commit 50b5e2e247ebff54fda8c8c2cd4957ffd47bcf12. Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/a1831bc8 Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/a1831bc8 Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/a1831bc8 Branch: refs/heads/master Commit: a1831bc86417bccc54102a143c047aaa6fc1efe4 Parents: 50b5e2e Author: Min Chen <min.c...@citrix.com> Authored: Thu Mar 20 16:40:45 2014 -0700 Committer: Min Chen <min.c...@citrix.com> Committed: Thu Mar 20 16:40:45 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/a1831bc8/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/a1831bc8/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 4ebde04..a74d79c 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/a1831bc8/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());