ovirt-engine icon indicating copy to clipboard operation
ovirt-engine copied to clipboard

restapi: incorrect href for parent href

Open ArtiomDivak opened this issue 2 years ago • 3 comments

If User send REST API request for ovirt-engine/api/disks/{diskid}/disksnapshots?include_active&include_template he will get this incorrect href back . Now it will get correct output that will look like this .

Bug-Url: https://bugzilla.redhat.com/2013697 Signed-off-by: Artiom Divak [email protected]

ArtiomDivak avatar Jul 24 '22 07:07 ArtiomDivak

Additional info: Note that when 'include_template' flag is requested, and one of the disk_snapshots have a template disk as a parent (as described here https://bugzilla.redhat.com/1900597) - this template disk snapshot belongs to another disk, thus the href should be built accordingly.

Have you checked this scenario? In this case, the parent snapshot will have another diskId, thus the URL will be incorrect.

mkemel avatar Jul 24 '22 11:07 mkemel

As I see, similar change is already done by https://github.com/oVirt/ovirt-engine/commit/b1579afed5a1ad0f9e844e1b5870280c71d37aa9

smelamud avatar Aug 03 '22 15:08 smelamud

As I see, similar change is already done by b1579af

right, that was for a particular snapshot and this one is for a collection of snapshots

ahadas avatar Aug 03 '22 16:08 ahadas

If User send REST API request for ovirt-engine/api/disks/{diskid}/disksnapshots?include_active&include_template he will get this incorrect href back . Now it will get correct output that will look like this .

Bug-Url: https://bugzilla.redhat.com/2013697 Signed-off-by: Artiom Divak [email protected]

Looks like the PR description is cut. Please add the bad and good href examples, as appear in the commit message :)

barpavel avatar Aug 24 '22 11:08 barpavel

much better now, thanks minor comments inside I'm still not convinced that we should set the parent link to the template's image when include-template is not set - until now I only thought if it's a proper design but now I wonder if it could lead to backward compatibility issues for clients that use that link (they'll see a link to an image that is not returned). @ArtiomDivak @mkemel @bennyz @barpavel what do you think?

I think that this link is intended to fetch a specific disksnapshot. Thus returning it when include_template is not set makes even more sense - we don't have the parent image here in the returned array of disksnapshots, but here's a correct link that you can fetch it with. Also don't think that there would be any backward compatibility issues, since this href was never correct anyway.

mkemel avatar Sep 01 '22 09:09 mkemel

Also don't think that there would be any backward compatibility issues, since this href was never correct anyway.

@mkemel so previously when include-template was not set we set an incorrect href for the parent of the top-level volume? wasn't it empty?

ahadas avatar Sep 01 '22 11:09 ahadas

@mkemel so previously when include-template was not set we set an incorrect href for the parent of the top-level volume? wasn't it empty?

No, it wasn't empty. The parent ID is always there, it's just that the URL is built incorrectly. BTW, include_template is a fairly new feature, and was added exactly as a solution to the fact that parent pointed to a disksnapshot not in the list.

mkemel avatar Sep 01 '22 12:09 mkemel

No, it wasn't empty. The parent ID is always there, it's just that the URL is built incorrectly.

ack, in this case, it's really a bug fix more than an enhancement that users can complain about, ok.

ahadas avatar Sep 01 '22 12:09 ahadas

/ost

ahadas avatar Sep 01 '22 16:09 ahadas

/ost

ArtiomDivak avatar Sep 04 '22 08:09 ArtiomDivak

@oliel , @mwperina , can you please take a look?

ahadas avatar Sep 04 '22 10:09 ahadas