use of com.emc.storageos.vnxe.models.VNXeCommandResult in project coprhd-controller by CoprHD.
the class SnapRequests method deleteSnap.
/**
* Delete lun snap
*
* @param snapId
* @return
* @throws VNXeException
*/
public VNXeCommandResult deleteSnap(String snapId) throws VNXeException {
_url = URL_INSTANCE + snapId;
setQueryParameters(null);
deleteRequest(null);
VNXeCommandResult result = new VNXeCommandResult();
result.setSuccess(true);
return result;
}
use of com.emc.storageos.vnxe.models.VNXeCommandResult in project coprhd-controller by CoprHD.
the class ApiClientTest method createConsistencyGroup.
// @Test
public void createConsistencyGroup() {
VNXeCommandResult result = apiClient.createConsistencyGroup("testGroup1");
System.out.println(result.getStorageResource().getId());
}
use of com.emc.storageos.vnxe.models.VNXeCommandResult in project coprhd-controller by CoprHD.
the class ApiClientTest method createLunGroup.
// @Test
public void createLunGroup() {
VNXeCommandResult result = apiClient.createLunGroup("testGroup1");
System.out.println(result.getStorageResource().getId());
}
use of com.emc.storageos.vnxe.models.VNXeCommandResult in project coprhd-controller by CoprHD.
the class DeleteStorageResourceRequestTest method deleteFileSystem.
// @Test
public void deleteFileSystem() {
DeleteStorageResourceRequest req = new DeleteStorageResourceRequest(_client);
VNXeCommandResult response = null;
response = req.deleteFileSystemSync("fs_25", true);
System.out.println(response.getSuccess());
}
use of com.emc.storageos.vnxe.models.VNXeCommandResult in project coprhd-controller by CoprHD.
the class VNXeApiClient method prepareHostsForExport.
/**
* given host name and initiators, find/create hosts/initiators in the
*
* @param hostInitiators
* @return
*/
public VNXeBase prepareHostsForExport(Collection<VNXeHostInitiator> hostInitiators) throws VNXeException {
String hostId = null;
Set<VNXeHostInitiator> notExistingInits = new HashSet<VNXeHostInitiator>();
Set<VNXeHostInitiator> existingNoHostInits = new HashSet<VNXeHostInitiator>();
String hostOsType = null;
String hostName = null;
for (VNXeHostInitiator init : hostInitiators) {
VNXeHostInitiator existingInit = getInitiatorByWWN(init.getInitiatorId());
if (existingInit != null && existingInit.getParentHost() != null) {
if (hostId == null) {
hostId = existingInit.getParentHost().getId();
} else if (!hostId.equals(existingInit.getParentHost().getId())) {
_logger.error("Initiators belong to different hosts");
throw VNXeException.exceptions.vnxeCommandFailed("Initiators belong to different hosts");
}
} else if (existingInit != null) {
existingNoHostInits.add(existingInit);
} else {
notExistingInits.add(init);
}
if (hostOsType == null) {
hostOsType = init.getHostOsType();
}
if (hostName == null) {
hostName = init.getName();
}
}
if (hostId == null) {
// create host and hostInitiator
HostListRequest hostReq = new HostListRequest(_khClient);
HostCreateParam hostCreateParm = new HostCreateParam();
hostCreateParm.setName(hostName);
hostCreateParm.setType(HostTypeEnum.HOSTMANUAL.getValue());
if (isUnityClient() && hostOsType != null) {
hostCreateParm.setOsType(hostOsType);
}
VNXeCommandResult result = hostReq.createHost(hostCreateParm);
hostId = result.getId();
}
for (VNXeHostInitiator newInit : notExistingInits) {
HostInitiatorCreateParam initCreateParam = new HostInitiatorCreateParam();
VNXeBase host = new VNXeBase(hostId);
initCreateParam.setHost(host);
if (newInit.getType() == HostInitiatorTypeEnum.INITIATOR_TYPE_ISCSI) {
initCreateParam.setInitiatorType(HostInitiatorTypeEnum.INITIATOR_TYPE_ISCSI.getValue());
initCreateParam.setInitiatorWWNorIqn(newInit.getChapUserName());
initCreateParam.setChapUser(newInit.getChapUserName());
} else {
initCreateParam.setInitiatorType(HostInitiatorTypeEnum.INITIATOR_TYPE_FC.getValue());
initCreateParam.setInitiatorWWNorIqn(newInit.getInitiatorId());
}
HostInitiatorRequest req = new HostInitiatorRequest(_khClient);
try {
req.createHostInitiator(initCreateParam);
} catch (VNXeException e) {
// For ESX hosts, even if we could not get the initiators when we query them, when we try to create the host
// initiator with the created host, it would throw error, saying the initiator exists. ignore the error.
String message = e.getMessage();
if (message != null && message.contains(VNXeConstants.INITIATOR_EXISITNG)) {
_logger.info("The initiator exists. Ignore the error.");
} else {
throw e;
}
}
}
for (VNXeHostInitiator exitInit : existingNoHostInits) {
setInitiatorHost(exitInit.getId(), hostId);
}
return new VNXeBase(hostId);
}
Aggregations