Search in sources :

Example 6 with Disk

use of com.iwave.ext.windows.model.Disk 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();
        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 7 with Disk

use of com.iwave.ext.windows.model.Disk in project coprhd-controller by CoprHD.

the class MountBlockVolumeHelper method detailDisk.

public Disk detailDisk(DiskDrive disk) {
    Disk diskDetail;
    diskDetail = windows.getDiskDetail(disk);
    if (diskDetail == null) {
        ExecutionUtils.fail("failTask.MountBlockVolumeHelper.couldNotDetailDisk", disk.getName(), hostname, disk.getNumber());
    }
    return diskDetail;
}
Also used : Disk(com.iwave.ext.windows.model.Disk)

Example 8 with Disk

use of com.iwave.ext.windows.model.Disk in project coprhd-controller by CoprHD.

the class MountBlockVolumeHelper method mount.

/**
 * Mounts the volume. If {@link #doFormat} is true, the volume is formatted first.
 *
 * @param volume
 *            the volume to mount.
 * @param mountPoint
 *            the mount point to assign the volume. An empty mount point will cause the system to auto-assign a
 *            drive letter.
 */
public void mount(BlockObjectRestRep volume, DiskDrive disk, String mountPoint) {
    Disk diskDetail = detailDisk(disk);
    boolean isOnline = diskDetail.isOnline();
    if (!isOnline) {
        logInfo("win.mount.block.volume.disk.online", hostname, disk.getNumber(), volume.getWwn());
        windows.onlineDisk(diskDetail);
    }
    if (doFormat) {
        logInfo("win.mount.block.volume.format", hostname, disk.getNumber(), fileSystemType, volume.getWwn());
        windows.formatAndMount(disk, fileSystemType, getBlockSize(), getActualLabel(volume), mountPoint, partitionType);
    } else {
        // If the disk was not online, detail it again since no volume information would have been available
        if (!isOnline) {
            diskDetail = detailDisk(disk);
        }
        if (diskDetail.getVolumes() == null || diskDetail.getVolumes().isEmpty()) {
            ExecutionUtils.fail("failTask.MountBlockVolumeHelper.noVolumes", disk.getName(), hostname, disk.getName(), disk.getNumber());
        }
        // Mount the first volume only
        Volume diskVolume = diskDetail.getVolumes().get(0);
        int volumeNumber = diskVolume.getNumber();
        String label = StringUtils.defaultIfBlank(diskVolume.getLabel(), ExecutionUtils.getMessage("MountBlockVolumeHelper.label.none"));
        String fs = diskVolume.getFileSystem();
        logInfo("win.mount.block.volume.mount", hostname, volumeNumber, label, fs, volume.getWwn());
        windows.mountVolume(volumeNumber, mountPoint);
    }
    // Refresh the disk details
    diskDetail = detailDisk(disk);
    String assignedMountpoint = windows.getAssignedMountPoint(disk, diskDetail);
    assignedMountpoints.add(assignedMountpoint);
    logInfo(ExecutionUtils.getMessage("MountBlockVolumeHelper.log.mountpointToVolume", hostname, assignedMountpoint, volume.getWwn()));
    // Check to see if the the desired volume label is different than the actual label if it wasn't formatted
    if (!doFormat) {
        Volume diskVolume = diskDetail.getVolumes().get(0);
        String desiredLabel = getActualLabel(volume);
        if (!StringUtils.defaultString(diskVolume.getLabel()).equals(desiredLabel)) {
            windows.assignLabel(diskVolume, label);
        }
    }
    windows.addVolumeMountPoint(volume, assignedMountpoint);
}
Also used : Volume(com.iwave.ext.windows.model.Volume) Disk(com.iwave.ext.windows.model.Disk)

Example 9 with Disk

use of com.iwave.ext.windows.model.Disk in project coprhd-controller by CoprHD.

the class UnmountBlockVolumeHelper method precheck.

public void precheck() {
    windows.verifyWinRM();
    windows.verifyVolumesMounted(volumes);
    volume2disk = windows.findDisks(volumes);
    // Get the actual mount points for the volumes from the system
    Map<BlockObjectRestRep, String> volume2mountPoint = Maps.newHashMap();
    for (Map.Entry<? extends BlockObjectRestRep, DiskDrive> entry : volume2disk.entrySet()) {
        BlockObjectRestRep volume = entry.getKey();
        DiskDrive disk = entry.getValue();
        Disk detail = windows.getDiskDetail(disk);
        String mountPoint = ExtendDriveHelper.getMountPoint(disk, detail);
        volume2mountPoint.put(volume, mountPoint);
    }
    WindowsUtils.verifyMountPoints(hostId, volume2mountPoint);
}
Also used : DiskDrive(com.iwave.ext.windows.model.wmi.DiskDrive) BlockObjectRestRep(com.emc.storageos.model.block.BlockObjectRestRep) Map(java.util.Map) Disk(com.iwave.ext.windows.model.Disk)

Example 10 with Disk

use of com.iwave.ext.windows.model.Disk in project coprhd-controller by CoprHD.

the class UnmountBlockVolumeHelper method removeVolumesFromCluster.

public void removeVolumesFromCluster() {
    Map<String, String> diskToResourceMap = windows.getDiskToResourceMap();
    for (BlockObjectRestRep volume : volumes) {
        DiskDrive diskDrive = volume2disk.get(volume);
        Disk diskDetail = windows.getDiskDetail(diskDrive);
        String resourceName = "";
        if (windows.isGuid(diskDetail.getDiskId())) {
            resourceName = diskToResourceMap.get(diskDetail.getDiskId());
        } else {
            resourceName = diskToResourceMap.get(diskDrive.getSignature());
        }
        windows.offlineClusterResource(resourceName);
        windows.deleteClusterResource(resourceName);
    }
}
Also used : DiskDrive(com.iwave.ext.windows.model.wmi.DiskDrive) BlockObjectRestRep(com.emc.storageos.model.block.BlockObjectRestRep) Disk(com.iwave.ext.windows.model.Disk)

Aggregations

Disk (com.iwave.ext.windows.model.Disk)10 BlockObjectRestRep (com.emc.storageos.model.block.BlockObjectRestRep)4 DiskDrive (com.iwave.ext.windows.model.wmi.DiskDrive)4 Volume (com.iwave.ext.windows.model.Volume)2 Map (java.util.Map)2 DiskParser (com.iwave.ext.windows.parser.DiskParser)1