Search in sources :

Example 1 with DiskDrive

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

the class MountBlockVolumeHelper method mountVolume.

/**
 * Mounts the given volumes. If {@link #doFormat} is true, the volume is formatted first.
 *
 * @param volume
 *            the volumes to mount.
 */
public DiskDrive mountVolume(BlockObjectRestRep volume) {
    windows.rescanDisks();
    Map<? extends BlockObjectRestRep, DiskDrive> volume2disk = windows.discoverDisks(Collections.singleton(volume), refreshAttempts, refreshDelay);
    DiskDrive disk = volume2disk.get(volume);
    mount(volume, disk, getMountPoint());
    return disk;
}
Also used : DiskDrive(com.iwave.ext.windows.model.wmi.DiskDrive)

Example 2 with DiskDrive

use of com.iwave.ext.windows.model.wmi.DiskDrive 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 3 with DiskDrive

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

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

the class ListDiskDrivesQuery method processItems.

@Override
protected void processItems(Element items, List<DiskDrive> results) {
    for (Element item : XmlUtils.selectElements(DISK_DRIVE_EXPR, items)) {
        int number = getNumber(item);
        if (number > -1) {
            DiskDrive diskDrive = new DiskDrive();
            diskDrive.setNumber(number);
            diskDrive.setName(getName(item));
            diskDrive.setCaption(getCaption(item));
            diskDrive.setDeviceId(getDeviceId(item));
            diskDrive.setPnpDeviceId(getPNPDeviceId(item));
            diskDrive.setInterfaceType(getInterfaceType(item));
            diskDrive.setScsiBus(getScsiBus(item));
            diskDrive.setScsiPort(getScsiPort(item));
            diskDrive.setScsiTarget(getScsiTarget(item));
            diskDrive.setScsiLun(getScsiLun(item));
            diskDrive.setSerialNumber(getSerialNumber(item));
            diskDrive.setSize(getSize(item));
            diskDrive.setStatus(getStatus(item));
            diskDrive.setSignature(getSignature(item));
            results.add(diskDrive);
        }
    }
}
Also used : DiskDrive(com.iwave.ext.windows.model.wmi.DiskDrive) Element(org.w3c.dom.Element)

Example 5 with DiskDrive

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

the class CreateAndMountBlockVolumeService method execute.

@Override
public void execute() throws Exception {
    BlockObjectRestRep volume = createBlockVolumeHelper.createAndExportVolumes().get(0);
    acquireHostAndClusterLock();
    ViPRService.artificialFailure(ArtificialFailures.ARTIFICIAL_FAILURE_WINDOWS_MOUNT_VOLUME);
    // Only perform mounting/formatting on ONE host
    DiskDrive diskDrive = mountBlockVolumeHelpers.get(0).mountVolume(volume);
    if (isClustered()) {
        for (int i = 1; i < mountBlockVolumeHelpers.size(); i++) {
            mountBlockVolumeHelpers.get(i).rescanDisks();
        }
        mountBlockVolumeHelpers.get(0).addDisksToCluster(Collections.singleton(diskDrive));
    }
// Only perform formatting on ONE machine
// for (MountBlockVolumeHelper mountBlockVolumeHelper : mountBlockVolumeHelper) {
// mountBlockVolumeHelper.doFormat = false;
// }
// mountBlockVolumeHelper.get(0).doFormat = true;
// 
// 
// for (MountBlockVolumeHelper mountBlockVolumeHelper : mountBlockVolumeHelper) {
// mountBlockVolumeHelper.mountVolumes(volumes, false);
// }
}
Also used : DiskDrive(com.iwave.ext.windows.model.wmi.DiskDrive) BlockObjectRestRep(com.emc.storageos.model.block.BlockObjectRestRep)

Aggregations

DiskDrive (com.iwave.ext.windows.model.wmi.DiskDrive)10 BlockObjectRestRep (com.emc.storageos.model.block.BlockObjectRestRep)7 Disk (com.iwave.ext.windows.model.Disk)4 Map (java.util.Map)2 Volume (com.iwave.ext.windows.model.Volume)1 StrBuilder (org.apache.commons.lang.text.StrBuilder)1 Element (org.w3c.dom.Element)1