Search in sources :

Example 1 with Disk

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

the class DiskParser method parseDisk.

protected Disk parseDisk(String text) {
    int number = getInt(findMatch(DISK_PATTERN, text));
    if (number < 0) {
        return null;
    }
    Disk disk = new Disk();
    disk.setNumber(number);
    Map<String, String> properties = parseProperties(text, ':');
    disk.setDiskId(properties.get(DISK_ID));
    disk.setType(properties.get(TYPE));
    disk.setStatus(properties.get(STATUS));
    disk.setPath(getInt(properties.get(PATH)));
    disk.setTarget(getInt(properties.get(TARGET)));
    disk.setLunId(getInt(properties.get(LUN_ID)));
    disk.setLocationPath(properties.get(LOCATION_PATH));
    disk.setCurrentReadOnlyState(getYesNo(properties.get(CURRENT_READ_ONLY_STATE)));
    disk.setReadOnly(getYesNo(properties.get(READ_ONLY)));
    disk.setBootDisk(getYesNo(properties.get(BOOT_DISK)));
    disk.setPageFileDisk(getYesNo(properties.get(PAGE_FILE_DISK)));
    disk.setHibernationFileDisk(getYesNo(properties.get(HIBERNATION_FILE_DISK)));
    disk.setCrashdumpDisk(getYesNo(properties.get(CRASHDUMP_DISK)));
    disk.setClusteredDisk(getYesNo(properties.get(CLUSTERED_DISK)));
    disk.setVolumes(new VolumeParser().parseVolumes(text));
    return disk;
}
Also used : Disk(com.iwave.ext.windows.model.Disk)

Example 2 with Disk

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

the class MountBlockVolumeHelper method addDiskToCluster.

public void addDiskToCluster(DiskDrive diskDrive) {
    Disk diskDetail = windows.getDiskDetail(diskDrive);
    String signature = "";
    if (windows.isGuid(diskDetail.getDiskId())) {
        signature = diskDetail.getDiskId();
    } else {
        signature = "" + Long.decode("0x" + diskDetail.getDiskId());
    }
    String resourceName = windows.addDiskToCluster(signature);
    logInfo("win.mount.block.volume.added.disk.cluster", hostname, signature, resourceName);
}
Also used : Disk(com.iwave.ext.windows.model.Disk)

Example 3 with Disk

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

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

the class WindowsSystemWinRM method detailDisk.

public Disk detailDisk(int diskNumber) throws WinRMException {
    String output = diskPart(WindowsUtils.getDetailDiskCommands(diskNumber));
    DiskParser parser = new DiskParser();
    List<Disk> disks = parser.parseDisks(output);
    if (disks.isEmpty()) {
        return null;
    } else {
        return disks.get(0);
    }
}
Also used : DiskParser(com.iwave.ext.windows.parser.DiskParser) Disk(com.iwave.ext.windows.model.Disk)

Example 5 with Disk

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

the class DiskParser method parseDisks.

public List<Disk> parseDisks(String text) {
    List<Disk> disks = Lists.newArrayList();
    List<String> textBlocks = parseTextBlocks(text);
    for (String textBlock : textBlocks) {
        Disk disk = parseDisk(textBlock);
        if (disk != null) {
            disks.add(disk);
        }
    }
    return disks;
}
Also used : 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