use of com.iwave.ext.windows.model.Volume in project coprhd-controller by CoprHD.
the class ExtendDriveHelper method getMountPoint.
/**
* Gets the mount point for the given disk drive. The disk must have only a single volume and that volume must have
* a non-empty mount point.
*
* @param disk
* the disk drive.
* @param detail the detail of the disk
* @return the mount point for the disk.
*/
public static String getMountPoint(DiskDrive disk, Disk detail) {
if (detail == null) {
ExecutionUtils.fail("failTask.ExtendDriveHelper.couldNotDetailDisk", disk.getNumber(), disk.getNumber());
}
if ((detail.getVolumes() == null) || (detail.getVolumes().isEmpty())) {
ExecutionUtils.fail("failTask.ExtendDriveHelper.noVolumes", disk.getNumber(), disk.getNumber());
}
if (detail.getVolumes().size() > 1) {
ExecutionUtils.fail("failTask.ExtendDriveHelper.moreThanOneVolume", disk.getNumber(), detail.getVolumes().size());
}
Volume volume = detail.getVolumes().get(0);
String mountPoint = volume.getMountPoint();
if (StringUtils.isBlank(mountPoint)) {
ExecutionUtils.fail("failTask.ExtendDriveHelper.volumeHasNoMountPoint", disk.getNumber(), volume.getNumber(), volume.getLabel());
}
return mountPoint;
}
use of com.iwave.ext.windows.model.Volume 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);
}
Aggregations