mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
Changed "boolean connectVolumeToHost(VolumeInfo, Host, DataStore)" to "boolean grantAccess(DataObject, Host, DataStore)"
Changed "void disconnectVolumeFromHost(VolumeInfo, Host, DataStore)" to "void revokeAccess(DataObject, Host, DataStore)"
This commit is contained in:
parent
b29265f159
commit
57dacf99a2
@ -21,6 +21,7 @@ package org.apache.cloudstack.engine.orchestration.service;
|
|||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
|
import org.apache.cloudstack.engine.subsystem.api.storage.DataObject;
|
||||||
import org.apache.cloudstack.engine.subsystem.api.storage.DataStore;
|
import org.apache.cloudstack.engine.subsystem.api.storage.DataStore;
|
||||||
import org.apache.cloudstack.engine.subsystem.api.storage.VolumeInfo;
|
import org.apache.cloudstack.engine.subsystem.api.storage.VolumeInfo;
|
||||||
|
|
||||||
@ -95,9 +96,9 @@ public interface VolumeOrchestrationService {
|
|||||||
|
|
||||||
void cleanupVolumes(long vmId) throws ConcurrentOperationException;
|
void cleanupVolumes(long vmId) throws ConcurrentOperationException;
|
||||||
|
|
||||||
void disconnectVolumeFromHost(VolumeInfo volumeInfo, Host host, DataStore dataStore);
|
void revokeAccess(DataObject dataObject, Host host, DataStore dataStore);
|
||||||
|
|
||||||
void disconnectVolumesFromHost(long vmId, long hostId);
|
void revokeAccess(long vmId, long hostId);
|
||||||
|
|
||||||
void migrateVolumes(VirtualMachine vm, VirtualMachineTO vmTo, Host srcHost, Host destHost, Map<Volume, StoragePool> volumeToPool);
|
void migrateVolumes(VirtualMachine vm, VirtualMachineTO vmTo, Host srcHost, Host destHost, Map<Volume, StoragePool> volumeToPool);
|
||||||
|
|
||||||
|
|||||||
@ -28,9 +28,9 @@ import com.cloud.storage.Volume;
|
|||||||
public interface PrimaryDataStoreDriver extends DataStoreDriver {
|
public interface PrimaryDataStoreDriver extends DataStoreDriver {
|
||||||
public ChapInfo getChapInfo(VolumeInfo volumeInfo);
|
public ChapInfo getChapInfo(VolumeInfo volumeInfo);
|
||||||
|
|
||||||
public boolean connectVolumeToHost(VolumeInfo volumeInfo, Host host, DataStore dataStore);
|
public boolean grantAccess(DataObject dataObject, Host host, DataStore dataStore);
|
||||||
|
|
||||||
public void disconnectVolumeFromHost(VolumeInfo volumeInfo, Host host, DataStore dataStore);
|
public void revokeAccess(DataObject dataObject, Host host, DataStore dataStore);
|
||||||
|
|
||||||
// intended for managed storage (cloud.storage_pool.managed = true)
|
// intended for managed storage (cloud.storage_pool.managed = true)
|
||||||
// if not managed, return volume.getSize()
|
// if not managed, return volume.getSize()
|
||||||
|
|||||||
@ -44,9 +44,9 @@ public interface VolumeService {
|
|||||||
|
|
||||||
ChapInfo getChapInfo(VolumeInfo volumeInfo, DataStore dataStore);
|
ChapInfo getChapInfo(VolumeInfo volumeInfo, DataStore dataStore);
|
||||||
|
|
||||||
boolean connectVolumeToHost(VolumeInfo volumeInfo, Host host, DataStore dataStore);
|
boolean grantAccess(DataObject dataObject, Host host, DataStore dataStore);
|
||||||
|
|
||||||
void disconnectVolumeFromHost(VolumeInfo volumeInfo, Host host, DataStore dataStore);
|
void revokeAccess(DataObject dataObject, Host host, DataStore dataStore);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates the volume based on the given criteria
|
* Creates the volume based on the given criteria
|
||||||
|
|||||||
@ -517,7 +517,7 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (hostId != null) {
|
if (hostId != null) {
|
||||||
volumeMgr.disconnectVolumesFromHost(vm.getId(), hostId);
|
volumeMgr.revokeAccess(vm.getId(), hostId);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Clean up volumes based on the vm's instance id
|
// Clean up volumes based on the vm's instance id
|
||||||
|
|||||||
@ -34,6 +34,7 @@ import org.apache.log4j.Logger;
|
|||||||
|
|
||||||
import org.apache.cloudstack.engine.orchestration.service.VolumeOrchestrationService;
|
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.ChapInfo;
|
||||||
|
import org.apache.cloudstack.engine.subsystem.api.storage.DataObject;
|
||||||
import org.apache.cloudstack.engine.subsystem.api.storage.DataStore;
|
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.DataStoreDriver;
|
||||||
import org.apache.cloudstack.engine.subsystem.api.storage.DataStoreManager;
|
import org.apache.cloudstack.engine.subsystem.api.storage.DataStoreManager;
|
||||||
@ -871,16 +872,16 @@ public class VolumeOrchestrator extends ManagerBase implements VolumeOrchestrati
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void disconnectVolumeFromHost(VolumeInfo volumeInfo, Host host, DataStore dataStore) {
|
public void revokeAccess(DataObject dataObject, Host host, DataStore dataStore) {
|
||||||
DataStoreDriver dataStoreDriver = dataStore != null ? dataStore.getDriver() : null;
|
DataStoreDriver dataStoreDriver = dataStore != null ? dataStore.getDriver() : null;
|
||||||
|
|
||||||
if (dataStoreDriver instanceof PrimaryDataStoreDriver) {
|
if (dataStoreDriver instanceof PrimaryDataStoreDriver) {
|
||||||
((PrimaryDataStoreDriver)dataStoreDriver).disconnectVolumeFromHost(volumeInfo, host, dataStore);
|
((PrimaryDataStoreDriver)dataStoreDriver).revokeAccess(dataObject, host, dataStore);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void disconnectVolumesFromHost(long vmId, long hostId) {
|
public void revokeAccess(long vmId, long hostId) {
|
||||||
HostVO host = _hostDao.findById(hostId);
|
HostVO host = _hostDao.findById(hostId);
|
||||||
|
|
||||||
List<VolumeVO> volumesForVm = _volsDao.findByInstance(vmId);
|
List<VolumeVO> volumesForVm = _volsDao.findByInstance(vmId);
|
||||||
@ -888,10 +889,12 @@ public class VolumeOrchestrator extends ManagerBase implements VolumeOrchestrati
|
|||||||
if (volumesForVm != null) {
|
if (volumesForVm != null) {
|
||||||
for (VolumeVO volumeForVm : volumesForVm) {
|
for (VolumeVO volumeForVm : volumesForVm) {
|
||||||
VolumeInfo volumeInfo = volFactory.getVolume(volumeForVm.getId());
|
VolumeInfo volumeInfo = volFactory.getVolume(volumeForVm.getId());
|
||||||
|
|
||||||
// pool id can be null for the VM's volumes in Allocated state
|
// pool id can be null for the VM's volumes in Allocated state
|
||||||
if (volumeForVm.getPoolId() != null) {
|
if (volumeForVm.getPoolId() != null) {
|
||||||
DataStore dataStore = dataStoreMgr.getDataStore(volumeForVm.getPoolId(), DataStoreRole.Primary);
|
DataStore dataStore = dataStoreMgr.getDataStore(volumeForVm.getPoolId(), DataStoreRole.Primary);
|
||||||
volService.disconnectVolumeFromHost(volumeInfo, host, dataStore);
|
|
||||||
|
volService.revokeAccess(volumeInfo, host, dataStore);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1246,7 +1249,7 @@ public class VolumeOrchestrator extends ManagerBase implements VolumeOrchestrati
|
|||||||
long hostId = vm.getVirtualMachine().getHostId();
|
long hostId = vm.getVirtualMachine().getHostId();
|
||||||
Host host = _hostDao.findById(hostId);
|
Host host = _hostDao.findById(hostId);
|
||||||
|
|
||||||
volService.connectVolumeToHost(volFactory.getVolume(newVol.getId()), host, destPool);
|
volService.grantAccess(volFactory.getVolume(newVol.getId()), host, destPool);
|
||||||
}
|
}
|
||||||
|
|
||||||
newVol = _volsDao.findById(newVol.getId());
|
newVol = _volsDao.findById(newVol.getId());
|
||||||
|
|||||||
@ -49,10 +49,10 @@ public class FakePrimaryDataStoreDriver implements PrimaryDataStoreDriver {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean connectVolumeToHost(VolumeInfo volumeInfo, Host host, DataStore dataStore) { return false; }
|
public boolean grantAccess(DataObject dataObject, Host host, DataStore dataStore) { return false; }
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void disconnectVolumeFromHost(VolumeInfo volumeInfo, Host host, DataStore dataStore) {}
|
public void revokeAccess(DataObject dataObject, Host host, DataStore dataStore) {}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public long getUsedBytes(StoragePool storagePool) {
|
public long getUsedBytes(StoragePool storagePool) {
|
||||||
|
|||||||
@ -221,19 +221,19 @@ public class StorageSystemSnapshotStrategy extends SnapshotStrategyBase {
|
|||||||
try {
|
try {
|
||||||
// if sourceDetails != null, we need to connect the host(s) to the volume
|
// if sourceDetails != null, we need to connect the host(s) to the volume
|
||||||
if (sourceDetails != null) {
|
if (sourceDetails != null) {
|
||||||
_volService.connectVolumeToHost(volumeInfo, hostVO, dataStore);
|
_volService.grantAccess(volumeInfo, hostVO, dataStore);
|
||||||
}
|
}
|
||||||
|
|
||||||
VolumeVO volume = _volumeDao.findById(volumeInfo.getId());
|
VolumeVO volume = _volumeDao.findById(volumeInfo.getId());
|
||||||
|
|
||||||
// the Folder field is used by connectVolumeToHost(VolumeInfo, Host, DataStore) when that method
|
// the Folder field is used by grantAccess(VolumeInfo, Host, DataStore) when that method
|
||||||
// connects the host(s) to the volume
|
// connects the host(s) to the volume
|
||||||
// this Folder change is NOT to be written to the DB; it is only temporarily used here so that
|
// this Folder change is NOT to be written to the DB; it is only temporarily used here so that
|
||||||
// the connect method can be passed in the expected data and do its work (on the volume that backs
|
// the connect method can be passed in the expected data and do its work (on the volume that backs
|
||||||
// the snapshot)
|
// the snapshot)
|
||||||
volume.setFolder(destDetails.get(DiskTO.VOLUME_ID));
|
volume.setFolder(destDetails.get(DiskTO.VOLUME_ID));
|
||||||
|
|
||||||
_volService.connectVolumeToHost(volumeInfo, hostVO, dataStore);
|
_volService.grantAccess(volumeInfo, hostVO, dataStore);
|
||||||
|
|
||||||
snapshotAndCopyAnswer = (SnapshotAndCopyAnswer)_agentMgr.send(hostVO.getId(), snapshotAndCopyCommand);
|
snapshotAndCopyAnswer = (SnapshotAndCopyAnswer)_agentMgr.send(hostVO.getId(), snapshotAndCopyCommand);
|
||||||
}
|
}
|
||||||
@ -244,18 +244,18 @@ public class StorageSystemSnapshotStrategy extends SnapshotStrategyBase {
|
|||||||
try {
|
try {
|
||||||
VolumeVO volume = _volumeDao.findById(volumeInfo.getId());
|
VolumeVO volume = _volumeDao.findById(volumeInfo.getId());
|
||||||
|
|
||||||
// the Folder field is used by disconnectVolumeFromHost(VolumeInfo, Host, DataStore) when that method
|
// the Folder field is used by revokeAccess(VolumeInfo, Host, DataStore) when that method
|
||||||
// disconnects the host(s) from the volume
|
// disconnects the host(s) from the volume
|
||||||
// this Folder change is NOT to be written to the DB; it is only temporarily used here so that
|
// this Folder change is NOT to be written to the DB; it is only temporarily used here so that
|
||||||
// the disconnect method can be passed in the expected data and do its work (on the volume that backs
|
// the disconnect method can be passed in the expected data and do its work (on the volume that backs
|
||||||
// the snapshot)
|
// the snapshot)
|
||||||
volume.setFolder(destDetails.get(DiskTO.VOLUME_ID));
|
volume.setFolder(destDetails.get(DiskTO.VOLUME_ID));
|
||||||
|
|
||||||
_volService.disconnectVolumeFromHost(volumeInfo, hostVO, dataStore);
|
_volService.revokeAccess(volumeInfo, hostVO, dataStore);
|
||||||
|
|
||||||
// if sourceDetails != null, we need to disconnect the host(s) from the volume
|
// if sourceDetails != null, we need to disconnect the host(s) from the volume
|
||||||
if (sourceDetails != null) {
|
if (sourceDetails != null) {
|
||||||
_volService.disconnectVolumeFromHost(volumeInfo, hostVO, dataStore);
|
_volService.revokeAccess(volumeInfo, hostVO, dataStore);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception ex) {
|
catch (Exception ex) {
|
||||||
|
|||||||
@ -167,22 +167,22 @@ public class VolumeServiceImpl implements VolumeService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean connectVolumeToHost(VolumeInfo volumeInfo, Host host, DataStore dataStore) {
|
public boolean grantAccess(DataObject dataObject, Host host, DataStore dataStore) {
|
||||||
DataStoreDriver dataStoreDriver = dataStore != null ? dataStore.getDriver() : null;
|
DataStoreDriver dataStoreDriver = dataStore != null ? dataStore.getDriver() : null;
|
||||||
|
|
||||||
if (dataStoreDriver instanceof PrimaryDataStoreDriver) {
|
if (dataStoreDriver instanceof PrimaryDataStoreDriver) {
|
||||||
return ((PrimaryDataStoreDriver)dataStoreDriver).connectVolumeToHost(volumeInfo, host, dataStore);
|
return ((PrimaryDataStoreDriver)dataStoreDriver).grantAccess(dataObject, host, dataStore);
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void disconnectVolumeFromHost(VolumeInfo volumeInfo, Host host, DataStore dataStore) {
|
public void revokeAccess(DataObject dataObject, Host host, DataStore dataStore) {
|
||||||
DataStoreDriver dataStoreDriver = dataStore != null ? dataStore.getDriver() : null;
|
DataStoreDriver dataStoreDriver = dataStore != null ? dataStore.getDriver() : null;
|
||||||
|
|
||||||
if (dataStoreDriver instanceof PrimaryDataStoreDriver) {
|
if (dataStoreDriver instanceof PrimaryDataStoreDriver) {
|
||||||
((PrimaryDataStoreDriver)dataStoreDriver).disconnectVolumeFromHost(volumeInfo, host, dataStore);
|
((PrimaryDataStoreDriver)dataStoreDriver).revokeAccess(dataObject, host, dataStore);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -677,7 +677,7 @@ public class VolumeServiceImpl implements VolumeService {
|
|||||||
// refresh the volume from the DB
|
// refresh the volume from the DB
|
||||||
volumeInfo = volFactory.getVolume(volumeInfo.getId(), destPrimaryDataStore);
|
volumeInfo = volFactory.getVolume(volumeInfo.getId(), destPrimaryDataStore);
|
||||||
|
|
||||||
connectVolumeToHost(volumeInfo, destHost, destPrimaryDataStore);
|
grantAccess(volumeInfo, destHost, destPrimaryDataStore);
|
||||||
|
|
||||||
ManagedCreateBaseImageContext<CreateCmdResult> context = new ManagedCreateBaseImageContext<CreateCmdResult>(null, volumeInfo,
|
ManagedCreateBaseImageContext<CreateCmdResult> context = new ManagedCreateBaseImageContext<CreateCmdResult>(null, volumeInfo,
|
||||||
destPrimaryDataStore, srcTemplateInfo, future);
|
destPrimaryDataStore, srcTemplateInfo, future);
|
||||||
@ -712,7 +712,7 @@ public class VolumeServiceImpl implements VolumeService {
|
|||||||
|
|
||||||
volumeInfo.processEvent(Event.DestroyRequested);
|
volumeInfo.processEvent(Event.DestroyRequested);
|
||||||
|
|
||||||
disconnectVolumeFromHost(volumeInfo, destHost, destPrimaryDataStore);
|
revokeAccess(volumeInfo, destHost, destPrimaryDataStore);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
AsyncCallFuture<VolumeApiResult> expungeVolumeFuture = expungeVolumeAsync(volumeInfo);
|
AsyncCallFuture<VolumeApiResult> expungeVolumeFuture = expungeVolumeAsync(volumeInfo);
|
||||||
|
|||||||
@ -401,13 +401,13 @@ public class ElastistorPrimaryDataStoreDriver extends CloudStackPrimaryDataStore
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean connectVolumeToHost(VolumeInfo volumeInfo, Host host, DataStore dataStore) {
|
public boolean grantAccess(DataObject dataObject, Host host, DataStore dataStore) {
|
||||||
// TODO Auto-generated method stub
|
// TODO Auto-generated method stub
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void disconnectVolumeFromHost(VolumeInfo volumeInfo, Host host, DataStore dataStore) {
|
public void revokeAccess(DataObject dataObject, Host host, DataStore dataStore) {
|
||||||
// TODO Auto-generated method stub
|
// TODO Auto-generated method stub
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -149,12 +149,12 @@ public class CloudStackPrimaryDataStoreDriverImpl implements PrimaryDataStoreDri
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean connectVolumeToHost(VolumeInfo volumeInfo, Host host, DataStore dataStore) {
|
public boolean grantAccess(DataObject dataObject, Host host, DataStore dataStore) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void disconnectVolumeFromHost(VolumeInfo volumeInfo, Host host, DataStore dataStore) {
|
public void revokeAccess(DataObject dataObject, Host host, DataStore dataStore) {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@ -58,12 +58,12 @@ public class NexentaPrimaryDataStoreDriver implements PrimaryDataStoreDriver {
|
|||||||
private static final Logger logger = Logger.getLogger(NexentaPrimaryDataStoreDriver.class);
|
private static final Logger logger = Logger.getLogger(NexentaPrimaryDataStoreDriver.class);
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean connectVolumeToHost(VolumeInfo volumeInfo, Host host, DataStore dataStore) {
|
public boolean grantAccess(DataObject dataObject, Host host, DataStore dataStore) {
|
||||||
return false; //To change body of implemented methods use File | Settings | File Templates.
|
return false; //To change body of implemented methods use File | Settings | File Templates.
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void disconnectVolumeFromHost(VolumeInfo volumeInfo, Host host, DataStore dataStore) {
|
public void revokeAccess(DataObject dataObject, Host host, DataStore dataStore) {
|
||||||
//To change body of implemented methods use File | Settings | File Templates.
|
//To change body of implemented methods use File | Settings | File Templates.
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -82,10 +82,10 @@ public class SamplePrimaryDataStoreDriverImpl implements PrimaryDataStoreDriver
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean connectVolumeToHost(VolumeInfo volumeInfo, Host host, DataStore dataStore) { return false; }
|
public boolean grantAccess(DataObject dataObject, Host host, DataStore dataStore) { return false; }
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void disconnectVolumeFromHost(VolumeInfo volumeInfo, Host host, DataStore dataStore) {}
|
public void revokeAccess(DataObject dataObject, Host host, DataStore dataStore) {}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public long getUsedBytes(StoragePool storagePool) {
|
public long getUsedBytes(StoragePool storagePool) {
|
||||||
|
|||||||
@ -126,8 +126,10 @@ public class SolidFirePrimaryDataStoreDriver implements PrimaryDataStoreDriver {
|
|||||||
// if the ID of volumeInfo in not in the VAG, add it (ModifyVolumeAccessGroup)
|
// if the ID of volumeInfo in not in the VAG, add it (ModifyVolumeAccessGroup)
|
||||||
// if the VAG doesn't exist, create it with the IQNs of the hosts and the ID of volumeInfo (CreateVolumeAccessGroup)
|
// if the VAG doesn't exist, create it with the IQNs of the hosts and the ID of volumeInfo (CreateVolumeAccessGroup)
|
||||||
@Override
|
@Override
|
||||||
public synchronized boolean connectVolumeToHost(VolumeInfo volumeInfo, Host host, DataStore dataStore)
|
public synchronized boolean grantAccess(DataObject dataObject, Host host, DataStore dataStore)
|
||||||
{
|
{
|
||||||
|
VolumeInfo volumeInfo = (VolumeInfo)dataObject;
|
||||||
|
|
||||||
if (volumeInfo == null || host == null || dataStore == null) {
|
if (volumeInfo == null || host == null || dataStore == null) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -169,8 +171,10 @@ public class SolidFirePrimaryDataStoreDriver implements PrimaryDataStoreDriver {
|
|||||||
// if the VAG exists
|
// if the VAG exists
|
||||||
// remove the ID of volumeInfo from the VAG (ModifyVolumeAccessGroup)
|
// remove the ID of volumeInfo from the VAG (ModifyVolumeAccessGroup)
|
||||||
@Override
|
@Override
|
||||||
public synchronized void disconnectVolumeFromHost(VolumeInfo volumeInfo, Host host, DataStore dataStore)
|
public synchronized void revokeAccess(DataObject dataObject, Host host, DataStore dataStore)
|
||||||
{
|
{
|
||||||
|
VolumeInfo volumeInfo = (VolumeInfo)dataObject;
|
||||||
|
|
||||||
if (volumeInfo == null || host == null || dataStore == null) {
|
if (volumeInfo == null || host == null || dataStore == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1654,7 +1654,7 @@ public class VolumeApiServiceImpl extends ManagerBase implements VolumeApiServic
|
|||||||
// volume.getPoolId() should be null if the VM we are detaching the disk from has never been started before
|
// volume.getPoolId() should be null if the VM we are detaching the disk from has never been started before
|
||||||
DataStore dataStore = volume.getPoolId() != null ? dataStoreMgr.getDataStore(volume.getPoolId(), DataStoreRole.Primary) : null;
|
DataStore dataStore = volume.getPoolId() != null ? dataStoreMgr.getDataStore(volume.getPoolId(), DataStoreRole.Primary) : null;
|
||||||
|
|
||||||
volService.disconnectVolumeFromHost(volFactory.getVolume(volume.getId()), host, dataStore);
|
volService.revokeAccess(volFactory.getVolume(volume.getId()), host, dataStore);
|
||||||
|
|
||||||
return _volsDao.findById(volumeId);
|
return _volsDao.findById(volumeId);
|
||||||
} else {
|
} else {
|
||||||
@ -2163,10 +2163,10 @@ public class VolumeApiServiceImpl extends ManagerBase implements VolumeApiServic
|
|||||||
// if we don't have a host, the VM we are attaching the disk to has never been started before
|
// if we don't have a host, the VM we are attaching the disk to has never been started before
|
||||||
if (host != null) {
|
if (host != null) {
|
||||||
try {
|
try {
|
||||||
volService.connectVolumeToHost(volFactory.getVolume(volumeToAttach.getId()), host, dataStore);
|
volService.grantAccess(volFactory.getVolume(volumeToAttach.getId()), host, dataStore);
|
||||||
}
|
}
|
||||||
catch (Exception e) {
|
catch (Exception e) {
|
||||||
volService.disconnectVolumeFromHost(volFactory.getVolume(volumeToAttach.getId()), host, dataStore);
|
volService.revokeAccess(volFactory.getVolume(volumeToAttach.getId()), host, dataStore);
|
||||||
|
|
||||||
throw new CloudRuntimeException(e.getMessage());
|
throw new CloudRuntimeException(e.getMessage());
|
||||||
}
|
}
|
||||||
@ -2211,7 +2211,7 @@ public class VolumeApiServiceImpl extends ManagerBase implements VolumeApiServic
|
|||||||
answer = (AttachAnswer)_agentMgr.send(hostId, cmd);
|
answer = (AttachAnswer)_agentMgr.send(hostId, cmd);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
if(host!=null) {
|
if(host!=null) {
|
||||||
volService.disconnectVolumeFromHost(volFactory.getVolume(volumeToAttach.getId()), host, dataStore);
|
volService.revokeAccess(volFactory.getVolume(volumeToAttach.getId()), host, dataStore);
|
||||||
}
|
}
|
||||||
throw new CloudRuntimeException(errorMsg + " due to: " + e.getMessage());
|
throw new CloudRuntimeException(errorMsg + " due to: " + e.getMessage());
|
||||||
}
|
}
|
||||||
@ -2250,7 +2250,7 @@ public class VolumeApiServiceImpl extends ManagerBase implements VolumeApiServic
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(host!= null) {
|
if(host!= null) {
|
||||||
volService.disconnectVolumeFromHost(volFactory.getVolume(volumeToAttach.getId()), host, dataStore);
|
volService.revokeAccess(volFactory.getVolume(volumeToAttach.getId()), host, dataStore);
|
||||||
}
|
}
|
||||||
throw new CloudRuntimeException(errorMsg);
|
throw new CloudRuntimeException(errorMsg);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -4905,7 +4905,7 @@ public class UserVmManagerImpl extends ManagerBase implements UserVmManager, Vir
|
|||||||
|
|
||||||
// root.getPoolId() should be null if the VM we are detaching the disk from has never been started before
|
// root.getPoolId() should be null if the VM we are detaching the disk from has never been started before
|
||||||
DataStore dataStore = root.getPoolId() != null ? _dataStoreMgr.getDataStore(root.getPoolId(), DataStoreRole.Primary) : null;
|
DataStore dataStore = root.getPoolId() != null ? _dataStoreMgr.getDataStore(root.getPoolId(), DataStoreRole.Primary) : null;
|
||||||
volumeMgr.disconnectVolumeFromHost(volFactory.getVolume(root.getId()), host, dataStore);
|
volumeMgr.revokeAccess(volFactory.getVolume(root.getId()), host, dataStore);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user