use of org.ovirt.engine.core.common.businessentities.VmGuestAgentInterface in project ovirt-engine by oVirt.
the class VmInterfaceListModel method initSelectionGuestAgentData.
private void initSelectionGuestAgentData(VmNetworkInterface selectedItem) {
if (selectedItem == null || getGuestAgentData() == null) {
setSelectionGuestAgentData(null);
return;
}
List<VmGuestAgentInterface> selectionInterfaces = new ArrayList<>();
for (VmGuestAgentInterface guestInterface : getGuestAgentData()) {
if (Objects.equals(guestInterface.getMacAddress(), selectedItem.getMacAddress())) {
selectionInterfaces.add(guestInterface);
}
}
setSelectionGuestAgentData(selectionInterfaces);
}
use of org.ovirt.engine.core.common.businessentities.VmGuestAgentInterface in project ovirt-engine by oVirt.
the class VdsBrokerObjectsBuilder method buildVmGuestAgentInterfacesData.
/**
* Creates a list of {@link VmGuestAgentInterface} from the {@link VdsProperties.GuestNetworkInterfaces}
*
* @param vmId
* the Vm's ID which contains the interfaces
*
* @param struct
* the structure that describes the VM as reported by VDSM
* @return a list of {@link VmGuestAgentInterface} or null if no guest vNics were reported
*/
public static List<VmGuestAgentInterface> buildVmGuestAgentInterfacesData(Guid vmId, Map<String, Object> struct) {
if (!struct.containsKey(VdsProperties.VM_NETWORK_INTERFACES)) {
return null;
}
List<VmGuestAgentInterface> interfaces = new ArrayList<>();
for (Object ifaceStruct : (Object[]) struct.get(VdsProperties.VM_NETWORK_INTERFACES)) {
VmGuestAgentInterface nic = new VmGuestAgentInterface();
Map ifaceMap = (Map) ifaceStruct;
nic.setInterfaceName(assignStringValue(ifaceMap, VdsProperties.VM_INTERFACE_NAME));
nic.setMacAddress(getMacAddress(ifaceMap));
nic.setIpv4Addresses(extractList(ifaceMap, VdsProperties.VM_IPV4_ADDRESSES, true));
nic.setIpv6Addresses(extractList(ifaceMap, VdsProperties.VM_IPV6_ADDRESSES, true));
nic.setVmId(vmId);
interfaces.add(nic);
}
return interfaces;
}
use of org.ovirt.engine.core.common.businessentities.VmGuestAgentInterface in project ovirt-engine by oVirt.
the class BackendNicHelper method getDevices.
private static List<ReportedDevice> getDevices(BackendResource resource, Guid vmId, String mac) {
List<ReportedDevice> devices = new ArrayList<>();
for (VmGuestAgentInterface iface : getDevicesCollection(resource, vmId)) {
if (StringUtils.equals(iface.getMacAddress(), mac)) {
ReportedDevice device = LinkHelper.addLinks(ReportedDeviceMapper.map(iface, new ReportedDevice()));
devices.add(device);
}
}
return devices;
}
use of org.ovirt.engine.core.common.businessentities.VmGuestAgentInterface in project ovirt-engine by oVirt.
the class BackendVmNicResourceTest method getListOfVmGuestAgentInterfaces.
@SuppressWarnings("serial")
private Object getListOfVmGuestAgentInterfaces() {
VmGuestAgentInterface iface = new VmGuestAgentInterface();
iface.setMacAddress(ADDRESS);
List<VmGuestAgentInterface> list = new ArrayList<>();
list.add(iface);
return list;
}
use of org.ovirt.engine.core.common.businessentities.VmGuestAgentInterface in project ovirt-engine by oVirt.
the class BackendVmNicsResourceTest method getListOfVmGuestAgentInterfaces.
@SuppressWarnings("serial")
private Object getListOfVmGuestAgentInterfaces() {
VmGuestAgentInterface iface = new VmGuestAgentInterface();
iface.setMacAddress(ADDRESSES[2]);
List<VmGuestAgentInterface> list = new ArrayList<>();
list.add(iface);
return list;
}
Aggregations