com.vmware.vim25.util.storage.HostStorageDeviceInfoEx Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of yavijava Show documentation
Show all versions of yavijava Show documentation
Java library for VMware vSphere
package com.vmware.vim25.util.storage;
import com.vmware.vim25.*;
import org.apache.log4j.Logger;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;
/**
* Created by zahe1469 on 9/4/2014.
*/
public class HostStorageDeviceInfoEx {
/**
* Logger to log information.
*/
Logger log = Logger.getLogger(HostStorageDeviceInfoEx.class);
/**
* Host Storage Device Information.
*/
private HostStorageDeviceInfo storageDeviceInfo;
/**
* Default constructor.
*
* @param storageDeviceInfo
*/
public HostStorageDeviceInfoEx(HostStorageDeviceInfo storageDeviceInfo) {
this.storageDeviceInfo = storageDeviceInfo;
collectScsiRuntimeNames();
}
/**
* All the ScsiLun Keys and their Runtime Names mapped together.
*/
public Map scsiRuntimeNames = new HashMap();
/**
* Returns the map of [(ScsiLun Keys) : RuntimeName]
*
* @return
*/
public Map getScsiRuntimeNames() {
return this.scsiRuntimeNames;
}
/**
* Returns the RuntimeName for a given ScsiLun.
*
* @param scsiLun
* @return
*/
public String getScsiRuntimeName(ScsiLun scsiLun) {
return this.scsiRuntimeNames.get(scsiLun.key);
}
/**
* Collects Runtime names for all ScsiLuns on a Host where the ScsiLun type is "disk".
*/
private void collectScsiRuntimeNames() {
// To hold all the Scsi Luns that are disks
ArrayList sortedScsiLuns = new ArrayList();
// Check to see that this device has luns
if (storageDeviceInfo.getScsiLun().length == 0) {
log.trace("There are no Scsi LUNS on this storage device.");
return;
}
// Collect all the scsi luns which are disks
for (ScsiLun lun : storageDeviceInfo.getScsiLun()) {
if (lun.lunType.equals("disk")) {
sortedScsiLuns.add(lun);
}
}
// To collect the Scsi Topology information
ArrayList
© 2015 - 2024 Weber Informatics LLC | Privacy Policy