-
Notifications
You must be signed in to change notification settings - Fork 22
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Image download #9
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I looked at client_disk and client_disk_download for now.
I think that a lot of the code here can be shared with the
https://github.com/oVirt/go-ovirt-client/blob/main/client_disk_uploadimage.go
There are large parts that are basically the same between the paths, and I think that both paths (upload and download) can improve one another if they will share the same code.
I also liked that on the upload path we are removing the disk in case of failure but in download we didn't handle that...
Plus I don't see that we waited for the disk to be OK or for the job to finish
@Gal-Zaidman I did the refactor, please check again. |
It's a reoccurring theme here that whenever you use the retry function, I think you can refactor the code a bit and try to remove as many of those anonymous functions as you can, and splite it, especially the large once.
It can be split into "isImageTransferReady" which is the anonymous function and "waitForImageTransferReady" which is the retry part. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried to do the best I can, please when you make changes commit them on a SEPARATE commit so I can understand what has change easily.
Other than that, great job 😃
Please describe the change you are making
This change fixes #7 and adds the ability to download VM images.
This PR is based on #5