Search in sources :

Example 6 with PhysicalNAS

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());
}
Also used : NASServer(com.emc.storageos.db.client.model.NASServer) VirtualNAS(com.emc.storageos.db.client.model.VirtualNAS) PolicyStorageResource(com.emc.storageos.db.client.model.PolicyStorageResource) PhysicalNAS(com.emc.storageos.db.client.model.PhysicalNAS)

Example 7 with PhysicalNAS

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;
}
Also used : URI(java.net.URI) PhysicalNAS(com.emc.storageos.db.client.model.PhysicalNAS)

Example 8 with PhysicalNAS

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());
}
Also used : NASServer(com.emc.storageos.db.client.model.NASServer) VirtualNAS(com.emc.storageos.db.client.model.VirtualNAS) FileReplicaPolicyTargetMap(com.emc.storageos.db.client.model.FileReplicaPolicyTargetMap) FileReplicaPolicyTarget(com.emc.storageos.db.client.model.FileReplicaPolicyTarget) PolicyStorageResource(com.emc.storageos.db.client.model.PolicyStorageResource) PhysicalNAS(com.emc.storageos.db.client.model.PhysicalNAS) FileShare(com.emc.storageos.db.client.model.FileShare) StorageSystem(com.emc.storageos.db.client.model.StorageSystem)

Example 9 with PhysicalNAS

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;
}
Also used : URI(java.net.URI) PhysicalNAS(com.emc.storageos.db.client.model.PhysicalNAS)

Example 10 with PhysicalNAS

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;
}
Also used : NASServer(com.emc.storageos.db.client.model.NASServer) NamedURI(com.emc.storageos.db.client.model.NamedURI) URI(java.net.URI) PhysicalNAS(com.emc.storageos.db.client.model.PhysicalNAS) URIQueryResultList(com.emc.storageos.db.client.constraint.URIQueryResultList)

Aggregations

PhysicalNAS (com.emc.storageos.db.client.model.PhysicalNAS)24 URI (java.net.URI)14 URIQueryResultList (com.emc.storageos.db.client.constraint.URIQueryResultList)9 VirtualNAS (com.emc.storageos.db.client.model.VirtualNAS)9 ArrayList (java.util.ArrayList)6 NASServer (com.emc.storageos.db.client.model.NASServer)5 StringMap (com.emc.storageos.db.client.model.StringMap)5 PolicyStorageResource (com.emc.storageos.db.client.model.PolicyStorageResource)4 StorageSystem (com.emc.storageos.db.client.model.StorageSystem)4 StringSet (com.emc.storageos.db.client.model.StringSet)4 List (java.util.List)4 NasCifsServer (com.emc.storageos.db.client.model.NasCifsServer)3 StorageHADomain (com.emc.storageos.db.client.model.StorageHADomain)3 NamespaceList (com.emc.storageos.plugins.common.domainmodel.NamespaceList)3 HashMap (java.util.HashMap)3 LinkedList (java.util.LinkedList)3 ConcurrentHashMap (java.util.concurrent.ConcurrentHashMap)3 CifsServerMap (com.emc.storageos.db.client.model.CifsServerMap)2 FileReplicaPolicyTarget (com.emc.storageos.db.client.model.FileReplicaPolicyTarget)2 FileReplicaPolicyTargetMap (com.emc.storageos.db.client.model.FileReplicaPolicyTargetMap)2