Skip to content

Commit 413c61b

Browse files
author
Mike Tutkowski
committed
CLOUDSTACK-5873: [Automation] Failed to attach volume to VM, if the vm is created with option startvm=false
1 parent 1b06451 commit 413c61b

2 files changed

Lines changed: 9 additions & 5 deletions

File tree

‎plugins/storage/volume/solidfire/src/org/apache/cloudstack/storage/datastore/driver/SolidfirePrimaryDataStoreDriver.java‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,12 @@ public String getTargetSecret() {
210210
}
211211
}
212212

213+
@Override
214+
public ChapInfo getChapInfo(VolumeInfo volumeInfo) {
215+
return null;
216+
}
217+
218+
/*
213219
@Override
214220
public ChapInfo getChapInfo(VolumeInfo volumeInfo) {
215221
long accountId = volumeInfo.getAccountId();
@@ -232,6 +238,7 @@ public ChapInfo getChapInfo(VolumeInfo volumeInfo) {
232238
233239
return new ChapInfoImpl(chapInitiatorUsername, chapInitiatorSecret, chapTargetUsername, chapTargetSecret);
234240
}
241+
*/
235242

236243
// get the VAG associated with volumeInfo's cluster, if any (ListVolumeAccessGroups)
237244
// if the VAG exists

‎server/src/com/cloud/storage/VolumeApiServiceImpl.java‎

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2023,13 +2023,10 @@ private VolumeVO sendAttachVolumeCommand(UserVmVO vm, VolumeVO volumeToAttach, L
20232023
// volumeToAttachStoragePool should be null if the VM we are attaching the disk to has never been started before
20242024
DataStore dataStore = volumeToAttachStoragePool != null ? dataStoreMgr.getDataStore(volumeToAttachStoragePool.getId(), DataStoreRole.Primary) : null;
20252025

2026-
boolean queryForChap = true;
2027-
20282026
// if we don't have a host, the VM we are attaching the disk to has never been started before
20292027
if (host != null) {
20302028
try {
2031-
// if connectVolumeToHost returns true, then we do not want to use CHAP because the volume is already connected to the host(s)
2032-
queryForChap = !volService.connectVolumeToHost(volFactory.getVolume(volumeToAttach.getId()), host, dataStore);
2029+
volService.connectVolumeToHost(volFactory.getVolume(volumeToAttach.getId()), host, dataStore);
20332030
}
20342031
catch (Exception e) {
20352032
volService.disconnectVolumeFromHost(volFactory.getVolume(volumeToAttach.getId()), host, dataStore);
@@ -2052,7 +2049,7 @@ private VolumeVO sendAttachVolumeCommand(UserVmVO vm, VolumeVO volumeToAttach, L
20522049

20532050
AttachCommand cmd = new AttachCommand(disk, vm.getInstanceName());
20542051

2055-
ChapInfo chapInfo = queryForChap ? volService.getChapInfo(volFactory.getVolume(volumeToAttach.getId()), dataStore) : null;
2052+
ChapInfo chapInfo = volService.getChapInfo(volFactory.getVolume(volumeToAttach.getId()), dataStore);
20562053

20572054
Map<String, String> details = new HashMap<String, String>();
20582055

0 commit comments

Comments
 (0)