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;
}
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);
}
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);
}
}
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);
}
}
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;
}
Aggregations