Bug 1349857 - <link> element is not parsed
Summary: <link> element is not parsed
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: ovirt-engine-sdk-java
Classification: oVirt
Component: General
Version: 4.0.0.Alpha10
Hardware: Unspecified
OS: Unspecified
unspecified
medium
Target Milestone: ovirt-4.0.2
: 4.0.0.Alpha11
Assignee: Ondra Machacek
QA Contact: movciari
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2016-06-24 11:48 UTC by Petr Balogh
Modified: 2016-08-17 14:44 UTC (History)
6 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2016-08-17 14:44:48 UTC
oVirt Team: Infra
rule-engine: ovirt-4.0.z+
rule-engine: planning_ack+
juan.hernandez: devel_ack+
lsvaty: testing_ack+


Attachments (Terms of Use)


Links
System ID Priority Status Summary Last Updated
oVirt gerrit 59920 None None None 2016-06-29 17:43:51 UTC
oVirt gerrit 59951 None None None 2016-06-30 09:23:20 UTC
oVirt gerrit 59980 None None None 2016-06-30 09:23:41 UTC

Description Petr Balogh 2016-06-24 11:48:57 UTC
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.

Comment 1 Juan Hernández 2016-06-24 13:32:56 UTC
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"?

Comment 2 Juan Hernández 2016-06-24 13:54:44 UTC
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

Comment 3 Petr Balogh 2016-06-27 17:46:51 UTC
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

Comment 4 Juan Hernández 2016-06-28 06:54:46 UTC
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.

Comment 5 Red Hat Bugzilla Rules Engine 2016-06-29 11:56:21 UTC
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.

Comment 6 Oved Ourfali 2016-06-29 12:00:31 UTC
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.

Comment 7 Juan Hernández 2016-06-29 12:57:31 UTC
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.

Comment 8 Red Hat Bugzilla Rules Engine 2016-07-01 10:21:44 UTC
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.


Note You need to log in before you can comment on or make changes to this bug.