@Override protected VmDeviceId getExistingEntityId() { return new VmDeviceId(PLUGGED_DISK_ID, FixturesTool.VM_RHEL5_POOL_57); }
public DiskVmElement(Guid diskId, Guid vmId) { setId(new VmDeviceId(diskId, vmId)); }
@Override public DiskVmElement lookupEntity(Guid id) throws BackendFailureException { return getEntity( DiskVmElement.class, QueryType.GetDiskVmElementById, new VmDeviceIdQueryParameters(new VmDeviceId(id, vmId)), id.toString(), false); } }
@Override public DiskVmElement resolve(Guid id) throws BackendFailureException { return getEntity( DiskVmElement.class, QueryType.GetDiskVmElementById, new VmDeviceIdQueryParameters(new VmDeviceId(id, vmId)), id.toString(), true ); } }
@Override public void initialize(List<DiskModel> currentDisks) { super.initialize(currentDisks); setDiskVmElement(new DiskVmElement(new VmDeviceId(null, getIsFloating() ? null : getVm().getId()))); }
@Override public DiskAttachment get() { DiskAttachment diskAttachment = performGet(QueryType.GetDiskVmElementById, new VmDeviceIdQueryParameters(new VmDeviceId(Guid.createGuidFromString(diskId), vmId)), Vm.class); /* * Href of the diskattachment must be set manually due to a bug (https://bugzilla.redhat.com/1647018). * The bug is the result of an exceptional case where the same entity (disk-attachment) * has the same parent (vm) in 2 different locations in the API, causing ambiguity * in the link generation process. */ diskAttachment.setHref("/ovirt-engine/api/vms/" + vmId.toString() + "/diskattachments/" + diskAttachment.getId()); return diskAttachment; }
public VmPayload() { this.setId(new VmDeviceId(Guid.newGuid(), Guid.newGuid())); setDeviceType(VmDeviceType.CDROM); this.volumeId = null; this.files = new HashMap<>(); }
private VmDevice createVmDevice(Guid vmGuid) { return new VmDevice(new VmDeviceId(Guid.newGuid(), vmGuid), VmDeviceGeneralType.DISK, "floppy", "type:'drive', controller:'0', bus:'0', unit:'1'", new HashMap<>(), true, false, false, "alias", Collections.singletonMap("prop1", "value1"), null, null); }
@Override public DiskVmElement resolve(VmDeviceId id) throws BackendFailureException { VmDeviceId vmDeviceId = new VmDeviceId(diskId, vmId); return getEntity( DiskVmElement.class, QueryType.GetDiskVmElementById, new VmDeviceIdQueryParameters(vmDeviceId), vmDeviceId.getDeviceId().toString(), true ); } }
public VmHostDevice() { setType(VmDeviceGeneralType.HOSTDEV); setAddress(""); setManaged(true); setPlugged(true); setId(new VmDeviceId()); setSpecParams(new HashMap<String, Object>()); }
private void fixDiskVmElements() { // In the time of disk creation the VM ID is an empty Guid, this is changed to the real ID only after the // reading of the OS properties which comes after the disks creation so the disk VM elements are set to // the wrong VM ID this part sets them to the correct VM ID for (DiskImage disk : _images) { disk.getDiskVmElements().forEach(dve -> dve.setId(new VmDeviceId(disk.getId(), vmBase.getId()))); disk.setDiskVmElements(disk.getDiskVmElements()); } for (LunDisk lunDisk : luns) { lunDisk.getDiskVmElements().forEach(dve -> dve.setId(new VmDeviceId(lunDisk.getId(), vmBase.getId()))); lunDisk.setDiskVmElements(lunDisk.getDiskVmElements()); } }
private VmDevice createVmDevice(Guid deviceId, Guid vmId) { VmDevice device = new VmDevice(); device.setId(new VmDeviceId(deviceId, vmId)); return device; } }
public GraphicsDevice(VmDeviceType type) { setType(VmDeviceGeneralType.GRAPHICS); setDevice(type.name().toLowerCase()); setId(new VmDeviceId()); setAddress(""); setPlugged(true); setManaged(true); }
private VmDevice createDiskDevice(boolean boot, Map<VmDeviceId, DiskVmElement> idToDiskElement) { Guid id = Guid.newGuid(); VmDevice device = new VmDevice(); device.setType(VmDeviceGeneralType.DISK); device.setDevice(VmDeviceType.DISK.getName()); device.setId(new VmDeviceId(id, null)); DiskVmElement dve = new DiskVmElement(new VmDeviceId(id, null)); dve.setBoot(boot); idToDiskElement.put(dve.getId(), dve); return device; }
@Test public void testVmElementDiskLogicalName() { DiskVmElement dveWithLogicalName = dao.get(new VmDeviceId(PLUGGED_DISK_ID, FixturesTool.VM_RHEL5_POOL_57)); assertEquals("logical_name", dveWithLogicalName.getLogicalName()); }
private void setUpDiskVmElementExpectations() { DiskVmElement dve = new DiskVmElement(DISK_ID, VM_ID); dve.setDiskInterface(DiskInterface.VirtIO); dve.setBoot(false); setUpGetEntityExpectations( QueryType.GetDiskVmElementById, VmDeviceIdQueryParameters.class, new String[] { "Id"}, new Object[] { new VmDeviceId(DISK_ID, VM_ID)}, dve ); }
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); }
private VmDevice createNetworkInterfaceDevice(boolean plugged, Guid id) { VmDevice device = new VmDevice(); device.setType(VmDeviceGeneralType.INTERFACE); device.setDevice(VmDeviceType.BRIDGE.getName()); device.setPlugged(plugged); device.setId(new VmDeviceId(id, null)); return device; }
private VmDevice createCdRomDevice() { Guid id = Guid.newGuid(); VmDevice device = new VmDevice(); device.setType(VmDeviceGeneralType.DISK); device.setDevice(VmDeviceType.CDROM.getName()); device.setPlugged(true); device.setId(new VmDeviceId(id, null)); return device; } }