use of com.emc.storageos.xtremio.restapi.XtremIOClient in project coprhd-controller by CoprHD.
the class XtremIOStorageDevice method doCreateSnapshot.
@Override
public void doCreateSnapshot(StorageSystem storage, List<URI> snapshotList, Boolean createInactive, Boolean readOnly, TaskCompleter taskCompleter) throws DeviceControllerException {
_log.info("SnapShot Creation..... Started");
List<BlockSnapshot> snapshots = dbClient.queryObject(BlockSnapshot.class, snapshotList);
XtremIOClient client = XtremIOProvUtils.getXtremIOClient(dbClient, storage, xtremioRestClientFactory);
if (client.isVersion2() && ControllerUtils.checkSnapshotsInConsistencyGroup(snapshots, dbClient, taskCompleter)) {
snapshotOperations.createGroupSnapshots(storage, snapshotList, createInactive, readOnly, taskCompleter);
} else {
for (URI snapshotURI : snapshotList) {
snapshotOperations.createSingleVolumeSnapshot(storage, snapshotURI, createInactive, readOnly, taskCompleter);
}
}
_log.info("SnapShot Creation..... End");
}
use of com.emc.storageos.xtremio.restapi.XtremIOClient in project coprhd-controller by CoprHD.
the class XtremIOStorageDevice method doAddToConsistencyGroup.
@Override
public void doAddToConsistencyGroup(StorageSystem storage, URI consistencyGroupId, String replicationGroupName, List<URI> blockObjects, TaskCompleter taskCompleter) throws DeviceControllerException {
_log.info("{} doAddToConsistencyGroup START ...", storage.getSerialNumber());
BlockConsistencyGroup consistencyGroup = dbClient.queryObject(BlockConsistencyGroup.class, consistencyGroupId);
try {
// Check if the consistency group exists
XtremIOClient client = XtremIOProvUtils.getXtremIOClient(dbClient, storage, xtremioRestClientFactory);
if (!client.isVersion2()) {
_log.info("Nothing to add to consistency group {}", consistencyGroup.getLabel());
taskCompleter.ready(dbClient);
return;
}
String clusterName = client.getClusterDetails(storage.getSerialNumber()).getName();
String cgName = replicationGroupName != null ? replicationGroupName : consistencyGroup.getLabel();
XtremIOConsistencyGroup cg = XtremIOProvUtils.isCGAvailableInArray(client, cgName, clusterName);
if (cg == null) {
_log.error("The consistency group does not exist in the array: {}", storage.getSerialNumber());
taskCompleter.error(dbClient, DeviceControllerException.exceptions.consistencyGroupNotFound(consistencyGroup.getLabel(), consistencyGroup.getCgNameOnStorageSystem(storage.getId())));
return;
}
List<BlockObject> updatedBlockObjects = new ArrayList<BlockObject>();
for (URI uri : blockObjects) {
BlockObject blockObject = BlockObject.fetch(dbClient, uri);
if (blockObject != null) {
if (blockObject.getClass().isInstance(Volume.class)) {
Volume volume = (Volume) blockObject;
if (volume.checkForRp() || RPHelper.isAssociatedToRpVplexType(volume, dbClient, PersonalityTypes.METADATA, PersonalityTypes.TARGET)) {
// This causes issues with local array snapshots of RP+VPlex volumes.
continue;
}
}
client.addVolumeToConsistencyGroup(blockObject.getLabel(), cgName, clusterName);
blockObject.setConsistencyGroup(consistencyGroupId);
updatedBlockObjects.add(blockObject);
}
}
dbClient.updateAndReindexObject(updatedBlockObjects);
taskCompleter.ready(dbClient);
_log.info("{} doAddToConsistencyGroup END ...", storage.getSerialNumber());
} catch (Exception e) {
_log.error(String.format("Add To Consistency Group operation failed %s", e));
// Remove any references to the consistency group
for (URI blockObjectURI : blockObjects) {
BlockObject blockObject = BlockObject.fetch(dbClient, blockObjectURI);
if (blockObject != null) {
blockObject.setConsistencyGroup(NullColumnValueGetter.getNullURI());
}
dbClient.persistObject(blockObject);
}
taskCompleter.error(dbClient, DeviceControllerException.exceptions.failedToAddMembersToConsistencyGroup(consistencyGroup.getLabel(), consistencyGroup.getLabel(), e.getMessage()));
}
}
use of com.emc.storageos.xtremio.restapi.XtremIOClient in project coprhd-controller by CoprHD.
the class XtremIOStorageDevice method doCreateConsistencyGroup.
@Override
public void doCreateConsistencyGroup(StorageSystem storage, URI consistencyGroupId, String replicationGroupName, TaskCompleter taskCompleter) throws DeviceControllerException {
_log.info("{} doCreateConsistencyGroup START ...", storage.getSerialNumber());
try {
XtremIOClient client = XtremIOProvUtils.getXtremIOClient(dbClient, storage, xtremioRestClientFactory);
BlockConsistencyGroup consistencyGroup = dbClient.queryObject(BlockConsistencyGroup.class, consistencyGroupId);
boolean isXioV2 = client.isVersion2();
if (!isXioV2 && consistencyGroup.isProtectedCG()) {
_log.info("{} Operation createConsistencyGroup not supported for the xtremio array version");
} else {
String clusterName = client.getClusterDetails(storage.getSerialNumber()).getName();
Project cgProject = dbClient.queryObject(Project.class, consistencyGroup.getProject());
String cgName = replicationGroupName != null ? replicationGroupName : consistencyGroup.getLabel();
client.createConsistencyGroup(cgName, clusterName);
String cgTagName = XtremIOProvUtils.createTagsForConsistencyGroup(client, cgProject.getLabel(), clusterName);
consistencyGroup.addSystemConsistencyGroup(storage.getId().toString(), cgName);
consistencyGroup.addConsistencyGroupTypes(Types.LOCAL.name());
client.tagObject(cgTagName, XTREMIO_ENTITY_TYPE.ConsistencyGroup.name(), cgName, clusterName);
if (!consistencyGroup.isProtectedCG() && NullColumnValueGetter.isNullURI(consistencyGroup.getStorageController())) {
consistencyGroup.setStorageController(storage.getId());
}
}
dbClient.updateObject(consistencyGroup);
taskCompleter.ready(dbClient);
_log.info("{} doCreateConsistencyGroup END ...", storage.getSerialNumber());
} catch (Exception e) {
_log.error(String.format("Create Consistency Group operation failed %s", e));
ServiceError serviceError = DeviceControllerException.errors.jobFailed(e);
taskCompleter.error(dbClient, serviceError);
}
}
use of com.emc.storageos.xtremio.restapi.XtremIOClient in project coprhd-controller by CoprHD.
the class XtremIOStorageDevice method doDeleteSnapshot.
@Override
public void doDeleteSnapshot(StorageSystem storage, URI snapshot, TaskCompleter taskCompleter) throws DeviceControllerException {
_log.info("SnapShot Deletion..... Started");
List<BlockSnapshot> snapshots = dbClient.queryObject(BlockSnapshot.class, Arrays.asList(snapshot));
XtremIOClient client = XtremIOProvUtils.getXtremIOClient(dbClient, storage, xtremioRestClientFactory);
if (client.isVersion2() && ControllerUtils.checkSnapshotsInConsistencyGroup(snapshots, dbClient, taskCompleter)) {
snapshotOperations.deleteGroupSnapshots(storage, snapshot, taskCompleter);
} else {
snapshotOperations.deleteSingleVolumeSnapshot(storage, snapshot, taskCompleter);
}
_log.info("SnapShot Deletion..... End");
}
use of com.emc.storageos.xtremio.restapi.XtremIOClient in project coprhd-controller by CoprHD.
the class XtremIOStorageDevice method doExpandVolume.
@Override
public void doExpandVolume(StorageSystem storage, StoragePool pool, Volume volume, Long sizeInBytes, TaskCompleter taskCompleter) throws DeviceControllerException {
_log.info("Expand Volume..... Started");
try {
XtremIOClient client = XtremIOProvUtils.getXtremIOClient(dbClient, storage, xtremioRestClientFactory);
String clusterName = client.getClusterDetails(storage.getSerialNumber()).getName();
Long sizeInGB = new Long(sizeInBytes / (1024 * 1024 * 1024));
// XtremIO Rest API supports only expansion in GBs.
String capacityInGBStr = String.valueOf(sizeInGB).concat("g");
client.expandVolume(volume.getDeviceLabel(), capacityInGBStr, clusterName);
XtremIOVolume createdVolume = client.getVolumeDetails(volume.getDeviceLabel(), clusterName);
volume.setProvisionedCapacity(Long.parseLong(createdVolume.getAllocatedCapacity()) * 1024);
volume.setAllocatedCapacity(Long.parseLong(createdVolume.getAllocatedCapacity()) * 1024);
volume.setCapacity(Long.parseLong(createdVolume.getAllocatedCapacity()) * 1024);
dbClient.updateObject(volume);
// update StoragePool capacity
try {
XtremIOProvUtils.updateStoragePoolCapacity(client, dbClient, pool);
} catch (Exception e) {
_log.warn("Error while updating pool capacity", e);
}
taskCompleter.ready(dbClient);
_log.info("Expand Volume..... End");
} catch (Exception e) {
_log.error("Error while expanding volumes", e);
ServiceError error = DeviceControllerErrors.xtremio.expandVolumeFailure(e);
taskCompleter.error(dbClient, error);
}
}
Aggregations