use of javax.cim.CIMArgument 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.cim.CIMArgument 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.cim.CIMArgument 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.cim.CIMArgument 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.cim.CIMArgument in project coprhd-controller by CoprHD.
the class VmaxSnapshotOperations method restoreGroupSnapshots.
/**
* Implementation should restore the set of snapshots that were taken for a set of
* volumes in a consistency group. That is, at some time there was a consistency
* group of volumes created and snapshot was taken of these; these snapshots would
* belong to a "snap-set". This restore operation, will restore the volumes in the
* consistency group from this snap-set. Any snapshot from the snap-set can be
* provided to restore the whole snap-set.
*
* @param storage [required] - StorageSystem object representing the array
* @param snapshot [required] - BlockSnapshot URI representing the previously created
* snap for the volume
* @param taskCompleter - TaskCompleter object used for the updating operation status.
*/
@Override
public void restoreGroupSnapshots(StorageSystem storage, URI volume, URI snapshot, TaskCompleter taskCompleter) throws DeviceControllerException {
try {
callEMCRefreshIfRequired(_dbClient, _helper, storage, Arrays.asList(snapshot));
BlockSnapshot snapshotObj = _dbClient.queryObject(BlockSnapshot.class, snapshot);
// Check if the consistency group exists
String consistencyGroupName = ConsistencyGroupUtils.getSourceConsistencyGroupName(snapshotObj, _dbClient);
storage = findProviderFactory.withGroup(storage, consistencyGroupName).find();
if (storage == null) {
ServiceError error = DeviceControllerErrors.smis.noConsistencyGroupWithGivenName();
taskCompleter.error(_dbClient, error);
return;
}
String snapshotGroupName = snapshotObj.getReplicationGroupInstance();
CIMObjectPath groupSynchronized = _cimPath.getGroupSynchronizedPath(storage, consistencyGroupName, snapshotGroupName);
if (_helper.checkExists(storage, groupSynchronized, false, false) != null) {
CIMObjectPath cimJob = null;
if (storage.checkIfVmax3()) {
if (snapshotObj.getSettingsInstance() == null) {
throw DeviceControllerException.exceptions.snapSettingsInstanceNull(snapshotObj.getSnapsetLabel(), snapshotObj.getId().toString());
}
// there could only be one restored snapshot per device at a time
// terminate any pre-existing one in favor of the new one
terminateAnyRestoreSessions(storage, snapshotObj, snapshot, taskCompleter);
CIMObjectPath settingsPath = _cimPath.getGroupSynchronizedSettingsPath(storage, consistencyGroupName, snapshotObj.getSettingsInstance());
cimJob = _helper.callModifySettingsDefineState(storage, _helper.getRestoreFromSettingsStateInputArguments(settingsPath, false));
} else {
CIMArgument[] restoreCGSnapInput = _helper.getRestoreFromReplicaInputArguments(groupSynchronized);
cimJob = _helper.callModifyReplica(storage, restoreCGSnapInput);
}
ControllerServiceImpl.enqueueJob(new QueueJob(new SmisBlockRestoreSnapshotJob(cimJob, storage.getId(), taskCompleter)));
} else {
ServiceError error = DeviceControllerErrors.smis.unableToFindSynchPath(consistencyGroupName);
taskCompleter.error(_dbClient, error);
}
} catch (Exception e) {
String message = String.format("Generic exception when trying to restoring snapshots from consistency group on array %s", storage.getSerialNumber());
_log.error(message, e);
ServiceError error = DeviceControllerErrors.smis.methodFailed("restoreGroupSnapshots", e.getMessage());
taskCompleter.error(_dbClient, error);
}
}
Aggregations