mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
CLOUDSTACK-5873: [Automation] Failed to attach volume to VM, if the vm is created with option startvm=false
This commit is contained in:
parent
e88cc488e5
commit
0846bfe1ff
@ -217,6 +217,12 @@ public class SolidfirePrimaryDataStoreDriver implements PrimaryDataStoreDriver {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public ChapInfo getChapInfo(VolumeInfo volumeInfo) {
|
||||
return null;
|
||||
}
|
||||
|
||||
/*
|
||||
@Override
|
||||
public ChapInfo getChapInfo(VolumeInfo volumeInfo) {
|
||||
long accountId = volumeInfo.getAccountId();
|
||||
@ -239,6 +245,7 @@ public class SolidfirePrimaryDataStoreDriver implements PrimaryDataStoreDriver {
|
||||
|
||||
return new ChapInfoImpl(chapInitiatorUsername, chapInitiatorSecret, chapTargetUsername, chapTargetSecret);
|
||||
}
|
||||
*/
|
||||
|
||||
// get the VAG associated with volumeInfo's cluster, if any (ListVolumeAccessGroups)
|
||||
// if the VAG exists
|
||||
|
||||
@ -2017,13 +2017,10 @@ public class VolumeApiServiceImpl extends ManagerBase implements VolumeApiServic
|
||||
// volumeToAttachStoragePool should be null if the VM we are attaching the disk to has never been started before
|
||||
DataStore dataStore = volumeToAttachStoragePool != null ? dataStoreMgr.getDataStore(volumeToAttachStoragePool.getId(), DataStoreRole.Primary) : null;
|
||||
|
||||
boolean queryForChap = true;
|
||||
|
||||
// if we don't have a host, the VM we are attaching the disk to has never been started before
|
||||
if (host != null) {
|
||||
try {
|
||||
// if connectVolumeToHost returns true, then we do not want to use CHAP because the volume is already connected to the host(s)
|
||||
queryForChap = !volService.connectVolumeToHost(volFactory.getVolume(volumeToAttach.getId()), host, dataStore);
|
||||
volService.connectVolumeToHost(volFactory.getVolume(volumeToAttach.getId()), host, dataStore);
|
||||
}
|
||||
catch (Exception e) {
|
||||
volService.disconnectVolumeFromHost(volFactory.getVolume(volumeToAttach.getId()), host, dataStore);
|
||||
@ -2046,7 +2043,7 @@ public class VolumeApiServiceImpl extends ManagerBase implements VolumeApiServic
|
||||
|
||||
AttachCommand cmd = new AttachCommand(disk, vm.getInstanceName());
|
||||
|
||||
ChapInfo chapInfo = queryForChap ? volService.getChapInfo(volFactory.getVolume(volumeToAttach.getId()), dataStore) : null;
|
||||
ChapInfo chapInfo = volService.getChapInfo(volFactory.getVolume(volumeToAttach.getId()), dataStore);
|
||||
|
||||
Map<String, String> details = new HashMap<String, String>();
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user