use of com.iwave.ext.windows.WindowsSystemWinRM in project coprhd-controller by CoprHD.
the class WindowsHostDiscoveryAdapter method setNativeGuid.
@Override
protected void setNativeGuid(Host host) {
WindowsSystemWinRM windows = createWindowsSystem(host);
try {
NetworkAdapter adapter = getPrimaryNetworkAdapter(windows.listNetworkAdapters());
if (adapter != null && !host.getNativeGuid().equalsIgnoreCase(adapter.getMacAddress())) {
checkDuplicateHost(host, adapter.getMacAddress());
info("Setting nativeGuid for " + host.getId() + " as " + adapter.getMacAddress());
host.setNativeGuid(adapter.getMacAddress());
save(host);
}
} catch (WinRMException e) {
throw new RuntimeException(e);
}
}
use of com.iwave.ext.windows.WindowsSystemWinRM in project coprhd-controller by CoprHD.
the class ExtendDriveHelper method createHelpers.
public static List<ExtendDriveHelper> createHelpers(URI hostId, List<WindowsSystemWinRM> windowsSystems, long volumeSizeInBytes) {
List<ExtendDriveHelper> helpers = Lists.newArrayList();
for (WindowsSystemWinRM windowsSystem : windowsSystems) {
WindowsSupport windowsSupport = new WindowsSupport(windowsSystem);
ExtendDriveHelper extendDriveHelper = new ExtendDriveHelper(hostId, windowsSupport, volumeSizeInBytes);
BindingUtils.bind(extendDriveHelper, ExecutionUtils.currentContext().getParameters());
helpers.add(extendDriveHelper);
}
return helpers;
}
use of com.iwave.ext.windows.WindowsSystemWinRM in project coprhd-controller by CoprHD.
the class WindowsUtils method createWindowsSystem.
public static WindowsSystemWinRM createWindowsSystem(Host host, Cluster cluster) {
boolean useSsl = host.getUseSSL() != null ? host.getUseSSL().booleanValue() : DEFAULT_USE_SSL;
int portNumber = host.getPortNumber() != null ? host.getPortNumber().intValue() : DEFAULT_PORT_NUMBER;
WindowsSystemWinRM windowsSystem = new WindowsSystemWinRM(host.getHostName(), portNumber, useSsl, host.getUsername(), host.getPassword());
windowsSystem.setHostId(host.getId());
if (cluster != null) {
windowsSystem.setClusterId(cluster.getId());
}
return windowsSystem;
}
use of com.iwave.ext.windows.WindowsSystemWinRM in project coprhd-controller by CoprHD.
the class WindowsHostDiscoveryAdapter method discoverIpInterfaces.
@Override
protected void discoverIpInterfaces(Host host, List<IpInterface> oldIpInterfaces) {
WindowsSystemWinRM windows = createWindowsSystem(host);
try {
for (NetworkAdapter adapter : windows.listNetworkAdapters()) {
if (StringUtils.isNotBlank(adapter.getIpAddress())) {
IpInterface ipInterface = getOrCreateIpInterface(oldIpInterfaces, adapter.getIpAddress());
discoverIp4Interface(host, ipInterface, adapter);
}
if (StringUtils.isNotBlank(adapter.getIp6Address())) {
IpInterface ipInterface = getOrCreateIpInterface(oldIpInterfaces, adapter.getIp6Address());
discoverIp6Interface(host, ipInterface, adapter);
}
}
} catch (WinRMException e) {
warn(e, "Error while retrieving IP interfaces: %s", e.getMessage());
oldIpInterfaces.clear();
}
}
use of com.iwave.ext.windows.WindowsSystemWinRM in project coprhd-controller by CoprHD.
the class WindowsHostDiscoveryAdapter method discoverInitiators.
@Override
protected void discoverInitiators(Host host, List<Initiator> oldInitiators, HostStateChange changes) {
WindowsSystemWinRM windows = createWindowsSystem(host);
List<Initiator> addedInitiators = new ArrayList<Initiator>();
try {
for (FibreChannelHBA hba : windows.listFibreChannelHBAs()) {
Initiator initiator;
if (findInitiatorByPort(oldInitiators, hba.getPortWWN()) == null) {
initiator = getOrCreateInitiator(host.getId(), oldInitiators, hba.getPortWWN());
addedInitiators.add(initiator);
} else {
initiator = getOrCreateInitiator(host.getId(), oldInitiators, hba.getPortWWN());
}
discoverFCInitiator(host, initiator, hba);
}
} catch (WinRMSoapException e) {
info("Could not retrieve fibre channel HBAs: %s", e.getMessage());
clearInitiators(oldInitiators, Protocol.FC.name());
} catch (WinRMException e) {
warn(e, "Error while retrieving fibre channel HBAs: %s", e.getMessage());
clearInitiators(oldInitiators, Protocol.FC.name());
}
try {
for (String iqn : windows.listIScsiInitiators()) {
Initiator initiator;
if (findInitiatorByPort(oldInitiators, iqn) == null) {
initiator = getOrCreateInitiator(host.getId(), oldInitiators, iqn);
addedInitiators.add(initiator);
} else {
initiator = getOrCreateInitiator(host.getId(), oldInitiators, iqn);
}
discoverISCSIInitiator(host, initiator, iqn);
}
} catch (WinRMSoapException e) {
info("Could not retrieve iSCSI interfaces: %s", e.getMessage());
clearInitiators(oldInitiators, Protocol.iSCSI.name());
} catch (WinRMException e) {
warn(e, "Error while retrieving iSCSI interfaces: %s", e.getMessage());
clearInitiators(oldInitiators, Protocol.iSCSI.name());
}
// update export groups with new initiators if host is in use.
if (!addedInitiators.isEmpty()) {
Collection<URI> addedInitiatorIds = Lists.newArrayList(Collections2.transform(addedInitiators, CommonTransformerFunctions.fctnDataObjectToID()));
changes.setNewInitiators(addedInitiatorIds);
}
}
Aggregations