Skip to content
This repository has been archived by the owner on Feb 7, 2024. It is now read-only.

Validate template memory requirements #406

Merged
merged 1 commit into from Sep 20, 2020

Conversation

pkliczewski
Copy link
Contributor

Bug-Url: https://bugzilla.redhat.com/1871433
Signed-off-by: Piotr Kliczewski piotr.kliczewski@gmail.com

Bug-Url: https://bugzilla.redhat.com/1871433
Signed-off-by: Piotr Kliczewski <piotr.kliczewski@gmail.com>
@pkliczewski pkliczewski added the release-note-none Denotes a PR that doesn't merit a release note. label Sep 18, 2020
@kubevirt-bot kubevirt-bot added dco-signoff: yes Indicates the PR's author has DCO signed all their commits. size/L labels Sep 18, 2020
@@ -263,7 +263,7 @@ func (o *OvirtProvider) Validate() ([]v2vv1.VirtualMachineImportCondition, error
return []v2vv1.VirtualMachineImportCondition{}, errors.New("VM has not been loaded")
}
vmiName := o.GetVmiNamespacedName()
return o.validator.Validate(vm, &vmiName, o.resourceMapping), nil
return o.validator.Validate(vm, &vmiName, o.resourceMapping, o.templateFinder), nil
Copy link
Contributor

Choose a reason for hiding this comment

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

What do you think about not retrieving the template twice and refactoring into something along these lines?:

  • retrieve template in the controller before validation - set it on provider;
  • in provider pass the template to validation (instead of the template finder) and
    • check whether the template was found (if required) - I think we talked about making it part of validation, not processing;
    • check the memory requirements.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I have been thinking about it but we handle the template differently in both places. As well as we would always fetched it but in some cases validation would fail so it wouldn't be needed.

@machacekondra machacekondra merged commit 0b1f69b into kubevirt:master Sep 20, 2020
@kubevirt-bot
Copy link

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: jakub-dzon, machacekondra, pkliczewski
To complete the pull request process, please assign
You can assign the PR to them by writing /assign in a comment when ready.

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
dco-signoff: yes Indicates the PR's author has DCO signed all their commits. release-note-none Denotes a PR that doesn't merit a release note. size/L
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants