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

Require extra 8 GiB free space on the destination Storage Domain in the LSM flows #624

Merged
merged 2 commits into from
Sep 22, 2022

Conversation

barpavel
Copy link
Member

@barpavel barpavel commented Aug 31, 2022

Update Live Storage Migration flow validation to require additional 3 chunks (approximately 8 GiB) of free space on the destination Storage Domain.

Bug-Url: https://bugzilla.redhat.com/2116309

@barpavel barpavel marked this pull request as draft August 31, 2022 09:40
@barpavel barpavel changed the title Require additional free space on the destination Storage Domain in the LSM flows Require extra 8GiB free space on the destination Storage Domain in the LSM flows Aug 31, 2022
@barpavel barpavel changed the title Require extra 8GiB free space on the destination Storage Domain in the LSM flows Require extra 8 GiB free space on the destination Storage Domain in the LSM flows Aug 31, 2022
@barpavel barpavel force-pushed the insufficient_free_space_2116309 branch from 0295038 to 187a534 Compare August 31, 2022 11:59
@barpavel barpavel force-pushed the insufficient_free_space_2116309 branch 2 times, most recently from 2b95d46 to 61dc003 Compare August 31, 2022 12:15
if (!isStorageDomainWithinThresholds(getDstStorageDomain())) {
return false;
}

DiskImage diskImage = getDiskImageByImageId(getParameters().getImageId());
Copy link
Member Author

@barpavel barpavel Aug 31, 2022

Choose a reason for hiding this comment

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

@bennyz @ahadas
IMHO the whole LiveMigrateDiskCommand::validateDestDomainsSpaceRequirements() can be removed, since MoveOrCopyDiskCommand::validateSpaceRequirements() runs on both source & destination Storage Domains and checks both isDomainWithinThresholds() and Storage Domains available space.

I already removed isDomainWithinThresholds() check above, since it's exactly what the MoveOrCopyDiskCommand::validateSpaceRequirements() does (for both source and destination SDs).

But I want to be careful and be sure before I remove the rest of the method, there are 2 slight differences between what MoveOrCopyDiskCommand::validateSpaceRequirements() performs on both source and destination SDs and what this method does on destination only:

  1. In the MoveOrCopyDiskCommand::validateSpaceRequirements(), the DiskImage that is used to retrieve the snapshots is initialized using a getImage() call, that uses the CopyImageGroupCommand::getImage() implementation:


    While in LiveMigrateDiskCommand::validateDestDomainsSpaceRequirements() the getDiskImageByImageId() is called:

    But at the end it looks like they are returning pretty much the same diskImageDao.get(imageId);...

  2. In the MoveOrCopyDiskCommand::validateSpaceRequirements(), the available free space validation is performed by the hasSpaceForDisksWithSnapshots():

    public ValidationResult hasSpaceForDisksWithSnapshots(Collection<DiskImage> diskImages) {

While in LiveMigrateDiskCommand::validateDestDomainsSpaceRequirements() the hasSpaceForClonedDisks() is called:

public ValidationResult hasSpaceForClonedDisks(Collection<DiskImage> diskImages) {

Trying to compare them very carefully, I see they are almost the same with very minor nuances, and though maybe both methods need to stay, but anyway, in current implementation both are called and I don't think that we should verify in 2 different ways the same disk & target domain to allow Live Migration.
So which version is correct? The one in LiveMigrateDiskCommand::validateDestDomainsSpaceRequirements() or the MoveOrCopyDiskCommand::validateSpaceRequirements()?

Copy link
Member

Choose a reason for hiding this comment

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

yeah, they are similar yet different as you pointed out. I guess the validation in LiveMigrateDiskCommand should stay, but need to take a deeper look at the differences. @bennyz can you answer this from the top of you head? :)

Copy link
Member Author

Choose a reason for hiding this comment

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

@bennyz is there some code that can be united - moved to the MoveOrCopyDiskCommand base class?
For me it looks like LiveMigrateDiskCommand::validateDestDomainsSpaceRequirements() is redundant, but there are 2 slight potential differences.

  1. The way how DiskImage, used to retrieve the snapshots, is retrieved.
  2. hasSpaceForDisksWithSnapshots vs. hasSpaceForClonedDisks(), that are currently used both to test the destination SD free space, and I added 3 chunks' addition only to one of them.

@barpavel barpavel force-pushed the insufficient_free_space_2116309 branch 3 times, most recently from 8714048 to 4d2d120 Compare September 14, 2022 07:59
@barpavel barpavel marked this pull request as ready for review September 14, 2022 09:58
@barpavel
Copy link
Member Author

/ost

@barpavel
Copy link
Member Author

/ost

@barpavel barpavel force-pushed the insufficient_free_space_2116309 branch 2 times, most recently from 7e65a6e to 3605a58 Compare September 18, 2022 11:34
@barpavel
Copy link
Member Author

/ost

@bennyz
Copy link
Member

bennyz commented Sep 19, 2022

@barpavel can you please keep only the parts crucial for the fix? there are far too many changes here for what is actually needed

@barpavel
Copy link
Member Author

This PR was verified in the following scenarios.

  1. LSM - verified that extra 3 chunks (7.5 GiB) are required on the destination SD for LSM flow only. And if not exist, the LSM process doesn't even start - failing during validation phase.
  2. Disk not attached to any VM / attached to a non-running VM - same behavior as before.

There are a few open question (above). The code refactoring that I did "on the way" allows to improve some old code, or even remove current duplicate checks.
I.e., double check for available space on destination SD using slightly different methods to calculate the "required size" and only in 1 of the checks (the one in LiveMigrateDiskCommand class) requires the extra 3 chunks.

@barpavel barpavel removed the verified label Sep 19, 2022
@barpavel barpavel marked this pull request as draft September 19, 2022 11:20
@barpavel barpavel force-pushed the insufficient_free_space_2116309 branch from 3605a58 to 8b1e2c4 Compare September 19, 2022 11:33
@barpavel barpavel force-pushed the insufficient_free_space_2116309 branch 3 times, most recently from c190bc9 to c72349d Compare September 19, 2022 14:50
@barpavel barpavel marked this pull request as ready for review September 19, 2022 14:51
Changing "createMultipleStorageDomainsValidator()" to be "protected"
in the "MoveOrCopyDiskCommand" class and overriding it in its derived
"LiveMigrateDiskCommand" class to add also the source Storage Domain ID.
Thus no need to check in the parent "MoveOrCopyDiskCommand" class
whether it's an LSM flow or not, in order to add also the source Storage
Domain ID to be checked by the created "MultipleStorageDomainsValidator".

Also removing the redundant "isDomainWithinThresholds()" destination
Storage Domain validation from the "LiveMigrateDiskCommand" class, since
it is correctly performed by the above "MultipleStorageDomainsValidator"
that validates both source & destination Storage Domains from its parent's
"MoveOrCopyDiskCommand::validateSpaceRequirements()".

Signed-off-by: Pavel Bar <pbar@redhat.com>
Bug-Url: https://bugzilla.redhat.com/2116309
…SM flow

Modify destination "StorageDomainValidator" getter to return a
dedicated validator that its "getTotalSizeForClonedDisk()" method
requires the additional 3 chunks (approximately 8 GiB) extra space
on the destination Storage Domain.
This is relevant only in LSM flow for cluster version 4.7 or above.

Signed-off-by: Pavel Bar <pbar@redhat.com>
Bug-Url: https://bugzilla.redhat.com/2116309
@bennyz bennyz force-pushed the insufficient_free_space_2116309 branch from c72349d to 408a636 Compare September 20, 2022 15:02
@bennyz
Copy link
Member

bennyz commented Sep 20, 2022

/ost

@ahadas ahadas merged commit 4655358 into oVirt:master Sep 22, 2022
@barpavel barpavel deleted the insufficient_free_space_2116309 branch September 22, 2022 08:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants