Description of problem: If I get the object of the entity VM. It has disks attribute, but it contains empty list. We have the usecase, when we need to get for the specific entity like VM all its snapshots for example or for DC all its storagedomains. We would like to use also method followLink which we cannot in this case. How reproducible: Get entity of VM and you have empty list of snapshots for example Steps to Reproduce: Vm vm = vms_service.list().send().vms().get(0) vm.disks() returns empty list So in this case, it's blocker for QA start to test this version of java SDK.
I understand that following links would be easier, but listing the disks of the VM is still possible, using the "list" method of the corresponding service: ---8<--- // Get the reference to the "vms" service: VmsService vmsService = connection.systemService().vmsService(); // Find the virtual machine: Vm vm = vmsService.list().search("name=myvm").send().vms().get(0); // Locate the service that manages the virtual machine, as that // is where the action methods are defined: VmService vmService = vmsService.vmService(vm.id()); // Locate the service that manages the disks of the virtual machine: VmDisksService disksService = vmService.disksService(); // Retrieve the list of disks, and print them: List<Disk> disks = disksService.list().send().disks(); for (Disk disk : disks) { System.out.println(disk.id()); } --->8--- Can't you do this while we implement "followLinks"?
There is a complete example of how to list the disks of a virtual machine here: https://github.com/oVirt/ovirt-engine-sdk-java/blob/master/sdk/src/test/java/org/ovirt/engine/sdk4/examples/ListVmDisks.java
Hi, problem is, that we have the method which takes as parameter only entity (e.g. vm), and link which could be for example "disks". In this case we don't know from which service was the entity created. In this way, it's not possible when we know only entity. But what we can do I think is create some wrapper for this java entity which will store service from which was the element created? Or do you know some better approach? Thanks
I'd suggest that you consider changing that method so that instead of receiving the entity as parameter it receives the service. That way you can use the service directly. You can also use the entity, if required, as it is a matter of calling the "get" method of the service. And you can also use the relationships, as the service has one method for each.
This bug report has Keywords: Regression or TestBlocker. Since no regressions or test blockers are allowed between releases, it is also being identified as a blocker for this release. Please resolve ASAP.
Juan - based on Comment #4, do we still have what to fix? Anyhow, as a workaround was suggestion in that comment this isn't a test blocker as well, so removing that.
Yes, we will add support to use the "followLinks" for sub-collections. That means that the user will be able to do something like this: ---8<--- // Get the reference to the "vms" service: VmsService vmsService = connection.systemService().vmsService(); // Find the virtual machine: Vm vm = vmsService.list().search("name=myvm").send().vms().get(0); // Follow the link to the collection of disks: List<Disk> disks = connection.followLink(vm.disks()); for (Disk disk : disks) { System.out.println(disk.id()); } --->8--- However, this will be an alternative (and simpler) mechanism, the primary mechanism to access collections is still the one described in comment 1.
Target release should be placed once a package build is known to fix a issue. Since this bug is not modified, the target version has been reset. Please use target milestone to plan a fix for a oVirt release.