@Override protected VmInterfaceType getRawValue(VmNetworkInterface object) { return VmInterfaceType.forValue(object.getType()); } };
@Override protected VmInterfaceType getRawValue(VmNetworkInterface object) { return VmInterfaceType.forValue(object.getType()); } };
public boolean isPassthrough() { return VmInterfaceType.pciPassthrough.equals(VmInterfaceType.forValue(getType())); } }
@Override protected void initSelectedType() { VmInterfaceType selectedNicType = VmInterfaceType.forValue(getNic().getType()); if (selectedNicType == null || !getSupportedVnicTypes().contains(selectedNicType)) { selectedNicType = getDefaultNicTypeByProfile(); } if (getNicType().getItems() == null) { getNicType().setItems(getSupportedVnicTypes(), selectedNicType); } else { getNicType().setSelectedItem(selectedNicType); } }
private void updateVnicType(VnicProfileView profile, VmNetworkInterface existingVnic, VmNetworkInterface editedVnic) { boolean shouldBePciPassthroughType = profile != null && profile.isPassthrough() && supportedInterfaceTypes != null && supportedInterfaceTypes.contains(VmInterfaceType.pciPassthrough); if (existingVnic == null) { if (shouldBePciPassthroughType) { editedVnic.setType(VmInterfaceType.pciPassthrough.getValue()); } else { editedVnic.setType(defaultType == null ? null : defaultType.getValue()); } } else { VmInterfaceType existingInterfaceType = VmInterfaceType.forValue(existingVnic.getType()); boolean shouldRestoreToDefault = profile != null && !profile.isPassthrough() && VmInterfaceType.pciPassthrough.equals(existingInterfaceType); if (shouldBePciPassthroughType) { existingVnic.setType(VmInterfaceType.pciPassthrough.getValue()); } else if (shouldRestoreToDefault || supportedInterfaceTypes == null || !supportedInterfaceTypes.contains(existingInterfaceType)) { existingVnic.setType(defaultType == null ? null : defaultType.getValue()); } } }
protected void updateSingleNic(XmlNode node, VmNetworkInterface iface, int nicIdx) { String networkName = selectSingleNode(node, VMD_CONNECTION, _xmlNS).innerText; iface.setRemoteNetworkName(networkName); iface.setNetworkName(StringUtils.defaultIfEmpty(networkName, null)); XmlNode vnicProfileNameNode = selectSingleNode(node, VMD_VNIC_PROFILE_NAME, _xmlNS); iface.setVnicProfileName(vnicProfileNameNode == null ? null : StringUtils.defaultIfEmpty(vnicProfileNameNode.innerText, null)); XmlNode linkedNode = selectSingleNode(node, VMD_LINKED, _xmlNS); iface.setLinked(linkedNode == null ? true : Boolean.valueOf(linkedNode.innerText)); XmlNode nameNode = selectSingleNode(node, VMD_NAME, _xmlNS); iface.setName(nameNode != null ? nameNode.innerText : String.format("nic%d", nicIdx)); XmlNode resourceSubTypeNode = selectSingleNode(node, "rasd:ResourceSubType", _xmlNS); iface.setType(getVmInterfaceType(resourceSubTypeNode)); XmlNode speed = selectSingleNode(node, "rasd:speed", _xmlNS); iface.setSpeed(speed != null ? Integer.parseInt(speed.innerText) : VmInterfaceType.forValue(iface.getType()) .getSpeed()); }
VmInterfaceType nicType = VmInterfaceType.forValue(getVmInterfaceType(resourceSubTypeNode)); if (nicType == VmInterfaceType.pciPassthrough) { vmDevice.setDevice(VmDeviceType.HOST_DEVICE.getName());
_writer.writeRaw(iface.getSpeed().toString()); } else { _writer.writeRaw(String.valueOf(VmInterfaceType.forValue( iface.getType()).getSpeed()));
nic.getVnicProfileName()), dl); addDetailItem(SafeHtmlUtils.fromSafeConstant(constants.typeInterface()), SafeHtmlUtils.fromString(VmInterfaceType.forValue(nic.getType()).getDescription()), dl); addDetailItem(SafeHtmlUtils.fromSafeConstant(constants.macInterface()), SafeHtmlUtils.fromString(nic.getMacAddress()), dl);
renderLinkState(networkInterface.isLinked()), dl); addDetailItem(SafeHtmlUtils.fromSafeConstant(constants.typeInterface()), SafeHtmlUtils.fromString(VmInterfaceType.forValue(networkInterface.getType()).getDescription()), dl); addDetailItem(templates.sub(constants.speedInterface(), constants.mbps()), SafeHtmlUtils.fromString(String.valueOf(networkInterface.getSpeed())), dl);