use of com.emc.storageos.db.client.model.PhysicalNAS in project coprhd-controller by CoprHD.
the class FileSnapshotPolicyMigration method updatePolicyStorageResouce.
private void updatePolicyStorageResouce(StorageSystem system, FilePolicy fileSnapshotPolicy, FileShare fs) {
logger.info("Creating policy storage resource for storage {} fs {} and policy {} ", system.getLabel(), fs.getLabel(), fileSnapshotPolicy.getFilePolicyName());
PolicyStorageResource policyStorageResource = new PolicyStorageResource();
policyStorageResource.setId(URIUtil.createId(PolicyStorageResource.class));
policyStorageResource.setFilePolicyId(fileSnapshotPolicy.getId());
policyStorageResource.setStorageSystem(system.getId());
policyStorageResource.setPolicyNativeId(fileSnapshotPolicy.getFilePolicyName() + "_" + fs.getName());
policyStorageResource.setAppliedAt(fs.getId());
policyStorageResource.setResourcePath(fs.getNativeId());
NASServer nasServer = null;
if (fs.getVirtualNAS() != null) {
nasServer = dbClient.queryObject(VirtualNAS.class, fs.getVirtualNAS());
} else {
// Get the physical NAS for the storage system!!
PhysicalNAS pNAS = getSystemPhysicalNAS(system);
if (pNAS != null) {
nasServer = pNAS;
}
}
if (nasServer != null) {
logger.info("Found NAS server {} ", nasServer.getNasName());
policyStorageResource.setNasServer(nasServer.getId());
policyStorageResource.setNativeGuid(generateNativeGuidForFilePolicyResource(system, nasServer.getNasName(), fileSnapshotPolicy.getFilePolicyType(), fs.getNativeId()));
}
dbClient.createObject(policyStorageResource);
fileSnapshotPolicy.addPolicyStorageResources(policyStorageResource.getId());
fileSnapshotPolicy.addAssignedResources(fs.getId());
logger.info("PolicyStorageResource object created successfully for {} ", system.getLabel() + policyStorageResource.getAppliedAt());
}
use of com.emc.storageos.db.client.model.PhysicalNAS in project coprhd-controller by CoprHD.
the class FileSnapshotPolicyMigration method getSystemPhysicalNAS.
private PhysicalNAS getSystemPhysicalNAS(StorageSystem system) {
List<URI> nasServers = dbClient.queryByType(PhysicalNAS.class, true);
List<PhysicalNAS> phyNasServers = dbClient.queryObject(PhysicalNAS.class, nasServers);
for (PhysicalNAS nasServer : phyNasServers) {
if (nasServer.getStorageDeviceURI().toString().equalsIgnoreCase(system.getId().toString())) {
return nasServer;
}
}
return null;
}
use of com.emc.storageos.db.client.model.PhysicalNAS in project coprhd-controller by CoprHD.
the class VirtualPoolFileReplicationPolicyMigration method updatePolicyStorageResouce.
private void updatePolicyStorageResouce(StorageSystem system, FilePolicy filePolicy, FileShare fs) {
logger.info("Creating policy storage resource for storage {} fs {} and policy {} ", system.getLabel(), fs.getLabel(), filePolicy.getFilePolicyName());
PolicyStorageResource policyStorageResource = new PolicyStorageResource();
policyStorageResource.setId(URIUtil.createId(PolicyStorageResource.class));
policyStorageResource.setFilePolicyId(filePolicy.getId());
policyStorageResource.setStorageSystem(system.getId());
policyStorageResource.setPolicyNativeId(fs.getName());
policyStorageResource.setAppliedAt(fs.getId());
policyStorageResource.setResourcePath(fs.getNativeId());
NASServer nasServer = null;
if (fs.getVirtualNAS() != null) {
nasServer = dbClient.queryObject(VirtualNAS.class, fs.getVirtualNAS());
} else {
// Get the physical NAS for the storage system!!
PhysicalNAS pNAS = getSystemPhysicalNAS(system);
if (pNAS != null) {
nasServer = pNAS;
}
}
if (nasServer != null) {
logger.info("Found NAS server {} ", nasServer.getNasName());
policyStorageResource.setNasServer(nasServer.getId());
policyStorageResource.setNativeGuid(generateNativeGuidForFilePolicyResource(system, nasServer.getNasName(), filePolicy.getFilePolicyType(), fs.getNativeId()));
}
if (fs.getMirrorfsTargets() != null && !fs.getMirrorfsTargets().isEmpty()) {
String[] targetFSs = fs.getMirrorfsTargets().toArray(new String[fs.getMirrorfsTargets().size()]);
// Today we support single target!!
FileShare fsTarget = dbClient.queryObject(FileShare.class, URI.create(targetFSs[0]));
// In older release, policy name was set to target file system lable!!
policyStorageResource.setPolicyNativeId(fsTarget.getLabel());
// Update the target resource details!!!
FileReplicaPolicyTargetMap fileReplicaPolicyTargetMap = new FileReplicaPolicyTargetMap();
FileReplicaPolicyTarget target = new FileReplicaPolicyTarget();
target.setAppliedAt(filePolicy.getApplyAt());
target.setStorageSystem(fsTarget.getStorageDevice().toString());
target.setPath(fsTarget.getNativeId());
NASServer targetNasServer = null;
if (fsTarget.getVirtualNAS() != null) {
targetNasServer = dbClient.queryObject(VirtualNAS.class, fsTarget.getVirtualNAS());
} else {
StorageSystem targetSystem = dbClient.queryObject(StorageSystem.class, fsTarget.getStorageDevice());
// Get the physical NAS for the storage system!!
PhysicalNAS pNAS = getSystemPhysicalNAS(targetSystem);
if (pNAS != null) {
targetNasServer = pNAS;
}
}
if (targetNasServer != null) {
target.setNasServer(targetNasServer.getId().toString());
}
String key = target.getFileTargetReplicaKey();
fileReplicaPolicyTargetMap.put(key, target);
policyStorageResource.setFileReplicaPolicyTargetMap(fileReplicaPolicyTargetMap);
}
dbClient.createObject(policyStorageResource);
filePolicy.addPolicyStorageResources(policyStorageResource.getId());
filePolicy.addAssignedResources(fs.getId());
logger.info("PolicyStorageResource object created successfully for {} ", system.getLabel() + policyStorageResource.getAppliedAt());
}
use of com.emc.storageos.db.client.model.PhysicalNAS in project coprhd-controller by CoprHD.
the class VirtualPoolFileReplicationPolicyMigration method getSystemPhysicalNAS.
private PhysicalNAS getSystemPhysicalNAS(StorageSystem system) {
List<URI> nasServers = dbClient.queryByType(PhysicalNAS.class, true);
List<PhysicalNAS> phyNasServers = dbClient.queryObject(PhysicalNAS.class, nasServers);
for (PhysicalNAS nasServer : phyNasServers) {
if (nasServer.getStorageDeviceURI().toString().equalsIgnoreCase(system.getId().toString())) {
return nasServer;
}
}
return null;
}
use of com.emc.storageos.db.client.model.PhysicalNAS in project coprhd-controller by CoprHD.
the class IsilonFileStorageDevice method getNasServerForFileSystem.
/**
* To get NasServer form for the file system
*
* @param args
* @param storage
* @return NASServer if found or null value
*/
private NASServer getNasServerForFileSystem(FileDeviceInputOutput args, StorageSystem storage) {
NASServer nas = null;
// Check VirtualNAS is associated with file system or not.
if (args.getvNAS() != null) {
nas = args.getvNAS();
} else {
// mean it file is created on system access zone.
// We do not have direct reference of physical nas servers from StorageSystem or fsobj
URIQueryResultList pNasURIs = new URIQueryResultList();
_dbClient.queryByConstraint(ContainmentConstraint.Factory.getStorageDevicePhysicalNASConstraint(storage.getId()), pNasURIs);
if (pNasURIs.iterator().hasNext()) {
// storage system should have only one PhysicalNAS instance.
URI pNasURI = pNasURIs.iterator().next();
nas = _dbClient.queryObject(PhysicalNAS.class, pNasURI);
}
}
return nas;
}
Aggregations