Skip to content
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

Use shared lock on disks for dependent VMs #178

Merged
merged 2 commits into from
Jun 24, 2022

Conversation

bennyz
Copy link
Member

@bennyz bennyz commented Mar 22, 2022

When downloading a disk that is an overlay of a template, take only a shared lock on the disk and skip the locked disk validation, this would allow downloading disks of thin VMs without failing on the disk being locked

@bennyz bennyz requested a review from ahadas as a code owner March 22, 2022 16:25
@bennyz bennyz force-pushed the concurrent-transfer-template branch from b78fb50 to dcd3b39 Compare March 22, 2022 16:49
@bennyz bennyz added the storage label Mar 22, 2022
@bennyz bennyz force-pushed the concurrent-transfer-template branch 2 times, most recently from 9f07f39 to 7b42770 Compare June 19, 2022 12:34
The check to see if a template image is being used is pretty
complicated, extract it to a method, isTemplateBeingUsed().

Signed-off-by: Benny Zlotnik <bzlotnik@redhat.com>
@bennyz bennyz force-pushed the concurrent-transfer-template branch from 7b42770 to 945fe00 Compare June 19, 2022 13:31
@bennyz
Copy link
Member Author

bennyz commented Jun 19, 2022

/ost

@bennyz bennyz force-pushed the concurrent-transfer-template branch from 945fe00 to 724c9e1 Compare June 19, 2022 16:15
@bennyz
Copy link
Member Author

bennyz commented Jun 19, 2022

/ost

@bennyz bennyz changed the title [EXPERIMENTAL] core: use shared for lock on disks for dependent VMs core: use shared for lock on disks for dependent VMs Jun 19, 2022
@michalskrivanek
Copy link
Member

seems to be failing

@bennyz
Copy link
Member Author

bennyz commented Jun 20, 2022

seems to be failing

@michalskrivanek
where? the last run passed, there was a UI test failure in the first run because of a bug

@bennyz bennyz added the on hold label Jun 20, 2022
@michalskrivanek
Copy link
Member

in 945fe00 so now it's good!

@ahadas ahadas changed the title core: use shared for lock on disks for dependent VMs Use shared lock on disks for dependent VMs Jun 21, 2022

if (!Guid.isNullOrEmpty(getParameters().getImageId()) ||
getDiskImage() != null &&
!isThinTemplate(getDiskImage())) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so now if we download a disk of a vm that is set with thin-provisioning, we won't lock the vm? something is suspicious here

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah... it's probably not needed

if (getDiskImage() != null) {

// If the disk is a thin template overlay we only lock with a shared lock
if (getDiskImage() != null && !isThinTemplate(getDiskImage())) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what's the reason for not locking cloned disks also with shared locks?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cloned disks have a different id, no? they should be affected by this

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, we generate a different ID from them but regardless of this issue - if all we care of is that the disk is not removed or moved or converted (and such) then we don't have to create an exclusive lock for the disks at all
another way to think about it is to say exclusive locks = write locks and shared locks = read locks (although it's not always true with our engine locks) so if all we do when downloading a disk is read them, then a shared lock seems be more appropriate

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah ok, I thought the comment was about an issue... I definitely agree there is no reason to use an exclusive lock here

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

actually, there is one reason - this command is used for upload too :)

@bennyz bennyz force-pushed the concurrent-transfer-template branch 2 times, most recently from 6607a2a to b5f9d38 Compare June 22, 2022 14:39
Copy link
Member

@ahadas ahadas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good besides that change to the vm-lock which seems redundant

if (!Guid.isNullOrEmpty(getParameters().getImageId()) && getDiskImage() != null) {

if (!Guid.isNullOrEmpty(getParameters().getImageId()) ||
getDiskImage() != null) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we need this change? (we have to check getDiskImage() != null, otherwise we'll get NPE in the following line)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nope, leftover from previous change

When downloading a disk that is an overlay of a template, take only a
shared lock on the disk and skip the locked disk validation, this would
allow downloading disks of thin VMs without failing on the disk being
locked.

Bug-Url: Bug-Url: https://bugzilla.redhat.com/1879391
Signed-off-by: Benny Zlotnik <bzlotnik@redhat.com>
@bennyz bennyz force-pushed the concurrent-transfer-template branch from b5f9d38 to 4c3ab00 Compare June 23, 2022 14:07
@bennyz
Copy link
Member Author

bennyz commented Jun 23, 2022

/ost

@ahadas ahadas merged commit 6c7f72b into oVirt:master Jun 24, 2022
@bennyz bennyz removed the on hold label Jul 12, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants