Search in sources :

Example 31 with VirtualArrayRestRep

use of com.emc.storageos.model.varray.VirtualArrayRestRep in project coprhd-controller by CoprHD.

the class FailoverBlockVolumeService method precheck.

@Override
public void precheck() {
    String sourceId = "";
    String targetId = "";
    String targetName = "";
    String sourceName = "";
    if (ConsistencyUtils.isVolumeStorageType(storageType)) {
        // The type selected is volume
        BlockObjectRestRep targetVolume = BlockStorageUtils.getVolume(protectionTarget);
        BlockObjectRestRep sourceVolume = BlockStorageUtils.getVolume(protectionSource);
        type = BlockStorageUtils.getFailoverType(targetVolume);
        targetId = stringId(targetVolume);
        targetName = targetVolume.getName();
        sourceId = stringId(sourceVolume);
        sourceName = sourceVolume.getName();
    } else {
        // The type selected is consistency group
        BlockConsistencyGroupRestRep cg = BlockStorageUtils.getBlockConsistencyGroup(protectionSource);
        VirtualArrayRestRep virtualArray = BlockStorageUtils.getVirtualArray(protectionTarget);
        type = ConsistencyUtils.getFailoverType(cg);
        targetId = stringId(virtualArray);
        targetName = virtualArray.getName();
        sourceId = stringId(cg);
        sourceName = cg.getName();
    }
    if (type == null) {
        ExecutionUtils.fail("failTask.FailoverBlockVolumeService", args(sourceId, targetId), args());
    }
    if (type.equals(RECOVER_POINT) && BlockProvider.PIT_IMAGE_OPTION_KEY.equals(imageToAccess) && pointInTime == null) {
        ExecutionUtils.fail("failTask.FailoverBlockVolumeService.pit", new Object[] {}, new Object[] {});
    }
    // TODO: Add new fields
    logInfo("fail.over.block.volume.service", type.toUpperCase(), sourceName, targetName);
}
Also used : BlockConsistencyGroupRestRep(com.emc.storageos.model.block.BlockConsistencyGroupRestRep) VirtualArrayRestRep(com.emc.storageos.model.varray.VirtualArrayRestRep) BlockObjectRestRep(com.emc.storageos.model.block.BlockObjectRestRep)

Example 32 with VirtualArrayRestRep

use of com.emc.storageos.model.varray.VirtualArrayRestRep in project coprhd-controller by CoprHD.

the class FileVirtualPools method listReplicationVirtualArraysJson.

public static void listReplicationVirtualArraysJson(FileVirtualPoolForm vpool) {
    if (vpool == null) {
        renderJSON(Collections.emptyList());
    }
    vpool.deserialize();
    List<StringOption> actualOptions = Lists.newArrayList();
    List<VirtualArrayRestRep> virtualArrays = VirtualArrayUtils.getVirtualArrays();
    for (StringOption option : dataObjectOptions(virtualArrays)) {
        actualOptions.add(option);
    }
    renderJSON(actualOptions);
}
Also used : StringOption(util.StringOption) VirtualArrayRestRep(com.emc.storageos.model.varray.VirtualArrayRestRep)

Example 33 with VirtualArrayRestRep

use of com.emc.storageos.model.varray.VirtualArrayRestRep in project coprhd-controller by CoprHD.

the class BlockVirtualPools method createAllFlashAuto.

/**
 * This method create virtual pool according to storage system types
 * @param types : List of storage system types discovered
 */
public static void createAllFlashAuto(List<String> types) {
    List<String> vaIds4allflash = new ArrayList<String>();
    List<String> vaIds4vmax = new ArrayList<String>();
    List<String> vaIds4xio = new ArrayList<String>();
    List<String> vaIds4unity = new ArrayList<String>();
    JsonArray vpools = new JsonArray();
    // Read cookies for storage systems and virtual pools
    JsonObject dataObject = getCookieAsJson(GUIDE_DATA);
    if (dataObject != null) {
        JsonArray varrays = dataObject.getAsJsonArray(VARRAYS);
        if (varrays != null) {
            for (Object varray : varrays) {
                JsonObject jsonvarray = (JsonObject) varray;
                String varrayid = jsonvarray.get("id").getAsString();
                // Check virtual array first
                VirtualArrayRestRep varrayRest = VirtualArrayUtils.getVirtualArray(varrayid);
                if (varrayRest != null) {
                    // Get virtual array attributes
                    Map<String, Set<String>> attributes = VirtualArrayUtils.getAvailableAttributes(uris(varrayid));
                    Set<String> system_type = attributes.get(ATTRIBUTE_SYSTEM_TYPES);
                    if (system_type != null && !system_type.isEmpty()) {
                        if (system_type.size() > 1) {
                            vaIds4allflash.add(varrayid);
                        } else {
                            // It has one system type
                            for (String vasystemtype : system_type) {
                                if (StringUtils.equals(UNITY, vasystemtype)) {
                                    vaIds4unity.add(varrayid);
                                }
                                if (StringUtils.equals(VMAX, vasystemtype)) {
                                    vaIds4vmax.add(varrayid);
                                }
                                if (StringUtils.equals(XTREMIO, vasystemtype)) {
                                    vaIds4xio.add(varrayid);
                                }
                            }
                        }
                    } else {
                        // Control should not reach here but let add in all flash
                        vaIds4allflash.add(varrayid);
                    }
                }
            }
        }
    }
    if (!vaIds4allflash.isEmpty()) {
        Map<String, String> virtualpoolAllFlashMap = allFlashVirtualPool();
        String vpid = virtualpoolAllFlashMap.get(VP_ALL_FLASH);
        if (vpid != null) {
            BlockVirtualPoolRestRep blockvpool = VirtualPoolUtils.getBlockVirtualPool(vpid);
            List<RelatedResourceRep> virtualarrays = blockvpool.getVirtualArrays();
            for (String vaid : vaIds4allflash) {
                RelatedResourceRep newVaId = new RelatedResourceRep();
                newVaId.setId(URI.create(vaid));
                virtualarrays.add(newVaId);
            }
            blockvpool.setVirtualArrays(virtualarrays);
            updateAutoVirtualPool(vpid, blockvpool, vpools);
        } else {
            createBaseVPool(VP_ALL_FLASH, StorageSystemTypes.NONE, vaIds4allflash, Messages.get("gettingStarted.vpool.allflash.desc"), vpools);
        }
    }
    if (!vaIds4vmax.isEmpty()) {
        Map<String, String> virtualpoolAllFlashMap = allFlashVirtualPool();
        // Check if we should add in existing compressed vpool
        boolean isCompression = isCompressionEnable(vaIds4vmax);
        String vpid = virtualpoolAllFlashMap.get(VP_VMAX_DIAMOND);
        if (vpid != null && !isCompression) {
            BlockVirtualPoolRestRep blockvpool = VirtualPoolUtils.getBlockVirtualPool(vpid);
            List<RelatedResourceRep> virtualarrays = blockvpool.getVirtualArrays();
            for (String vaid : vaIds4vmax) {
                RelatedResourceRep newVaId = new RelatedResourceRep();
                newVaId.setId(URI.create(vaid));
                virtualarrays.add(newVaId);
            }
            blockvpool.setVirtualArrays(virtualarrays);
            updateAutoVirtualPool(vpid, blockvpool, vpools);
        } else {
            // Check compressed vpool
            vpid = virtualpoolAllFlashMap.get(VP_VMAX_DIAMOND_COMPRESSED);
            if (vpid != null && isCompression) {
                BlockVirtualPoolRestRep blockvpool = VirtualPoolUtils.getBlockVirtualPool(vpid);
                List<RelatedResourceRep> virtualarrays = blockvpool.getVirtualArrays();
                for (String vaid : vaIds4vmax) {
                    RelatedResourceRep newVaId = new RelatedResourceRep();
                    newVaId.setId(URI.create(vaid));
                    virtualarrays.add(newVaId);
                }
                blockvpool.setVirtualArrays(virtualarrays);
                updateAutoVirtualPool(vpid, blockvpool, vpools);
            } else {
                createBaseVPool(VP_VMAX_DIAMOND, StorageSystemTypes.VMAX, vaIds4vmax, Messages.get("gettingStarted.vpool.vmax.desc"), vpools);
            }
        }
    }
    if (!vaIds4xio.isEmpty()) {
        Map<String, String> virtualpoolAllFlashMap = allFlashVirtualPool();
        String vpid = virtualpoolAllFlashMap.get(VP_XIO_DIAMOND);
        if (vpid != null) {
            BlockVirtualPoolRestRep blockvpool = VirtualPoolUtils.getBlockVirtualPool(vpid);
            List<RelatedResourceRep> virtualarrays = blockvpool.getVirtualArrays();
            for (String vaid : vaIds4xio) {
                RelatedResourceRep newVaId = new RelatedResourceRep();
                newVaId.setId(URI.create(vaid));
                virtualarrays.add(newVaId);
            }
            blockvpool.setVirtualArrays(virtualarrays);
            updateAutoVirtualPool(vpid, blockvpool, vpools);
        } else {
            createBaseVPool(VP_XIO_DIAMOND, StorageSystemTypes.XTREMIO, vaIds4xio, Messages.get("gettingStarted.vpool.xio.desc"), vpools);
        }
    }
    if (!vaIds4unity.isEmpty()) {
        Map<String, String> virtualpoolAllFlashMap = allFlashVirtualPool();
        String vpid = virtualpoolAllFlashMap.get(VP_UNITY_DIAMOND);
        if (vpid != null) {
            BlockVirtualPoolRestRep blockvpool = VirtualPoolUtils.getBlockVirtualPool(vpid);
            List<RelatedResourceRep> virtualarrays = blockvpool.getVirtualArrays();
            for (String vaid : vaIds4unity) {
                RelatedResourceRep newVaId = new RelatedResourceRep();
                newVaId.setId(URI.create(vaid));
                virtualarrays.add(newVaId);
            }
            blockvpool.setVirtualArrays(virtualarrays);
            updateAutoVirtualPool(vpid, blockvpool, vpools);
        } else {
            createBaseVPool(VP_UNITY_DIAMOND, StorageSystemTypes.UNITY, vaIds4unity, Messages.get("gettingStarted.vpool.unity.desc"), vpools);
        }
    }
    dataObject.add(VPOOL_COOKIES, vpools);
    saveJsonAsCookie(GUIDE_DATA, dataObject);
    list();
}
Also used : Set(java.util.Set) HashSet(java.util.HashSet) RelatedResourceRep(com.emc.storageos.model.RelatedResourceRep) ArrayList(java.util.ArrayList) JsonObject(com.google.gson.JsonObject) JsonArray(com.google.gson.JsonArray) VirtualArrayRestRep(com.emc.storageos.model.varray.VirtualArrayRestRep) JsonObject(com.google.gson.JsonObject) BlockVirtualPoolRestRep(com.emc.storageos.model.vpool.BlockVirtualPoolRestRep)

Example 34 with VirtualArrayRestRep

use of com.emc.storageos.model.varray.VirtualArrayRestRep in project coprhd-controller by CoprHD.

the class VirtualArrays method createVirtualArray.

private static void createVirtualArray(StorageSystemRestRep storageSystem) {
    // Check for existing virtual array
    String vArrayName = VARRAY_PREFIX + storageSystem.getName();
    List<VirtualArrayRestRep> availVarrays = VirtualArrayUtils.getVirtualArrays();
    for (VirtualArrayRestRep availVarray : availVarrays) {
        if (StringUtils.equals(availVarray.getName(), vArrayName)) {
            Calendar localCalendar = Calendar.getInstance();
            // Made time in seconds for name length
            long currTime = localCalendar.getTimeInMillis() / 1000;
            vArrayName = vArrayName + VARRAY_POSTFIX + currTime;
            break;
        }
    }
    VirtualArrayForm virtualArray = new VirtualArrayForm();
    virtualArray.name = vArrayName;
    VirtualArrayRestRep varray = virtualArray.save();
    virtualArray.load(varray);
    addVarrayStorageSystem(virtualArray.id, storageSystem.getId().toString());
    updateVarrayCookie(virtualArray.id, virtualArray.name);
}
Also used : VirtualArrayRestRep(com.emc.storageos.model.varray.VirtualArrayRestRep) Calendar(java.util.Calendar)

Example 35 with VirtualArrayRestRep

use of com.emc.storageos.model.varray.VirtualArrayRestRep in project coprhd-controller by CoprHD.

the class VirtualArrays method storagePorts.

/**
 * Displays the storage ports page for the given virtual array.
 *
 * @param id
 *            the virtual array ID.
 */
public static void storagePorts(String id) {
    VirtualArrayRestRep virtualArray = getVirtualArray(id);
    VirtualArrayStoragePortsDataTable dataTable = new VirtualArrayStoragePortsDataTable();
    render(virtualArray, dataTable);
}
Also used : VirtualArrayRestRep(com.emc.storageos.model.varray.VirtualArrayRestRep)

Aggregations

VirtualArrayRestRep (com.emc.storageos.model.varray.VirtualArrayRestRep)56 ViPRCoreClient (com.emc.vipr.client.ViPRCoreClient)15 URI (java.net.URI)15 AssetOption (com.emc.vipr.model.catalog.AssetOption)14 Asset (com.emc.sa.asset.annotation.Asset)11 AssetDependencies (com.emc.sa.asset.annotation.AssetDependencies)11 ArrayList (java.util.ArrayList)10 FlashException (controllers.util.FlashException)9 HashSet (java.util.HashSet)8 NamedRelatedResourceRep (com.emc.storageos.model.NamedRelatedResourceRep)7 VolumeRestRep (com.emc.storageos.model.block.VolumeRestRep)6 StorageSystemRestRep (com.emc.storageos.model.systems.StorageSystemRestRep)6 RelatedResourceRep (com.emc.storageos.model.RelatedResourceRep)5 StoragePortRestRep (com.emc.storageos.model.ports.StoragePortRestRep)5 VirtualArrayRelatedResourceRep (com.emc.storageos.model.VirtualArrayRelatedResourceRep)4 ExportGroupRestRep (com.emc.storageos.model.block.export.ExportGroupRestRep)4 FileShareRestRep (com.emc.storageos.model.file.FileShareRestRep)4 BlockVirtualPoolRestRep (com.emc.storageos.model.vpool.BlockVirtualPoolRestRep)4 HashMap (java.util.HashMap)4 BlockConsistencyGroupRestRep (com.emc.storageos.model.block.BlockConsistencyGroupRestRep)3