From 0846bfe1ff7bd269acb250374af5b601343e7334 Mon Sep 17 00:00:00 2001 From: Mike Tutkowski Date: Sun, 19 Jan 2014 09:03:17 -0700 Subject: [PATCH] CLOUDSTACK-5873: [Automation] Failed to attach volume to VM, if the vm is created with option startvm=false --- .../datastore/driver/SolidfirePrimaryDataStoreDriver.java | 7 +++++++ server/src/com/cloud/storage/VolumeApiServiceImpl.java | 7 ++----- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/plugins/storage/volume/solidfire/src/org/apache/cloudstack/storage/datastore/driver/SolidfirePrimaryDataStoreDriver.java b/plugins/storage/volume/solidfire/src/org/apache/cloudstack/storage/datastore/driver/SolidfirePrimaryDataStoreDriver.java index 7d305e0f1b3..014413d3452 100644 --- a/plugins/storage/volume/solidfire/src/org/apache/cloudstack/storage/datastore/driver/SolidfirePrimaryDataStoreDriver.java +++ b/plugins/storage/volume/solidfire/src/org/apache/cloudstack/storage/datastore/driver/SolidfirePrimaryDataStoreDriver.java @@ -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 diff --git a/server/src/com/cloud/storage/VolumeApiServiceImpl.java b/server/src/com/cloud/storage/VolumeApiServiceImpl.java index fb35e2334ac..a79d8b4c217 100644 --- a/server/src/com/cloud/storage/VolumeApiServiceImpl.java +++ b/server/src/com/cloud/storage/VolumeApiServiceImpl.java @@ -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 details = new HashMap();