public static HostNetworkQos fromAnonymousHostNetworkQos(AnonymousHostNetworkQos hostNetworkQos) { if (hostNetworkQos == null) { return null; } HostNetworkQos result = new HostNetworkQos(); result.setId(hostNetworkQos.getId()); result.hostNetworkQosProperties = new HostNetworkQosProperties(hostNetworkQos.getHostNetworkQosProperties()); return result; }
@Override public IPv4Address apply(VdsNetworkInterface nic) { IPv4Address ipv4Address = new IPv4Address(); if (nic.getIpv4BootProtocol() == Ipv4BootProtocol.STATIC_IP) { ipv4Address.setAddress(nic.getIpv4Address()); ipv4Address.setNetmask(nic.getIpv4Subnet()); ipv4Address.setGateway(nic.getIpv4Gateway()); } ipv4Address.setBootProtocol(nic.getIpv4BootProtocol()); return ipv4Address; } }
public FromNetworkAttachment(NetworkAttachment networkAttachment, HostNetworkQos networkQos) { this.networkAttachment = networkAttachment; this.iPv4Address = networkAttachment.getIpConfiguration() != null && networkAttachment.getIpConfiguration().hasIpv4PrimaryAddressSet() ? networkAttachment.getIpConfiguration().getIpv4PrimaryAddress() : null; this.iPv6Address = networkAttachment.getIpConfiguration() != null && networkAttachment.getIpConfiguration().hasIpv6PrimaryAddressSet() ? networkAttachment.getIpConfiguration().getIpv6PrimaryAddress() : null; this.networkQos = networkQos; }
private void initIpv6ConfigurationBootProtocol(boolean sameBootProtocol) { initIpv6Configuration(); ipv6Address.setBootProtocol(IPV6_BOOT_PROTOCOL); Ipv6BootProtocol ifaceBootProtocol = sameBootProtocol ? IPV6_BOOT_PROTOCOL : Ipv6BootProtocol.forValue((IPV4_BOOT_PROTOCOL.getValue() + 1) % Ipv4BootProtocol.values().length); iface.setIpv6BootProtocol(ifaceBootProtocol); }
private static NetworkCluster createNetworkClusterWithDefaultValues(Guid clusterId, Network net) { return new NetworkCluster(clusterId, net.getId(), NetworkStatus.NON_OPERATIONAL, false, true, false, false, false, false ); }
private ReportedConfiguration reporteEqualBridged() { return new ReportedConfiguration(ReportedConfigurationType.BRIDGED, iface.isBridged(), network.isVmNetwork(), true); }
private ReportedConfiguration reportedEqualMtu() { return new ReportedConfiguration( ReportedConfigurationType.MTU, iface.getMtu(), network.getMtu(), true); }
private static NetworkInterface<?> createNic(String macAddress, String name, VmInterfaceType vmInterfaceType) { NetworkInterface<?> nic = new VmNetworkInterface(); nic.setName(name); nic.setMacAddress(macAddress); nic.setType(vmInterfaceType == null ? null : vmInterfaceType.getValue()); return nic; }
private ReportedConfiguration reportEqualVLAN() { return new ReportedConfiguration(ReportedConfigurationType.VLAN, iface.getVlanId(), network.getVlanId(), true); }
@Override public HostNetworkQos getHostNetworkQos() { if (networkAttachment.isQosOverridden()) { return HostNetworkQos.fromAnonymousHostNetworkQos(networkAttachment.getHostNetworkQos()); } else { return networkQos; } }
private Guid getDnsResolverConfigurationId(NetworkAttachment networkAttachment) { DnsResolverConfiguration dnsResolverConfiguration = networkAttachment.getDnsResolverConfiguration(); if (dnsResolverConfiguration == null) { return null; } return dnsResolverConfiguration.getId(); }
private Guid getDnsResolverConfigurationId(Network network) { DnsResolverConfiguration dnsResolverConfiguration = network.getDnsResolverConfiguration(); if (dnsResolverConfiguration == null) { return null; } return dnsResolverConfiguration.getId(); }
@Override protected Double[] getRawValue(VmNetworkInterface object) { Double receiveDropRate = object != null ? object.getStatistics().getReceiveDropRate() : null; Double transmitDropRate = object != null ? object.getStatistics().getTransmitDropRate() : null; return new Double[] { receiveDropRate, transmitDropRate }; } };
@Override public void setId(Guid id) { this.id = id; if (isQosOverridden()) { hostNetworkQos.setId(id); } }
public static AnonymousHostNetworkQos fromHostNetworkQos(HostNetworkQos hostNetworkQos) { if (hostNetworkQos == null) { return null; } AnonymousHostNetworkQos result = new AnonymousHostNetworkQos(); result.id = hostNetworkQos.getId(); result.hostNetworkQosProperties = hostNetworkQos.getHostNetworkQosProperties(); return result; }