Search in sources :

Example 41 with BlockObjectRestRep

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

the class ExtendDriveHelper method precheck.

public void precheck() {
    windows.verifyWinRM();
    volume2disk = windows.findDisks(volumes);
    // Get the actual mount points for the volumes from the system
    volume2mountPoint = Maps.newHashMap();
    for (Map.Entry<? extends BlockObjectRestRep, DiskDrive> entry : volume2disk.entrySet()) {
        BlockObjectRestRep volume = entry.getKey();
        DiskDrive disk = entry.getValue();
        if (volumeExpandSizeGB != null && BlockStorageUtils.isViprVolumeExpanded(volume, volumeExpandSizeGB)) {
            ExecutionUtils.fail("expand.win.fail", new Object[] {}, volume.getName(), BlockStorageUtils.getCapacity(volume));
        }
        logInfo("extendDrive.diskVolumeOnHost", disk.getNumber(), windows.getHostName());
        Disk detail = windows.getDiskDetail(disk);
        if (windows.isClustered()) {
            if (isDiskVolumeOnHost(detail)) {
                // host in cluster and found
                foundClusteredVolume = true;
            } else {
                // host in cluster and not found, don't process
                continue;
            }
        }
        windows.checkPartitionRestriction(disk, volumeSizeInBytes);
        String mountPoint = getMountPoint(disk, detail);
        logInfo("extendDrive.volumeMountPoint", volume.getName(), mountPoint);
        volume2mountPoint.put(volume, mountPoint);
    }
    WindowsUtils.verifyMountPoints(hostId, volume2mountPoint);
}
Also used : DiskDrive(com.iwave.ext.windows.model.wmi.DiskDrive) Map(java.util.Map) BlockObjectRestRep(com.emc.storageos.model.block.BlockObjectRestRep) Disk(com.iwave.ext.windows.model.Disk)

Example 42 with BlockObjectRestRep

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

the class FindDisksForVolumes method findDisksForVolumes.

protected Map<BlockObjectRestRep, DiskDrive> findDisksForVolumes() throws WinRMException {
    Map<BlockObjectRestRep, DiskDrive> results = Maps.newHashMap();
    List<DiskDrive> disks = getTargetSystem().listDiskDrives();
    for (DiskDrive disk : disks) {
        String wwid = getTargetSystem().getWwid(disk);
        logDebug("find.disks.volumes.wwid", wwid, disk.getDeviceId());
        for (BlockObjectRestRep volume : volumes) {
            if (VolumeWWNUtils.wwnMatches(wwid, volume.getWwn())) {
                logInfo("find.disks.volumes.wwid", wwid, disk.getSerialNumber());
                results.put(volume, disk);
                break;
            }
        }
    }
    return results;
}
Also used : DiskDrive(com.iwave.ext.windows.model.wmi.DiskDrive) BlockObjectRestRep(com.emc.storageos.model.block.BlockObjectRestRep)

Example 43 with BlockObjectRestRep

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

the class BlockProvider method getVirtualArrayIds.

private static List<URI> getVirtualArrayIds(Collection<? extends BlockObjectRestRep> blockObjects) {
    List<URI> varrayIds = Lists.newArrayList();
    for (BlockObjectRestRep blockObject : blockObjects) {
        if (blockObject instanceof VolumeRestRep) {
            VolumeRestRep volume = (VolumeRestRep) blockObject;
            varrayIds.add(volume.getVirtualArray().getId());
        }
    }
    return varrayIds;
}
Also used : VolumeRestRep(com.emc.storageos.model.block.VolumeRestRep) URI(java.net.URI) BlockObjectRestRep(com.emc.storageos.model.block.BlockObjectRestRep)

Example 44 with BlockObjectRestRep

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

the class BlockProviderUtils method getBlockResources.

public static List<? extends BlockObjectRestRep> getBlockResources(ViPRCoreClient viprClient, URI tenantId, URI hostOrClusterId, boolean onlyMounted) {
    List<URI> hostIds = buildHostIdsList(viprClient, hostOrClusterId, onlyMounted);
    List<BlockObjectRestRep> volumes = Lists.newArrayList();
    for (BlockObjectRestRep volume : getExportedBlockResources(viprClient, tenantId, hostOrClusterId)) {
        boolean isMounted = isMounted(hostIds, volume);
        if (onlyMounted && isMounted) {
            volumes.add(volume);
        } else if (!onlyMounted && !isMounted) {
            volumes.add(volume);
        }
    }
    return volumes;
}
Also used : URI(java.net.URI) BlockObjectRestRep(com.emc.storageos.model.block.BlockObjectRestRep)

Example 45 with BlockObjectRestRep

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

the class UnmountBlockVolumeHelper method findRelatedVolumes.

/**
 * Finds the volumes related to the mount points selected. When a mount point is removed, all related volumes have
 * to have their mount point tags removed.
 */
private void findRelatedVolumes() {
    for (VolumeSpec volume : volumes) {
        volume.relatedVolumes = Lists.newArrayList();
        Set<String> volumeWwns = getVolumeWwns(volume);
        for (String relatedWwn : volumeWwns) {
            BlockObjectRestRep related = findVolumeRestRepByWwn(relatedWwn);
            if (related == null) {
                related = BlockStorageUtils.getVolumeByWWN(relatedWwn);
            }
            if (related != null) {
                volume.relatedVolumes.add(related);
            }
        }
    }
}
Also used : 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