use of org.apache.cloudstack.storage.datastore.api.SdcMappingInfo in project cloudstack by apache.
the class ScaleIOGatewayClientImpl method unmapVolumeFromAllSdcs.
@Override
public boolean unmapVolumeFromAllSdcs(final String volumeId) {
Preconditions.checkArgument(StringUtils.isNotEmpty(volumeId), "Volume id cannot be null");
Volume volume = getVolume(volumeId);
if (volume == null) {
return false;
}
List<SdcMappingInfo> mappedSdcList = volume.getMappedSdcList();
if (mappedSdcList == null || mappedSdcList.isEmpty()) {
return true;
}
Boolean unmapVolumeFromAllSdcsStatus = post("/instances/Volume::" + volumeId + "/action/removeMappedSdc", "{\"allSdcs\": \"\"}", Boolean.class);
if (unmapVolumeFromAllSdcsStatus != null) {
return unmapVolumeFromAllSdcsStatus;
}
return false;
}
use of org.apache.cloudstack.storage.datastore.api.SdcMappingInfo in project cloudstack by apache.
the class ScaleIOGatewayClientImpl method isVolumeMappedToSdc.
@Override
public boolean isVolumeMappedToSdc(final String volumeId, final String sdcId) {
Preconditions.checkArgument(StringUtils.isNotEmpty(volumeId), "Volume id cannot be null");
Preconditions.checkArgument(StringUtils.isNotEmpty(sdcId), "Sdc Id cannot be null");
if (StringUtils.isAnyEmpty(volumeId, sdcId)) {
return false;
}
Volume volume = getVolume(volumeId);
if (volume == null) {
return false;
}
List<SdcMappingInfo> mappedSdcList = volume.getMappedSdcList();
if (mappedSdcList != null && !mappedSdcList.isEmpty()) {
for (SdcMappingInfo mappedSdc : mappedSdcList) {
if (sdcId.equalsIgnoreCase(mappedSdc.getSdcId())) {
return true;
}
}
}
return false;
}
Aggregations