@Override protected void updateExistingEntity() { existingEntity.setAddress("type:'drive', controller:'0', bus:'0', unit:'0'"); existingEntity.setLogicalName("testLogicalName"); }
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); }
if (selectSingleNode(node, VMD_ADDRESS, _xmlNS) != null && !StringUtils.isEmpty(selectSingleNode(node, VMD_ADDRESS, _xmlNS).innerText)) { vmDevice.setAddress(String.valueOf(selectSingleNode(node, VMD_ADDRESS, _xmlNS).innerText)); } else { vmDevice.setAddress("");
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); }
@Test public void testUpdateDeviceRuntimeInfo() { VmDevice vmDevice = dao.get(getExistingEntityId()); assertTrue(StringUtils.isNotBlank(vmDevice.getAddress())); String newAddressValue = "newaddr"; vmDevice.setAddress(newAddressValue); String newAlias = "newalias"; vmDevice.setAlias(newAlias); dao.updateRuntimeInfo(vmDevice); dao.get(getExistingEntityId()); assertEquals(newAddressValue, vmDevice.getAddress()); assertEquals(newAlias, vmDevice.getAlias()); }
@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); }