use of com.emc.storageos.vnxe.models.VNXeCommandResult in project coprhd-controller by CoprHD.
the class VNXeStorageDevice method doCreateConsistencyGroup.
@Override
public void doCreateConsistencyGroup(StorageSystem storage, URI consistencyGroup, String replicationGroupName, TaskCompleter taskCompleter) throws DeviceControllerException {
_logger.info("creating consistency group, array: {}", storage.getSerialNumber());
BlockConsistencyGroup consistencyGroupObj = _dbClient.queryObject(BlockConsistencyGroup.class, consistencyGroup);
VNXeApiClient apiClient = getVnxeClient(storage);
String tenantName = "";
try {
TenantOrg tenant = _dbClient.queryObject(TenantOrg.class, consistencyGroupObj.getTenant().getURI());
tenantName = tenant.getLabel();
} catch (DatabaseException e) {
_logger.error("Error lookup TenantOrb object", e);
}
String label = nameGenerator.generate(tenantName, consistencyGroupObj.getLabel(), consistencyGroupObj.getId().toString(), '-', VNXeConstants.MAX_NAME_LENGTH);
try {
VNXeCommandResult result = apiClient.createLunGroup(label);
if (result.getStorageResource() != null) {
consistencyGroupObj.addSystemConsistencyGroup(storage.getId().toString(), result.getStorageResource().getId());
consistencyGroupObj.addConsistencyGroupTypes(Types.LOCAL.name());
if (NullColumnValueGetter.isNullURI(consistencyGroupObj.getStorageController())) {
consistencyGroupObj.setStorageController(storage.getId());
}
_dbClient.persistObject(consistencyGroupObj);
taskCompleter.ready(_dbClient);
} else {
_logger.error("No storage resource Id returned");
consistencyGroupObj.setInactive(true);
_dbClient.persistObject(consistencyGroupObj);
ServiceError error = DeviceControllerErrors.vnxe.jobFailed("CreateConsistencyGroup failed");
taskCompleter.error(_dbClient, error);
}
} catch (Exception e) {
_logger.error("Exception caught when createing consistency group ", e);
consistencyGroupObj.setInactive(true);
_dbClient.persistObject(consistencyGroupObj);
ServiceError error = DeviceControllerErrors.vnxe.jobFailed("CreateConsistencyGroup", e.getMessage());
taskCompleter.error(_dbClient, error);
}
}
use of com.emc.storageos.vnxe.models.VNXeCommandResult in project coprhd-controller by CoprHD.
the class HostIpPortRequestsTest method createHostIpPortTest.
@Test
public void createHostIpPortTest() {
HostIpPortRequests req = new HostIpPortRequests(_client);
HostIpPortCreateParam parm = new HostIpPortCreateParam();
parm.setAddress("10.247.87.208");
VNXeBase host = new VNXeBase();
host.setId("Host_1");
parm.setHost(host);
VNXeCommandResult result = req.createHostIpPort(parm);
String id = result.getId();
System.out.println(id);
}
use of com.emc.storageos.vnxe.models.VNXeCommandResult in project coprhd-controller by CoprHD.
the class VNXeApiClient method deleteInitiators.
/**
* Delete initiators by moving initiators to a dummy host, then delete the dummy host
*
* This should be used if there is mapped resource on the host that the initiators are registered to.
* It can also be used in case of no mapped resource.
*
* @param initiatorIds initiator Ids (IQN or WWN)
* @return VNXeCommandResult
*/
public VNXeCommandResult deleteInitiators(List<String> initiatorIds) throws VNXeException {
_logger.info("deleting initiators: " + Joiner.on(',').join(initiatorIds));
// create a dummy host
HostListRequest hostListReq = new HostListRequest(_khClient);
HostCreateParam hostCreateParm = new HostCreateParam();
hostCreateParm.setName(VIPR_TMP_HOST_PREFIX + initiatorIds.get(0));
hostCreateParm.setType(HostTypeEnum.HOSTMANUAL.getValue());
VNXeCommandResult result = hostListReq.createHost(hostCreateParm);
String dummyHostId = result.getId();
// get initiators
for (String initiatorId : initiatorIds) {
VNXeHostInitiator initiator = getInitiatorByWWN(initiatorId);
if (initiator == null) {
_logger.info("Could not find initiator: {}", initiatorId);
} else {
// move the initiator to the dummy host
setInitiatorHost(initiator.getId(), dummyHostId);
}
}
// delete the dummy host
return deleteHost(dummyHostId);
}
use of com.emc.storageos.vnxe.models.VNXeCommandResult in project coprhd-controller by CoprHD.
the class CifsShareRequests method deleteShareForSnapshotSync.
/**
* Delete CIFS share sync
*
* @param shareId
* cifsShare id
* @return VNXeCommandResult
*/
public VNXeCommandResult deleteShareForSnapshotSync(String shareId) {
VNXeCommandResult result = new VNXeCommandResult();
_url = URL_SHARE + shareId;
if (getShare(shareId) != null) {
unsetQueryParameters();
deleteRequest(null);
result.setSuccess(true);
return result;
} else {
throw VNXeException.exceptions.vnxeCommandFailed("The shareId is not found: " + shareId);
}
}
use of com.emc.storageos.vnxe.models.VNXeCommandResult in project coprhd-controller by CoprHD.
the class FileSystemSnapRequests method deleteFileSystemSnapSync.
public VNXeCommandResult deleteFileSystemSnapSync(String snapId, String softwareVersion) throws VNXeException {
if (!VNXeUtils.isHigherVersion(softwareVersion, VNXeConstants.VNXE_BASE_SOFT_VER)) {
_url = URL_INSTANCE + snapId;
} else {
_url = URL_INSTANCE_V31 + snapId;
}
VNXeCommandResult result = new VNXeCommandResult();
setQueryParameters(null);
if (getDataForOneObject(VNXeFileSystemSnap.class) != null) {
unsetQueryParameters();
deleteRequest(null);
result.setSuccess(true);
return result;
} else {
throw VNXeException.exceptions.vnxeCommandFailed(String.format("No filesystem snap %s found", snapId));
}
}
Aggregations