use of com.emc.storageos.vnxe.models.VNXeCommandJob in project coprhd-controller by CoprHD.
the class ApiClientTest method deleteLunsFromLunGroup.
// @Test
public void deleteLunsFromLunGroup() {
List<String> luns = new ArrayList<String>();
luns.add("sv_46");
VNXeCommandJob result = apiClient.deleteLunsFromLunGroup("res_20", luns);
System.out.println(result.getId());
}
use of com.emc.storageos.vnxe.models.VNXeCommandJob in project coprhd-controller by CoprHD.
the class FileSystemActionRequestTest method createFileSystem.
@Test
public void createFileSystem() {
CreateFileSystemParam parm = new CreateFileSystemParam();
parm.setName("test-file-03");
FileSystemParam fsParm = new FileSystemParam();
fsParm.setIsThinEnabled(true);
VNXeBase nasServer = new VNXeBase();
nasServer.setId("nas_1");
fsParm.setNasServer(nasServer);
VNXeBase pool = new VNXeBase();
pool.setId("pool_1");
fsParm.setPool(pool);
fsParm.setSize(2200000000L);
fsParm.setSupportedProtocols(0);
fsParm.setIsCacheDisabled(true);
fsParm.setSupportedProtocols(VNXeFSSupportedProtocolEnum.NFS_CIFS.getValue());
parm.setFsParameters(fsParm);
FileSystemActionRequest req = new FileSystemActionRequest(_client);
VNXeCommandJob response = null;
try {
response = req.createFileSystemAsync(parm);
} catch (VNXeException e) {
// TODO Auto-generated catch block
logger.error("VNXeException occured", e);
}
System.out.println(response.getId() + "state: " + response.getState());
}
use of com.emc.storageos.vnxe.models.VNXeCommandJob in project coprhd-controller by CoprHD.
the class FileSystemActionRequestTest method expandFileSystem.
// @Test
public void expandFileSystem() {
String resourceId = "res_4";
long newSize = 2000000000L;
ModifyFileSystemParam modifyFSParm = new ModifyFileSystemParam();
// set fileSystemParam
FileSystemParam fsParm = new FileSystemParam();
fsParm.setSize(newSize);
modifyFSParm.setFsParameters(fsParm);
FileSystemActionRequest req = new FileSystemActionRequest(_client);
VNXeCommandJob job = req.modifyFileSystemAsync(modifyFSParm, resourceId);
System.out.println(job.getId());
}
use of com.emc.storageos.vnxe.models.VNXeCommandJob in project coprhd-controller by CoprHD.
the class FileSystemActionRequestTest method removeNfsShare.
// @Test
public void removeNfsShare() {
ModifyFileSystemParam parm = new ModifyFileSystemParam();
NfsShareDeleteParam nfsShareParm = new NfsShareDeleteParam();
VNXeBase nfs = new VNXeBase();
nfs.setId("NFSShare_1");
nfsShareParm.setNfsShare(nfs);
List<NfsShareDeleteParam> shares = new ArrayList<NfsShareDeleteParam>();
shares.add(nfsShareParm);
parm.setNfsShareDelete(shares);
FileSystemActionRequest req = new FileSystemActionRequest(_client);
VNXeCommandJob job = req.modifyFileSystemAsync(parm, "res_4");
System.out.println(job.getId());
}
use of com.emc.storageos.vnxe.models.VNXeCommandJob in project coprhd-controller by CoprHD.
the class VNXUnityRestoreSnapshotJob method updateStatus.
public void updateStatus(JobContext jobContext) throws Exception {
DbClient dbClient = jobContext.getDbClient();
try {
if (_status == JobStatus.IN_PROGRESS) {
return;
}
String opId = getTaskCompleter().getOpId();
_logger.info(String.format("Updating status of job %s to %s", opId, _status.name()));
URI snapId = getTaskCompleter().getId();
BlockSnapshot snapshotObj = dbClient.queryObject(BlockSnapshot.class, snapId);
URI projectUri = snapshotObj.getProject().getURI();
StorageSystem storage = dbClient.queryObject(StorageSystem.class, getStorageSystemUri());
if (_status == JobStatus.SUCCESS && snapshotObj != null) {
VNXeApiClient vnxeApiClient = getVNXeClient(jobContext);
VNXeCommandJob vnxeJob = vnxeApiClient.getJob(getJobIds().get(0));
ParametersOut output = vnxeJob.getParametersOut();
// get the id of the backup snapshot created before restore operation
String backUpSnapId = output.getBackup().getId();
Snap backupSnap = vnxeApiClient.getSnapshot(backUpSnapId);
if (NullColumnValueGetter.isNotNullValue(snapshotObj.getReplicationGroupInstance())) {
List<BlockSnapshot> snapshots = ControllerUtils.getSnapshotsPartOfReplicationGroup(snapshotObj, dbClient);
// Create a snapshot corresponding to the backup snap for each volume in the consistency group
final List<BlockSnapshot> snapshotList = new ArrayList<BlockSnapshot>();
Map<String, BlockSnapshot> volumeToSnapMap = new HashMap<String, BlockSnapshot>();
int count = 1;
String setLabel = backupSnap.getName();
for (BlockSnapshot snapshot : snapshots) {
BlockObject parent = BlockObject.fetch(dbClient, snapshot.getParent().getURI());
String label = String.format("%s-%s", setLabel, count++);
final BlockSnapshot newSnap = initSnapshot(parent, label, setLabel, projectUri);
newSnap.setOpStatus(new OpStatusMap());
snapshotList.add(newSnap);
volumeToSnapMap.put(parent.getNativeId(), newSnap);
}
List<Snap> snaps = vnxeApiClient.getSnapshotsBySnapGroup(backUpSnapId);
for (Snap snap : snaps) {
String lunId = snap.getLun().getId();
BlockSnapshot snapshot = volumeToSnapMap.get(lunId);
snapshot.setReplicationGroupInstance(backUpSnapId);
createSnapshot(snapshot, snap, storage, dbClient);
}
} else {
Volume vol = dbClient.queryObject(Volume.class, snapshotObj.getParent());
final BlockSnapshot newSnap = initSnapshot(vol, backupSnap.getName(), backupSnap.getName(), projectUri);
createSnapshot(newSnap, backupSnap, storage, dbClient);
}
getTaskCompleter().ready(dbClient);
} else if (_status == JobStatus.FAILED && snapshotObj != null) {
_logger.info(String.format("Task %s failed to restore volume snapshot: %s", opId, snapshotObj.getLabel()));
}
} catch (Exception e) {
_logger.error("Caught an exception while trying to updateStatus for VNXeBlockRestoreSnapshotJob", e);
setErrorStatus("Encountered an internal error during snapshot restore job status processing : " + e.getMessage());
} finally {
super.updateStatus(jobContext);
}
}
Aggregations