CLOUDSTACK-5873: [Automation] Failed to attach volume to VM, if the vm is created with option startvm=false

This commit is contained in:
Mike Tutkowski 2014-01-19 09:03:17 -07:00
parent 1b064515ac
commit 413c61b519
2 changed files with 9 additions and 5 deletions

View File

@ -210,6 +210,12 @@ public class SolidfirePrimaryDataStoreDriver implements PrimaryDataStoreDriver {
}
}
@Override
public ChapInfo getChapInfo(VolumeInfo volumeInfo) {
return null;
}
/*
@Override
public ChapInfo getChapInfo(VolumeInfo volumeInfo) {
long accountId = volumeInfo.getAccountId();
@ -232,6 +238,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

View File

@ -2023,13 +2023,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);
@ -2052,7 +2049,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>();