Search in sources :

Example 21 with BlockObjectRestRep

use of com.emc.storageos.model.block.BlockObjectRestRep in project coprhd-controller by CoprHD.

the class FindDisksForVolumes method failIfMissingVolumes.

protected void failIfMissingVolumes(Map<BlockObjectRestRep, DiskDrive> results) {
    if (isMissingVolumes(results)) {
        // Build error message
        StrBuilder wwids = new StrBuilder();
        int missingCount = 0;
        for (BlockObjectRestRep volume : volumes) {
            DiskDrive disk = results.get(volume);
            if (disk == null) {
                wwids.appendSeparator(", ");
                wwids.append(volume.getWwn());
                missingCount++;
            }
        }
        if (missingCount > 1) {
            throw stateException("illegalState.FindDisksForVolumes.noVolumes", wwids);
        } else {
            throw stateException("illegalState.FindDisksForVolumes.noVolume", wwids);
        }
    }
}
Also used : DiskDrive(com.iwave.ext.windows.model.wmi.DiskDrive) BlockObjectRestRep(com.emc.storageos.model.block.BlockObjectRestRep) StrBuilder(org.apache.commons.lang.text.StrBuilder)

Example 22 with BlockObjectRestRep

use of com.emc.storageos.model.block.BlockObjectRestRep in project coprhd-controller by CoprHD.

the class ExtendDriveHelper method extendDrives.

public void extendDrives() {
    windows.rescanDisks();
    for (Map.Entry<? extends BlockObjectRestRep, String> entry : volume2mountPoint.entrySet()) {
        BlockObjectRestRep volume = entry.getKey();
        String mountPoint = entry.getValue();
        ViPRService.artificialFailure(ArtificialFailures.ARTIFICIAL_FAILURE_WINDOWS_BEFORE_EXTEND_DRIVE);
        windows.extendDrive(volume, mountPoint);
        // Updates the volume mount point, it may have changed
        ViPRService.artificialFailure(ArtificialFailures.ARTIFICIAL_FAILURE_WINDOWS_AFTER_EXTEND_DRIVE);
        windows.addVolumeMountPoint(volume, mountPoint);
    }
    ExecutionUtils.clearRollback();
}
Also used : Map(java.util.Map) BlockObjectRestRep(com.emc.storageos.model.block.BlockObjectRestRep)

Example 23 with BlockObjectRestRep

use of com.emc.storageos.model.block.BlockObjectRestRep in project coprhd-controller by CoprHD.

the class UnmountBlockVolumeHelper method unmountVolumes.

public void unmountVolumes() {
    for (BlockObjectRestRep volume : volumes) {
        DiskDrive disk = volume2disk.get(volume);
        Disk diskDetail = windows.getDiskDetail(disk);
        if (diskDetail.getVolumes() != null) {
            for (Volume diskVolume : diskDetail.getVolumes()) {
                windows.unmountVolume(diskVolume.getNumber(), diskVolume.getMountPoint());
                boolean isDriveLetterOnly = WindowsUtils.isMountPointDriveLetterOnly(diskVolume.getMountPoint());
                if (!isDriveLetterOnly && windows.isDirectoryEmpty(diskVolume.getMountPoint())) {
                    windows.deleteDirectory(diskVolume.getMountPoint());
                }
            }
        }
        if (diskDetail.isOnline()) {
            windows.offlineDisk(disk);
        } else {
            logInfo("win.unmount.block.volume.disk.offline", disk.getNumber(), volume.getWwn());
        }
        windows.removeVolumeMountPoint(volume);
    }
}
Also used : DiskDrive(com.iwave.ext.windows.model.wmi.DiskDrive) Volume(com.iwave.ext.windows.model.Volume) BlockObjectRestRep(com.emc.storageos.model.block.BlockObjectRestRep) Disk(com.iwave.ext.windows.model.Disk)

Example 24 with BlockObjectRestRep

use of com.emc.storageos.model.block.BlockObjectRestRep in project coprhd-controller by CoprHD.

the class ExpandVmfsDatastoreService method execute.

@Override
public void execute() throws Exception {
    BlockObjectRestRep volume = BlockStorageUtils.getVolume(volumeId);
    // Skip the expand if the current volume capacity is larger than the requested expand size
    if (BlockStorageUtils.isVolumeExpanded(volume, sizeInGb)) {
        logWarn("expand.vmfs.datastore.skip", volumeId, BlockStorageUtils.getCapacity(volume));
    } else {
        BlockStorageUtils.expandVolume(volumeId, sizeInGb);
    }
    connectAndInitializeHost();
    datastore = vmware.getDatastore(datacenter.getLabel(), datastoreName);
    vmware.refreshStorage(host, cluster);
    artificialFailure(ArtificialFailures.ARTIFICIAL_FAILURE_VMWARE_EXPAND_DATASTORE);
    vmware.expandVmfsDatastore(host, cluster, hostId, volume, datastore);
    if (hostId != null) {
        ExecutionUtils.addAffectedResource(hostId.toString());
    }
}
Also used : BlockObjectRestRep(com.emc.storageos.model.block.BlockObjectRestRep)

Example 25 with BlockObjectRestRep

use of com.emc.storageos.model.block.BlockObjectRestRep in project coprhd-controller by CoprHD.

the class BlockProvider method getVPlexVolumesInTargetVArray.

/**
 * Gets all {@link VolumeRestRep}s that are either in the target VArray or use the target VArray for protection
 *
 * @param client the ViPR client instance.
 * @param targetVArrayId the target VArray ID.
 * @param volumes the volumes we are concerned with. (These should be VPlex volumes)
 * @return List of {@link VolumeRestRep}s that are VPlex volumes that are in the target VArray
 */
public static List<BlockObjectRestRep> getVPlexVolumesInTargetVArray(ViPRCoreClient client, URI targetVArrayId, List<VolumeRestRep> volumes) {
    // collect vpools used by these volumes
    Map<URI, BlockVirtualPoolRestRep> vpools = getVpoolsForVolumes(client, volumes);
    // sift through the volumes to find ones with the correct VArray
    List<BlockObjectRestRep> acceptedVolumes = Lists.newArrayList();
    for (VolumeRestRep volume : volumes) {
        if (volume.getVirtualArray().getId().equals(targetVArrayId)) {
            addVolume(acceptedVolumes, volume);
        } else {
            // if this volume's HA type is 'distributed' and its distributed VArray matches the target VArray we can accept the volume
            URI vpoolId = volume.getVirtualPool().getId();
            BlockVirtualPoolRestRep volumeVpool = vpools.get(vpoolId);
            if (volumeVpool != null && isVpoolProtectedByVarray(volumeVpool, targetVArrayId)) {
                addVolume(acceptedVolumes, volume);
            }
        }
    }
    return acceptedVolumes;
}
Also used : BlockVirtualPoolRestRep(com.emc.storageos.model.vpool.BlockVirtualPoolRestRep) VolumeRestRep(com.emc.storageos.model.block.VolumeRestRep) URI(java.net.URI) BlockObjectRestRep(com.emc.storageos.model.block.BlockObjectRestRep)

Aggregations

BlockObjectRestRep (com.emc.storageos.model.block.BlockObjectRestRep)60 URI (java.net.URI)30 Host (com.emc.storageos.db.client.model.Host)8 VolumeRestRep (com.emc.storageos.model.block.VolumeRestRep)8 ArrayList (java.util.ArrayList)8 DiskDrive (com.iwave.ext.windows.model.wmi.DiskDrive)7 ExportGroupRestRep (com.emc.storageos.model.block.export.ExportGroupRestRep)5 Datastore (com.vmware.vim25.mo.Datastore)5 Map (java.util.Map)5 ExecutionException (com.emc.sa.engine.ExecutionException)4 DeactivateHost (com.emc.sa.service.vipr.compute.tasks.DeactivateHost)4 DiscoverHost (com.emc.sa.service.vipr.compute.tasks.DiscoverHost)4 GetHost (com.emc.sa.service.vipr.tasks.GetHost)4 AssetOption (com.emc.vipr.model.catalog.AssetOption)4 HashMap (java.util.HashMap)4 HostRestRep (com.emc.storageos.model.host.HostRestRep)3 BlockVirtualPoolRestRep (com.emc.storageos.model.vpool.BlockVirtualPoolRestRep)3 TimeoutException (com.emc.vipr.client.exceptions.TimeoutException)3 ViPRException (com.emc.vipr.client.exceptions.ViPRException)3 Disk (com.iwave.ext.windows.model.Disk)3