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

vSphere: FindTemplate should search for a desktop template if no server templates are found #428

Merged

Conversation

mansam
Copy link
Contributor

@mansam mansam commented Oct 22, 2020

The vSphere provider FindTemplate method should pass a nil workload to the template provider, since it can't get the workload from the vSphere API and setting a default can result in failing to find a valid template.

Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1890486

Signed-off-by: Sam Lucidi slucidi@redhat.com

@kubevirt-bot kubevirt-bot added dco-signoff: yes Indicates the PR's author has DCO signed all their commits. do-not-merge/release-note-label-needed Indicates that a PR should not merge because it's missing one of the release note labels. size/XS labels Oct 22, 2020
@mansam mansam force-pushed the vsphere-template-finder-nil-workload branch from df2a2b8 to 555043c Compare October 22, 2020 19:42
@mansam mansam changed the title vSphere FindTemplate should use a nil workload vSphere: FindTemplate should use a nil workload Oct 22, 2020
@@ -40,8 +39,7 @@ func (f *TemplateFinder) FindTemplate(vm *mo.VirtualMachine) (*templatev1.Templa
// We update metadata from the source vm so we default to medium flavor
namespace := TemplateNamespace
flavor := defaultFlavor
workload := defaultWorkload
tmpls, err := f.templateProvider.Find(&namespace, &os, &workload, &flavor)
tmpls, err := f.templateProvider.Find(&namespace, &os, nil, &flavor)
Copy link
Contributor

Choose a reason for hiding this comment

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

With nil workload the provider will return multiple matching templates, from which only the newest would be picked. I think that resigning from controlling the workload type will lead to less predictable behaviour and application of suboptimal templates (with CPU flags tuned to a completely different workload) to imported VMs.
I can imagine that user adds a new "desktop"-like template for a certain OS to the configuration and later all VMware imports for that OS use that template, even if most of them require server-type optimizations.

server is generally a quite safe default and I know that it has similar (but probably less severe) issues as described above (i.e. performance of Windows desktop VMs might suffer).

Maybe introduction of an optional workload property to the VirtualMachineImport would help here? It would give the user control over the workload type, if needed.

@pkliczewski, @machacekondra, @masayag, @fdupont-redhat - what do you think? Maybe it's actually not a real issue.

Copy link
Contributor

Choose a reason for hiding this comment

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

I agree with @jakub-dzon. It is important to use proper workload type since optimizations part of the template are based on the workload type. I like the idea with workload property or having default workloads for specific OS types.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@pkliczewski @jakub-dzon as a stopgap until a workload property can be added or default workloads can be determined for each OS, would it be acceptable to default to looking for a server template, and then fall back to looking for a desktop template if nothing is returned?

Copy link
Contributor

Choose a reason for hiding this comment

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

@mansam I think we could try with this approach. @jakub-dzon what do you think?

Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe introduction of an optional workload property to the VirtualMachineImport would help here? It would give the user control over the workload type, if needed.

I'd prefer exposing template identifier (name + namespace) instead of specific properties for identifying the template.
Else, we'd end up with exposing the templates attributes used as field selectors.

Without having a template specified by the user, @mansam's approach to use server and to fallback to desktop sounds good to me.

Copy link
Contributor

Choose a reason for hiding this comment

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

I'm okay with that approach. Moti's suggestion to pass template identifier instead of workload makes more sense than just the workload; it can provide easy workaround for any potential template resolution issues.

Copy link
Contributor

Choose a reason for hiding this comment

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

As far as I remember we were explicitly asked not to use the name. @omeryahud Do you have any suggestions how to handle this?

Copy link

@omeryahud omeryahud Oct 27, 2020

Choose a reason for hiding this comment

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

As far as I remember we were explicitly asked not to use the name. @omeryahud Do you have any suggestions how to handle this?

Yes, using template names is generally not a good idea, because the names of the latest templates may change as new template bundles are released, and if you allow the user to choose the template used, they might not pick the latest template.

If you decide to accept template properties from the user, it should be the os/workload/flavor labels.

Just FYI, we are currently working on some things that were mentioned here:

Copy link
Contributor

@pkliczewski pkliczewski left a comment

Choose a reason for hiding this comment

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

Please consider different approach to finding correct workload.

@mansam mansam force-pushed the vsphere-template-finder-nil-workload branch from 555043c to 2a9f90d Compare October 27, 2020 15:38
@mansam mansam changed the title vSphere: FindTemplate should use a nil workload vSphere: FindTemplate should search for a desktop template if no server templates are found Oct 27, 2020
Signed-off-by: Sam Lucidi <slucidi@redhat.com>
@mansam mansam force-pushed the vsphere-template-finder-nil-workload branch 2 times, most recently from 839c27e to 378fcde Compare October 27, 2020 15:45
@mansam
Copy link
Contributor Author

mansam commented Oct 27, 2020

Not sure why there's an ovirt test failing, none of that code's been touched by this PR.

/retest

@pkliczewski pkliczewski added the release-note-none Denotes a PR that doesn't merit a release note. label Oct 28, 2020
@kubevirt-bot kubevirt-bot removed the do-not-merge/release-note-label-needed Indicates that a PR should not merge because it's missing one of the release note labels. label Oct 28, 2020
@masayag masayag merged commit a5b77cf into kubevirt:master Oct 29, 2020
@kubevirt-bot
Copy link

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: jakub-dzon, mansam, masayag, 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

6 participants