Skip to content

Commit d806f1f

Browse files
rebase fixes
1 parent 73025da commit d806f1f

File tree

4 files changed

+16
-19
lines changed

4 files changed

+16
-19
lines changed

plugins/storage/volume/scaleio/src/main/java/org/apache/cloudstack/storage/datastore/driver/ScaleIOPrimaryDataStoreDriver.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1498,7 +1498,7 @@ public boolean canDisconnectHostFromStoragePool(Host host, StoragePool pool) {
14981498
}
14991499

15001500
try {
1501-
final ScaleIOGatewayClient client = getScaleIOClient(pool.getId());
1501+
final ScaleIOGatewayClient client = getScaleIOClient(pool);
15021502
return client.listVolumesMappedToSdc(sdcId).isEmpty();
15031503
} catch (Exception e) {
15041504
logger.warn("Unable to check whether the host: " + host.getId() + " can be disconnected from storage pool: " + pool.getId() + ", due to " + e.getMessage(), e);

plugins/storage/volume/scaleio/src/main/java/org/apache/cloudstack/storage/datastore/manager/ScaleIOSDCManager.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -74,18 +74,18 @@ public interface ScaleIOSDCManager {
7474
/**
7575
* Returns the SDC Id of the host for the pool.
7676
* @param sdcGuid the SDC GUID
77-
* @param poolId the pool id
77+
* @param dataStore the datastore
7878
* @return SDC Id of the host for the pool
7979
*/
80-
String getHostSdcId(String sdcGuid, long poolId);
80+
String getHostSdcId(String sdcGuid, DataStore dataStore);
8181

8282
/**
8383
* Returns the connection status of host SDC of the pool.
8484
* @param sdcId the SDC id
85-
* @param poolId the pool id
85+
* @param dataStore the datastore
8686
* @return true if Host SDC is connected to the pool
8787
*/
88-
boolean isHostSdcConnected(String sdcId, long poolId, int waitTimeInSecs);
88+
boolean isHostSdcConnected(String sdcId, DataStore dataStore, int waitTimeInSecs);
8989

9090
/**
9191
* Returns the comma-separated list of MDM IPs of the pool.

plugins/storage/volume/scaleio/src/main/java/org/apache/cloudstack/storage/datastore/manager/ScaleIOSDCManagerImpl.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -361,7 +361,7 @@ public boolean canUnprepareSDC(Host host, DataStore dataStore) {
361361

362362
List<StoragePoolHostVO> poolHostVOsBySdc = storagePoolHostDao.findByLocalPath(sdcId);
363363
if (CollectionUtils.isNotEmpty(poolHostVOsBySdc) && poolHostVOsBySdc.size() > 1) {
364-
LOGGER.debug(String.format("There are other connected pools with the same SDC of the host %s, shouldn't unprepare SDC", host));
364+
logger.debug(String.format("There are other connected pools with the same SDC of the host %s, shouldn't unprepare SDC", host));
365365
return false;
366366
}
367367

plugins/storage/volume/scaleio/src/main/java/org/apache/cloudstack/storage/datastore/provider/ScaleIOHostListener.java

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,6 @@
1818
*/
1919
package org.apache.cloudstack.storage.datastore.provider;
2020

21-
import java.net.URISyntaxException;
22-
import java.security.KeyManagementException;
23-
import java.security.NoSuchAlgorithmException;
2421
import java.util.HashMap;
2522
import java.util.Map;
2623

@@ -33,7 +30,6 @@
3330
import org.apache.cloudstack.storage.datastore.db.PrimaryDataStoreDao;
3431
import org.apache.cloudstack.storage.datastore.db.StoragePoolDetailVO;
3532
import org.apache.cloudstack.storage.datastore.db.StoragePoolDetailsDao;
36-
import org.apache.cloudstack.storage.datastore.db.StoragePoolVO;
3733
import org.apache.cloudstack.storage.datastore.manager.ScaleIOSDCManager;
3834
import org.apache.cloudstack.storage.datastore.manager.ScaleIOSDCManagerImpl;
3935
import org.apache.commons.collections.MapUtils;
@@ -83,7 +79,7 @@ public boolean hostConnect(long hostId, long poolId) {
8379
DataStore dataStore = _dataStoreMgr.getDataStore(poolId, DataStoreRole.Primary);
8480
StoragePool storagePool = (StoragePool) dataStore;
8581
StoragePoolHostVO storagePoolHost = _storagePoolHostDao.findByPoolHost(poolId, hostId);
86-
String sdcId = getSdcIdOfHost(host, storagePool);
82+
String sdcId = getSdcIdOfHost(host, dataStore);
8783
if (StringUtils.isBlank(sdcId)) {
8884
if (storagePoolHost != null) {
8985
_storagePoolHostDao.deleteStoragePoolHostDetails(hostId, poolId);
@@ -101,7 +97,8 @@ public boolean hostConnect(long hostId, long poolId) {
10197
return true;
10298
}
10399

104-
private String getSdcIdOfHost(HostVO host, StoragePool storagePool) {
100+
private String getSdcIdOfHost(HostVO host, DataStore dataStore) {
101+
StoragePool storagePool = (StoragePool) dataStore;
105102
long hostId = host.getId();
106103
long poolId = storagePool.getId();
107104
String systemId = null;
@@ -136,7 +133,7 @@ private String getSdcIdOfHost(HostVO host, StoragePool storagePool) {
136133
sdcId = poolDetails.get(ScaleIOGatewayClient.SDC_ID);
137134
} else if (poolDetails.containsKey(ScaleIOGatewayClient.SDC_GUID)) {
138135
String sdcGuid = poolDetails.get(ScaleIOGatewayClient.SDC_GUID);
139-
sdcId = _sdcManager.getHostSdcId(sdcGuid, poolId);
136+
sdcId = _sdcManager.getHostSdcId(sdcGuid, dataStore);
140137
}
141138

142139
if (StringUtils.isBlank(sdcId)) {
@@ -148,7 +145,7 @@ private String getSdcIdOfHost(HostVO host, StoragePool storagePool) {
148145

149146
if (details.containsKey(ScaleIOSDCManager.ConnectOnDemand.key())) {
150147
String connectOnDemand = details.get(ScaleIOSDCManager.ConnectOnDemand.key());
151-
if (connectOnDemand != null && !Boolean.parseBoolean(connectOnDemand) && !_sdcManager.isHostSdcConnected(sdcId, poolId, 15)) {
148+
if (connectOnDemand != null && !Boolean.parseBoolean(connectOnDemand) && !_sdcManager.isHostSdcConnected(sdcId, dataStore, 15)) {
152149
logger.warn("SDC not connected on the host: " + hostId);
153150
String msg = "SDC not connected on the host: " + hostId + ", reconnect the SDC to MDM and restart agent";
154151
_alertMgr.sendAlert(AlertManager.AlertType.ALERT_TYPE_HOST, host.getDataCenterId(), host.getPodId(), "SDC not connected on host: " + host.getUuid(), msg);
@@ -163,19 +160,19 @@ private ModifyStoragePoolAnswer sendModifyStoragePoolCommand(ModifyStoragePoolCo
163160
Answer answer = _agentMgr.easySend(host.getId(), cmd);
164161

165162
if (answer == null) {
166-
throw new CloudRuntimeException(String.format("Unable to get an answer to the modify storage pool command (add: %s) for PowerFlex storage pool %s, sent to host %d",
167-
cmd.getAdd(), getStoragePoolDetails(storagePool), hostId));
163+
throw new CloudRuntimeException(String.format("Unable to get an answer to the modify storage pool command (add: %s) for PowerFlex storage pool %s, sent to host %s",
164+
cmd.getAdd(), getStoragePoolDetails(storagePool), host));
168165
}
169166

170167
if (!answer.getResult()) {
171168
if (cmd.getAdd()) {
172-
String msg = "Unable to attach PowerFlex storage pool " + getStoragePoolDetails(storagePool) + " to the host " + hostId;
169+
String msg = "Unable to attach PowerFlex storage pool " + getStoragePoolDetails(storagePool) + " to the host " + host;
173170

174171
_alertMgr.sendAlert(AlertManager.AlertType.ALERT_TYPE_HOST, storagePool.getDataCenterId(), storagePool.getPodId(), msg, msg);
175172

176173
throw new CloudRuntimeException("Unable to connect to PowerFlex storage pool " + getStoragePoolDetails(storagePool) + " due to " + answer.getDetails());
177174
} else {
178-
String msg = "Unable to detach PowerFlex storage pool " + getStoragePoolDetails(storagePool) + " from the host " + hostId;
175+
String msg = "Unable to detach PowerFlex storage pool " + getStoragePoolDetails(storagePool) + " from the host " + host;
179176

180177
_alertMgr.sendAlert(AlertManager.AlertType.ALERT_TYPE_HOST, storagePool.getDataCenterId(), storagePool.getPodId(), msg, msg);
181178
}
@@ -214,7 +211,7 @@ public boolean hostDisconnected(long hostId, long poolId) {
214211
}
215212

216213
ModifyStoragePoolCommand cmd = new ModifyStoragePoolCommand(false, storagePool, storagePool.getPath(), details);
217-
ModifyStoragePoolAnswer answer = sendModifyStoragePoolCommand(cmd, storagePool, hostId);
214+
ModifyStoragePoolAnswer answer = sendModifyStoragePoolCommand(cmd, storagePool, host);
218215
if (!answer.getResult()) {
219216
logger.error("Failed to disconnect storage pool: " + storagePool + " and host: " + hostId);
220217
return false;

0 commit comments

Comments
 (0)