use of javax.wbem.WBEMException in project coprhd-controller by CoprHD.
the class SmisMetaVolumeOperations method createMetaVolumeMembers.
/**
* Create meta volume member devices. These devices provide capacity to meta volume.
* SMI-S requires that these devices be created unbound form a pool.
*
* @param storageSystem
* @param storagePool
* @param metaHead
* @param memberCount
* @param memberCapacity
* @param metaVolumeTaskCompleter
* @return list of native ids of meta member devices
* @throws Exception
*/
@Override
public List<String> createMetaVolumeMembers(StorageSystem storageSystem, StoragePool storagePool, Volume metaHead, int memberCount, long memberCapacity, MetaVolumeTaskCompleter metaVolumeTaskCompleter) throws Exception {
_log.info(String.format("Create Meta Volume Members Start - Array: %s, Pool: %s, %n Volume: %s, Count:%s, Member capacity: %s", storageSystem.getSerialNumber(), storagePool.getNativeId(), metaHead.getLabel(), memberCount, memberCapacity));
try {
boolean isThinlyProvisioned = metaHead.getThinlyProvisioned();
CIMObjectPath configSvcPath = _cimPath.getConfigSvcPath(storageSystem);
CIMArgument[] inArgs;
// Prepare parameters and call method to create meta members
inArgs = _helper.getCreateMetaVolumeMembersInputArguments(storageSystem, storagePool, memberCount, memberCapacity, isThinlyProvisioned);
CIMArgument[] outArgs = new CIMArgument[5];
StorageSystem forProvider = _helper.getStorageSystemForProvider(storageSystem, metaHead);
_log.info("Selected Provider : {}", forProvider.getNativeGuid());
SmisCreateMetaVolumeMembersJob smisJobCompleter = new SmisCreateMetaVolumeMembersJob(null, forProvider.getId(), metaHead, memberCount, metaVolumeTaskCompleter);
_helper.invokeMethodSynchronously(forProvider, configSvcPath, SmisConstants.CREATE_OR_MODIFY_ELEMENT_FROM_STORAGE_POOL, inArgs, outArgs, smisJobCompleter);
return smisJobCompleter.getMetaMembers();
} catch (WBEMException e) {
_log.error("Problem making SMI-S call: ", e);
ServiceError error = DeviceControllerErrors.smis.unableToCallStorageProvider(e.getMessage());
metaVolumeTaskCompleter.getVolumeTaskCompleter().error(_dbClient, error);
throw e;
} catch (Exception e) {
_log.error("Problem in createMetaVolumeMembers: ", e);
ServiceError error = DeviceControllerErrors.smis.methodFailed("createMetaVolumeMemebers", e.getMessage());
metaVolumeTaskCompleter.getVolumeTaskCompleter().error(_dbClient, error);
throw e;
} finally {
_log.info(String.format("Create Meta Volume Members End - Array: %s, Pool: %s, %n Volume: %s", storageSystem.getSerialNumber(), storagePool.getNativeId(), metaHead.getLabel()));
}
}
use of javax.wbem.WBEMException in project coprhd-controller by CoprHD.
the class SmisMetaVolumeOperations method expandVolumeAsMetaVolume.
/**
* Expand regular volume as a meta volume.
*
* @param storageSystem
* @param metaHead
* @param metaMembers
* @param metaType
* @param metaVolumeTaskCompleter
* @throws DeviceControllerException
*/
@Override
public void expandVolumeAsMetaVolume(StorageSystem storageSystem, StoragePool storagePool, Volume metaHead, List<String> metaMembers, String metaType, MetaVolumeTaskCompleter metaVolumeTaskCompleter) throws DeviceControllerException {
String label = null;
_log.info(String.format("Expand Volume as Meta Volume Start - Array: %s, Head: %s, Recommended meta type: %s %n Members:%s", storageSystem.getSerialNumber(), metaHead.getLabel(), metaType, metaMembers));
label = metaHead.getLabel();
boolean isRPVolume = false;
if (metaHead != null) {
// A volume is of type RP if the volume has an RP copy name or it's a VPlex backing volume associated to a
// VPlex RP source volume.
isRPVolume = metaHead.checkForRp() || RPHelper.isAssociatedToAnyRpVplexTypes(metaHead, _dbClient);
}
// initialize the retry/attempt variables
int attempt = 0;
int retries = 1;
if (isRPVolume) {
// if we are dealing with an RP volume, we need to set the retry count appropriately
retries = MAX_RP_EXPAND_RETRIES;
}
// has not been received or processed yet.
while (attempt++ <= retries) {
try {
CIMObjectPath elementCompositionServicePath = _cimPath.getElementCompositionSvcPath(storageSystem);
CIMArgument[] inArgs;
inArgs = _helper.getCreateMetaVolumeInputArguments(storageSystem, label, metaHead, metaMembers, metaType, true);
CIMArgument[] outArgs = new CIMArgument[5];
// TODO evaluate use of asunc call for the last operation in extend sequence
// _helper.invokeMethod(storageSystem, elementCompositionServicePath, SmisConstants.CREATE_OR_MODIFY_COMPOSITE_ELEMENT,
// inArgs,
// outArgs);
// CIMObjectPath job = _cimPath.getCimObjectPathFromOutputArgs(outArgs, SmisConstants.JOB);
// if (job != null) {
// ControllerServiceImpl.enqueueJob(new QueueJob(new SmisVolumeExpandJob(job, storageSystem.getId(),
// taskCompleter, "ExpandAsMetaVolume")));
// }
//
StorageSystem forProvider = _helper.getStorageSystemForProvider(storageSystem, metaHead);
_log.info("Selected Provider : {}", forProvider.getNativeGuid());
SmisJob smisJobCompleter = new SmisVolumeExpandJob(null, forProvider.getId(), storagePool.getId(), metaVolumeTaskCompleter, "ExpandAsMetaVolume");
if (isRPVolume) {
_log.info(String.format("Attempt %s/%s to expand volume %s, which is associated with RecoverPoint", attempt, MAX_RP_EXPAND_RETRIES, metaHead.getLabel()));
}
_helper.invokeMethodSynchronously(forProvider, elementCompositionServicePath, SmisConstants.CREATE_OR_MODIFY_COMPOSITE_ELEMENT, inArgs, outArgs, smisJobCompleter);
// No exceptions so break out of the retry loop
break;
} catch (WBEMException e) {
_log.error("Problem making SMI-S call: ", e);
ServiceError error = DeviceControllerErrors.smis.unableToCallStorageProvider(e.getMessage());
metaVolumeTaskCompleter.getVolumeTaskCompleter().error(_dbClient, _locker, error);
} catch (Exception e) {
if (attempt != retries && isRPVolume && e.getMessage().contains("The requested device has active sessions")) {
// RP has issued an async request to terminate the active session so we just need to wait
// and retry the expand.
_log.warn(String.format("Encountered exception attempting to expand RP volume %s. Waiting %s milliseconds before trying again. Error: %s", metaHead.getLabel(), RP_EXPAND_WAIT_FOR_RETRY, e.getMessage()));
try {
Thread.sleep(RP_EXPAND_WAIT_FOR_RETRY);
} catch (InterruptedException e1) {
Thread.currentThread().interrupt();
}
} else {
_log.error("Problem in expandVolumeAsMetaVolume: ", e);
ServiceError error = DeviceControllerErrors.smis.methodFailed("expandVolumeAsMetaVolume", e.getMessage());
metaVolumeTaskCompleter.getVolumeTaskCompleter().error(_dbClient, _locker, error);
// Break out of the retry loop
break;
}
}
}
_log.info(String.format("Expand Volume as Meta Volume End - Array:%s, Head:%s, %n Head device ID: %s, Members:%s", storageSystem.getSerialNumber(), metaHead.getLabel(), metaHead.getNativeId(), metaMembers));
}
use of javax.wbem.WBEMException in project coprhd-controller by CoprHD.
the class SmisMetaVolumeOperations method createMetaVolumeHead.
/**
* Create meta volume head device. Meta volume is represented by its head.
* We create it as a regular bound volume.
*
* @param storageSystem
* @param storagePool
* @param metaHead
* @param capacity
* @param capabilities
* @param metaVolumeTaskCompleter
* @throws Exception
*/
@Override
public void createMetaVolumeHead(StorageSystem storageSystem, StoragePool storagePool, Volume metaHead, long capacity, VirtualPoolCapabilityValuesWrapper capabilities, MetaVolumeTaskCompleter metaVolumeTaskCompleter) throws Exception {
String label;
_log.info(String.format("Create Meta Volume Head Start - Array: %s, Pool: %s, %n Head: %s, IsThinlyProvisioned: %s, Capacity: %s", storageSystem.getSerialNumber(), storagePool.getNativeId(), metaHead.getLabel(), metaHead.getThinlyProvisioned(), capacity));
String tenantName = "";
try {
TenantOrg tenant = _dbClient.queryObject(TenantOrg.class, metaHead.getTenant().getURI());
tenantName = tenant.getLabel();
} catch (DatabaseException e) {
_log.error("Error lookup TenantOrb object", e);
}
label = _nameGenerator.generate(tenantName, metaHead.getLabel(), metaHead.getId().toString(), '-', SmisConstants.MAX_VOLUME_NAME_LENGTH);
boolean isThinlyProvisioned = metaHead.getThinlyProvisioned();
// Thin stripe meta heads should be created unbound from pool on VMAX
// Thin concatenated meta heads are created unbound from pool on vmax as well.
// This is done to preallocate capacity later when meta volume is bound to pool.
boolean isBoundToPool = !(isThinlyProvisioned && DiscoveredDataObject.Type.vmax.toString().equalsIgnoreCase(storageSystem.getSystemType()));
try {
CIMObjectPath configSvcPath = _cimPath.getConfigSvcPath(storageSystem);
CIMArgument[] inArgs;
// only for vnxBlock, we need to associate StoragePool Setting as Goal
if (DiscoveredDataObject.Type.vnxblock.toString().equalsIgnoreCase(storageSystem.getSystemType())) {
inArgs = _helper.getCreateVolumesInputArgumentsOnFastEnabledPool(storageSystem, storagePool, label, capacity, 1, isThinlyProvisioned, capabilities.getAutoTierPolicyName());
} else {
inArgs = _helper.getCreateVolumesInputArguments(storageSystem, storagePool, label, capacity, 1, isThinlyProvisioned, null, isBoundToPool);
}
CIMArgument[] outArgs = new CIMArgument[5];
StorageSystem forProvider = _helper.getStorageSystemForProvider(storageSystem, metaHead);
_log.info("Selected Provider : {}", forProvider.getNativeGuid());
SmisCreateMetaVolumeHeadJob smisJobCompleter = new SmisCreateMetaVolumeHeadJob(null, forProvider.getId(), metaVolumeTaskCompleter, metaHead.getId());
_helper.invokeMethodSynchronously(forProvider, configSvcPath, _helper.createVolumesMethodName(forProvider), inArgs, outArgs, smisJobCompleter);
} catch (WBEMException e) {
_log.error("Problem making SMI-S call: ", e);
ServiceError error = DeviceControllerErrors.smis.unableToCallStorageProvider(e.getMessage());
metaVolumeTaskCompleter.getVolumeTaskCompleter().error(_dbClient, error);
throw e;
} catch (Exception e) {
_log.error("Problem in createMetaVolumeHead: " + metaHead.getLabel(), e);
ServiceError error = DeviceControllerErrors.smis.methodFailed("createMetaVolumeHead", e.getMessage());
metaVolumeTaskCompleter.getVolumeTaskCompleter().error(_dbClient, error);
throw e;
} finally {
_log.info(String.format("Create Meta Volume Head End - Array:%s, Pool: %s, %n Head: %s", storageSystem.getSerialNumber(), storagePool.getNativeId(), metaHead.getLabel()));
}
}
use of javax.wbem.WBEMException in project coprhd-controller by CoprHD.
the class SmisMetaVolumeOperations method expandMetaVolume.
/**
* Expand meta volume.
*
* @param storageSystem
* @param metaHead
* @param newMetaMembers
* @param metaVolumeTaskCompleter
* @throws DeviceControllerException
*/
@Override
public void expandMetaVolume(StorageSystem storageSystem, StoragePool storagePool, Volume metaHead, List<String> newMetaMembers, MetaVolumeTaskCompleter metaVolumeTaskCompleter) throws DeviceControllerException {
_log.info(String.format("Expand Meta Volume Start - Array: %s, Head: %s, %n New members:%s", storageSystem.getSerialNumber(), metaHead.getLabel(), newMetaMembers));
boolean isRPVolume = false;
if (metaHead != null) {
// A volume is of type RP if the volume has an RP copy name or it's a VPlex backing volume associated to a
// VPlex RP source volume.
isRPVolume = metaHead.checkForRp() || RPHelper.isAssociatedToAnyRpVplexTypes(metaHead, _dbClient);
}
// initialize the retry/attempt variables
int attempt = 0;
int retries = 1;
if (isRPVolume) {
// if we are dealing with an RP volume, we need to set the retry count appropriately
retries = MAX_RP_EXPAND_RETRIES;
}
// has not been received or processed yet.
while (attempt++ <= retries) {
try {
CIMObjectPath elementCompositionServicePath = _cimPath.getElementCompositionSvcPath(storageSystem);
CIMArgument[] inArgs;
inArgs = _helper.getExpandMetaVolumeInputArguments(storageSystem, metaHead, newMetaMembers);
CIMArgument[] outArgs = new CIMArgument[5];
// TODO evaluate use of asunc call for the last operation in extend sequence
// _helper.invokeMethod(storageSystem, elementCompositionServicePath, SmisConstants.CREATE_OR_MODIFY_COMPOSITE_ELEMENT,
// inArgs,
// outArgs);
// CIMObjectPath job = _cimPath.getCimObjectPathFromOutputArgs(outArgs, SmisConstants.JOB);
// if (job != null) {
// ControllerServiceImpl.enqueueJob(new QueueJob(new SmisVolumeExpandJob(job, storageSystem.getId(),
// taskCompleter, "ExpandMetaVolume")));
// }
StorageSystem forProvider = _helper.getStorageSystemForProvider(storageSystem, metaHead);
_log.info("Selected Provider : {}", forProvider.getNativeGuid());
SmisJob smisJobCompleter = new SmisVolumeExpandJob(null, forProvider.getId(), storagePool.getId(), metaVolumeTaskCompleter, "ExpandMetaVolume");
if (isRPVolume) {
_log.info(String.format("Attempt %s/%s to expand volume %s, which is associated with RecoverPoint", attempt, MAX_RP_EXPAND_RETRIES, metaHead.getLabel()));
}
_helper.invokeMethodSynchronously(forProvider, elementCompositionServicePath, SmisConstants.CREATE_OR_MODIFY_COMPOSITE_ELEMENT, inArgs, outArgs, smisJobCompleter);
// No exceptions so break out of the retry loop
break;
} catch (WBEMException e) {
_log.error("Problem making SMI-S call: ", e);
ServiceError error = DeviceControllerErrors.smis.unableToCallStorageProvider(e.getMessage());
metaVolumeTaskCompleter.getVolumeTaskCompleter().error(_dbClient, _locker, error);
} catch (Exception e) {
if (attempt != retries && isRPVolume && e.getMessage().contains("The requested device has active sessions")) {
// RP has issued an async request to terminate the active session so we just need to wait
// and retry the expand.
_log.warn(String.format("Encountered exception attempting to expand RP volume %s. Waiting %s milliseconds before trying again. Error: %s", metaHead.getLabel(), RP_EXPAND_WAIT_FOR_RETRY, e.getMessage()));
try {
Thread.sleep(RP_EXPAND_WAIT_FOR_RETRY);
} catch (InterruptedException e1) {
Thread.currentThread().interrupt();
}
} else {
_log.error("Problem in expandMetaVolume: ", e);
ServiceError error = DeviceControllerErrors.smis.methodFailed("expandVolume", e.getMessage());
metaVolumeTaskCompleter.getVolumeTaskCompleter().error(_dbClient, _locker, error);
// Break out of the retry loop
break;
}
}
}
_log.info(String.format("Expand Meta Volume End - Array:%s, Head:%s, %n Head device ID: %s, New members:%s", storageSystem.getSerialNumber(), metaHead.getLabel(), metaHead.getNativeId(), newMetaMembers));
}
use of javax.wbem.WBEMException in project coprhd-controller by CoprHD.
the class SmisStorageDevice method doCleanupMetaMembers.
@Override
public void doCleanupMetaMembers(final StorageSystem storageSystem, final Volume volume, CleanupMetaVolumeMembersCompleter cleanupCompleter) throws DeviceControllerException {
// Remove meta member volumes from storage device
try {
_log.info(String.format("doCleanupMetaMembers Start - Array: %s, Volume: %s", storageSystem.getSerialNumber(), volume.getLabel()));
// Get meta volume members from the volume data
StringSet metaMembers = volume.getMetaVolumeMembers();
if (metaMembers != null && !metaMembers.isEmpty()) {
_log.info(String.format("doCleanupMetaMembers: Members stored for meta volume: %n %s", metaMembers));
// Check if volumes still exist in array and if it is not composite member (already
// added to the meta volume)
Set<String> volumeIds = new HashSet<String>();
for (String nativeId : metaMembers) {
CIMInstance volumeInstance = _helper.checkExists(storageSystem, _cimPath.getVolumePath(storageSystem, nativeId), false, false);
if (volumeInstance != null) {
// Check that volume is not "Composite Volume Member", "Usage" property
// equals 15
String usage = CIMPropertyFactory.getPropertyValue(volumeInstance, SmisConstants.CP_VOLUME_USAGE);
int usageInt = Integer.valueOf(usage);
_log.debug("doCleanupMetaMembers: Volume: " + nativeId + ", Usage of volume: " + usageInt);
if (usageInt != SmisConstants.COMPOSITE_ELEMENT_MEMBER) {
volumeIds.add(nativeId);
}
}
}
if (volumeIds.isEmpty()) {
_log.info("doCleanupMetaMembers: No meta members to cleanup in array.");
cleanupCompleter.ready(_dbClient);
} else {
_log.info(String.format("doCleanupMetaMembers: Members to cleanup in array: %n %s", volumeIds));
String[] nativeIds = volumeIds.toArray(new String[0]);
// Prepare parameters and call method to delete meta members from array
CIMObjectPath configSvcPath = _cimPath.getConfigSvcPath(storageSystem);
CIMArgument[] inArgs = _helper.getDeleteVolumesInputArguments(storageSystem, nativeIds);
CIMArgument[] outArgs = new CIMArgument[5];
SmisCleanupMetaVolumeMembersJob smisJobCompleter = null;
String returnElementsMethod;
if (storageSystem.getUsingSmis80()) {
returnElementsMethod = SmisConstants.RETURN_ELEMENTS_TO_STORAGE_POOL;
} else {
returnElementsMethod = SmisConstants.EMC_RETURN_TO_STORAGE_POOL;
}
// volume create rollback)
if (cleanupCompleter.isWFStep()) {
// invoke async
_helper.invokeMethod(storageSystem, configSvcPath, returnElementsMethod, inArgs, outArgs);
CIMObjectPath job = _cimPath.getCimObjectPathFromOutputArgs(outArgs, SmisConstants.JOB);
if (job != null) {
ControllerServiceImpl.enqueueJob(new QueueJob(new SmisCleanupMetaVolumeMembersJob(job, storageSystem.getId(), volume.getId(), cleanupCompleter)));
}
} else {
// invoke synchronously
smisJobCompleter = new SmisCleanupMetaVolumeMembersJob(null, storageSystem.getId(), volume.getId(), cleanupCompleter);
_helper.invokeMethodSynchronously(storageSystem, configSvcPath, returnElementsMethod, inArgs, outArgs, smisJobCompleter);
}
}
} else {
_log.info("doCleanupMetaMembers: No meta members stored for meta volume. Nothing to cleanup in array.");
cleanupCompleter.ready(_dbClient);
}
} catch (WBEMException e) {
_log.error("Problem making SMI-S call: ", e);
ServiceError error = DeviceControllerErrors.smis.unableToCallStorageProvider(e.getMessage());
cleanupCompleter.error(_dbClient, error);
} catch (Exception e) {
_log.error("Problem in doCleanupMetaMembers: ", e);
ServiceError error = DeviceControllerErrors.smis.methodFailed("doCleanupMetaMembers", e.getMessage());
cleanupCompleter.error(_dbClient, error);
}
_log.info(String.format("doCleanupMetaMembers End - Array: %s, Volume: %s", storageSystem.getSerialNumber(), volume.getLabel()));
}
Aggregations