use of com.emc.storageos.db.client.model.NamedURI in project coprhd-controller by CoprHD.
the class VdcControllerTest method addTask.
private void addTask(String requestId, URI vdcId) {
Task task = new Task();
task.setId(URIUtil.createId(Task.class));
task.setRequestId(requestId);
NamedURI resource = new NamedURI(vdcId, "vdc");
task.setResource(resource);
this.dbClient.createObject(task);
}
use of com.emc.storageos.db.client.model.NamedURI in project coprhd-controller by CoprHD.
the class VNXUnityRestoreSnapshotJob method initSnapshot.
/**
* Initiate a BlockSnapshot based on its parent
* @param blockObj The parent of the BlockSnapshot
* @param label The snapshot label
* @param setLabel The set of snapshots label
* @return
*/
private BlockSnapshot initSnapshot(final BlockObject blockObj, final String label, final String setLabel, final URI projectUri) {
BlockSnapshot createdSnap = new BlockSnapshot();
createdSnap.setId(URIUtil.createId(BlockSnapshot.class));
createdSnap.setConsistencyGroup(blockObj.getConsistencyGroup());
createdSnap.setSourceNativeId(blockObj.getNativeId());
createdSnap.setParent(new NamedURI(blockObj.getId(), label));
createdSnap.setLabel(label);
createdSnap.setStorageController(blockObj.getStorageController());
createdSnap.setSystemType(blockObj.getSystemType());
createdSnap.setVirtualArray(blockObj.getVirtualArray());
createdSnap.setProtocol(new StringSet());
createdSnap.getProtocol().addAll(blockObj.getProtocol());
createdSnap.setTechnologyType(TechnologyType.NATIVE.name());
if (blockObj instanceof Volume) {
createdSnap.setProject(new NamedURI(projectUri, label));
} else if (blockObj instanceof BlockSnapshot) {
createdSnap.setProject(new NamedURI(projectUri, label));
}
createdSnap.setSnapsetLabel(ResourceOnlyNameGenerator.removeSpecialCharsForName(setLabel, SmisConstants.MAX_SNAPSHOT_NAME_LENGTH));
return createdSnap;
}
use of com.emc.storageos.db.client.model.NamedURI in project coprhd-controller by CoprHD.
the class RecoverPointBlockSnapshotMigrationTest method prepareSnapData.
/**
* Prepares the data for RP BlockSnapshot migration tests.
*
* @throws Exception When an error occurs preparing the BlockSnapshot migration data.
*/
private void prepareSnapData() throws Exception {
log.info("Preparing BlockSnapshots for RecoverPointBlockSnapshotMigration");
ProtectionSystem ps = new ProtectionSystem();
URI protectionSystemUri = URIUtil.createId(ProtectionSystem.class);
ps.setId(protectionSystemUri);
_dbClient.createObject(ps);
VirtualArray targetVarray = new VirtualArray();
URI targetVarrayUri = URIUtil.createId(VirtualArray.class);
targetVarray.setId(targetVarrayUri);
_dbClient.createObject(targetVarray);
Volume targetVolume = new Volume();
URI targetVolumeUri = URIUtil.createId(Volume.class);
targetVolume.setId(targetVolumeUri);
targetVolume.setLabel("targetVolume");
targetVolume.setDeviceLabel(DEVICE_LABEL);
targetVolume.setVirtualArray(targetVarrayUri);
_dbClient.createObject(targetVolume);
Volume parentVolume = new Volume();
URI volumeUri = URIUtil.createId(Volume.class);
parentVolume.setId(volumeUri);
parentVolume.setLabel("parentVolume");
StringSet rpTargets = new StringSet();
rpTargets.add(targetVolume.getId().toString());
parentVolume.setRpTargets(rpTargets);
_dbClient.createObject(parentVolume);
BlockSnapshot snapshot = new BlockSnapshot();
snapURI = URIUtil.createId(BlockSnapshot.class);
snapshot.setId(snapURI);
snapshot.setProtectionController(protectionSystemUri);
NamedURI parentVolNamedUri = new NamedURI(parentVolume.getId(), parentVolume.getLabel());
snapshot.setParent(parentVolNamedUri);
snapshot.setVirtualArray(targetVarrayUri);
_dbClient.createObject(snapshot);
}
use of com.emc.storageos.db.client.model.NamedURI in project coprhd-controller by CoprHD.
the class RecoverPointConsistencyGroupMigrationTest method createRpVolumes.
/**
* Creates the RP source volume/journal and the specified number of
* target/journal volumes.
*
* @param volumeName
* @param numTargets
*/
private List<Volume> createRpVolumes(String volumeName, int numTargets, ProtectionSet protectionSet) {
List<Volume> volumes = new ArrayList<Volume>();
String rsetName = "RSet-" + volumeName;
Volume sourceVolume = new Volume();
URI sourceVolumeURI = URIUtil.createId(Volume.class);
rpTestVolumeURIs.add(sourceVolumeURI);
volumes.add(sourceVolume);
sourceVolume.setId(sourceVolumeURI);
sourceVolume.setLabel(volumeName);
sourceVolume.setPersonality(Volume.PersonalityTypes.SOURCE.toString());
sourceVolume.setRSetName(rsetName);
sourceVolume.setProtectionSet(new NamedURI(protectionSet.getId(), protectionSet.getLabel()));
_dbClient.createObject(sourceVolume);
Volume sourceVolumeJournal = new Volume();
URI sourceVolumeJournalURI = URIUtil.createId(Volume.class);
rpTestVolumeURIs.add(sourceVolumeJournalURI);
volumes.add(sourceVolumeJournal);
sourceVolumeJournal.setId(sourceVolumeJournalURI);
sourceVolumeJournal.setLabel(volumeName + RP_SRC_JOURNAL_APPEND);
sourceVolumeJournal.setPersonality(Volume.PersonalityTypes.METADATA.toString());
sourceVolumeJournal.setProtectionSet(new NamedURI(protectionSet.getId(), protectionSet.getLabel()));
_dbClient.createObject(sourceVolumeJournal);
for (int i = 1; i <= numTargets; i++) {
Volume sourceVolumeTarget = new Volume();
URI sourceVolumeTargetURI = URIUtil.createId(Volume.class);
rpTestVolumeURIs.add(sourceVolumeTargetURI);
volumes.add(sourceVolumeTarget);
sourceVolumeTarget.setId(sourceVolumeTargetURI);
sourceVolumeTarget.setLabel(volumeName + RP_TGT_APPEND + "vArray" + i);
sourceVolumeTarget.setPersonality(Volume.PersonalityTypes.TARGET.toString());
sourceVolumeTarget.setRSetName(rsetName);
sourceVolumeTarget.setProtectionSet(new NamedURI(protectionSet.getId(), protectionSet.getLabel()));
_dbClient.createObject(sourceVolumeTarget);
Volume sourceVolumeTargetJournal = new Volume();
URI sourceVolumeTargetJournalURI = URIUtil.createId(Volume.class);
rpTestVolumeURIs.add(sourceVolumeTargetJournalURI);
volumes.add(sourceVolumeTargetJournal);
sourceVolumeTargetJournal.setId(sourceVolumeTargetJournalURI);
sourceVolumeTargetJournal.setLabel(volumeName + RP_TGT_JOURNAL_APPEND + "vArray" + i);
sourceVolumeTargetJournal.setPersonality(Volume.PersonalityTypes.METADATA.toString());
sourceVolumeTargetJournal.setProtectionSet(new NamedURI(protectionSet.getId(), protectionSet.getLabel()));
_dbClient.createObject(sourceVolumeTargetJournal);
}
return volumes;
}
use of com.emc.storageos.db.client.model.NamedURI in project coprhd-controller by CoprHD.
the class VolumeBootVolumeMigrationTest method prepareVolumeData.
/**
* Prepares the data for RP volume tests.
*
* @throws Exception When an error occurs preparing the RP volume data.
*/
private void prepareVolumeData() throws Exception {
log.info("Preparing Volumes for VolumeAccessStateLinkStatusMigration");
TenantOrg tenantOrg = new TenantOrg();
URI tenantOrgURI = URIUtil.createId(TenantOrg.class);
tenantOrg.setId(tenantOrgURI);
_dbClient.createObject(tenantOrg);
Project proj = new Project();
URI projectURI = URIUtil.createId(Project.class);
String projectLabel = "project";
proj.setId(projectURI);
proj.setLabel(projectLabel);
proj.setTenantOrg(new NamedURI(tenantOrgURI, projectLabel));
_dbClient.createObject(proj);
// Create a boot volume for a host with no tags
Volume vol1 = new Volume();
URI vol1URI = URIUtil.createId(Volume.class);
vol1.setId(vol1URI);
vol1.setLabel("VOL1-ABOOTVOLUME");
vol1.setTenant(new NamedURI(tenantOrgURI, "provider"));
_dbClient.createObject(vol1);
// Create a host object with a boot volume
Host host1 = new Host();
URI host1URI = URIUtil.createId(Host.class);
host1.setId(host1URI);
host1.setHostName("Host1WithBootVol");
host1.setBootVolumeId(vol1URI);
volumeToHostIds.put(vol1URI, host1URI);
_dbClient.createObject(host1);
// Create a boot volume for a host with existing tags
Volume vol2 = new Volume();
URI vol2URI = URIUtil.createId(Volume.class);
vol2.setId(vol2URI);
vol2.setLabel("VOL2-ABOOTVOLUME");
vol2.setTenant(new NamedURI(tenantOrgURI, "provider"));
ScopedLabel label = new ScopedLabel();
label.setScope(tenantOrg.getId().toASCIIString());
label.setLabel("vipr:someothertag=" + vol2URI.toASCIIString());
ScopedLabelSet labelSet = new ScopedLabelSet();
labelSet.add(label);
vol2.setTag(labelSet);
_dbClient.createObject(vol2);
// Create a host object with a boot volume
Host host2 = new Host();
URI host2URI = URIUtil.createId(Host.class);
host2.setId(host2URI);
host2.setHostName("Host2WithBootVol");
host2.setBootVolumeId(vol2URI);
volumeToHostIds.put(vol2URI, host2URI);
_dbClient.createObject(host2);
// Create a volume with no host association
Volume vol3 = new Volume();
URI vol3URI = URIUtil.createId(Volume.class);
vol3.setId(vol3URI);
vol3.setLabel("VOL3-NOTABOOTVOLUME");
vol3.setTenant(new NamedURI(tenantOrgURI, "provider"));
volumeToHostIds.put(vol3URI, null);
_dbClient.createObject(vol3);
}
Aggregations