private VmDevice addManagedVmDevice(VmDevice vmDevice) { vmDevice.setManaged(true); vmBase.getManagedDeviceMap().put(vmDevice.getDeviceId(), vmDevice); return vmDevice; }
private VmDevice createUnmanagedNetworkInterface(boolean plugged) { VmDevice device = createNetworkInterfaceDevice(plugged, Guid.newGuid()); device.setManaged(false); return device; }
private VmDevice createNetworkInterface(boolean plugged, String name, List<VmNetworkInterface> interfaces) { Guid id = Guid.newGuid(); VmNetworkInterface vmNic = new VmNetworkInterface(); vmNic.setId(id); vmNic.setName(name); interfaces.add(vmNic); VmDevice device = createNetworkInterfaceDevice(plugged, id); device.setManaged(true); return device; }
public static void addVirtIoScsiDevice(VmBase vmBase) { VmDevice vmDevice = new VmDevice(); vmDevice.setId(new VmDeviceId(Guid.newGuid(), vmBase.getId())); vmDevice.setType(VmDeviceGeneralType.CONTROLLER); vmDevice.setDevice(VmDeviceType.VIRTIOSCSI.getName()); vmDevice.setManaged(true); vmDevice.setPlugged(true); vmDevice.setReadOnly(false); vmDevice.setAddress(""); vmBase.getManagedDeviceMap().put(vmDevice.getDeviceId(), vmDevice); }
public static void addCdDevice(VmBase vmBase) { VmDevice vmDevice = new VmDevice(); vmDevice.setId(new VmDeviceId(Guid.newGuid(), vmBase.getId())); vmDevice.setType(VmDeviceGeneralType.DISK); vmDevice.setDevice(VmDeviceType.CDROM.getName()); vmDevice.setManaged(true); vmDevice.setPlugged(true); vmDevice.setReadOnly(true); vmDevice.setAddress(""); vmBase.getManagedDeviceMap().put(vmDevice.getDeviceId(), vmDevice); }
public static void addVideoDevice(VmBase vmBase) { if (vmBase.getDefaultDisplayType().getDefaultVmDeviceType() == null) { return; } VmDevice vmDevice = new VmDevice(); vmDevice.setId(new VmDeviceId(Guid.newGuid(), vmBase.getId())); vmDevice.setType(VmDeviceGeneralType.VIDEO); vmDevice.setDevice(vmBase.getDefaultDisplayType().getDefaultVmDeviceType().getName()); vmDevice.setManaged(true); vmDevice.setPlugged(true); vmDevice.setReadOnly(false); vmDevice.setAddress(""); vmBase.getManagedDeviceMap().put(vmDevice.getDeviceId(), vmDevice); }
@BeforeEach @Override public void setUp() throws Exception { super.setUp(); existingVmInterface = dao.get(FixturesTool.VM_NETWORK_INTERFACE); existingTemplateInterface = dao.get(FixturesTool.TEMPLATE_NETWORK_INTERFACE); newVmInterface = new VmNetworkInterface(); newVmInterface.setStatistics(new VmNetworkStatistics()); newVmInterface.setId(Guid.newGuid()); newVmInterface.setVnicProfileId(FixturesTool.VM_NETWORK_INTERFACE_PROFILE); newVmInterface.setName("eth77"); newVmInterface.setNetworkName("enginet"); newVmInterface.setLinked(true); newVmInterface.setSpeed(1000); newVmInterface.setType(3); newVmInterface.setMacAddress("01:C0:81:21:71:17"); newVmDevice.setType(VmDeviceGeneralType.INTERFACE); newVmDevice.setDevice("bridge"); newVmDevice.setAddress("sample"); newVmDevice.setManaged(true); newVmDevice.setPlugged(true); newVmDevice.setReadOnly(false); Map<String, String> customProp = new LinkedHashMap<>(); customProp.put("prop1", "val1"); newVmDevice.setCustomProperties(customProp); }