Created attachment 1712261 [details] import-controller-log Created attachment 1712261 [details] import-controller-log Created attachment 1712261 [details] import-controller-log Created attachment 1712261 [details] import-controller-log Description of problem: When Trying to Import RHV VM that has a lower memory than the minimum defined in the vm-template, the error message looks like this: "The virtual machine could not be imported. VMCreationFailed: Error while creating virtual machine default/v2v-cirros-vm-for-tests: admission webhook "virt-template-admission.kubevirt.io" denied the request: This VM requires more memory.: Some of values [1073741824] are not in interval [1610612736, N/A]" 1. It should be clear which VM (source or destination) requiters more memory. 2. It should be clear that all 3 memory settings (memory, max memory & Physical Memory Guaranteed) of the source VM should be larger than what is defined in the cnv template. 3. It should be clear what is the meaning of Not Available (N/A), or remove it. Version-Release number of selected component (if applicable): How reproducible: Always Steps to Reproduce: 1.Import a RHV VM with memory set to lower than what is defined in the machine template 2. 3. Actual results: Expected results: Additional info: vmimport: --------- ame: v2v-cirros-vm-for-tests-import Namespace: default Labels: <none> Annotations: vmimport.v2v.kubevirt.io/source-vm-initial-state: down API Version: v2v.kubevirt.io/v1alpha1 Kind: VirtualMachineImport Metadata: Creation Timestamp: 2020-08-23T14:00:10Z Generation: 1 Managed Fields: API Version: v2v.kubevirt.io/v1alpha1 Fields Type: FieldsV1 fieldsV1: f:spec: .: f:providerCredentialsSecret: .: f:name: f:source: .: f:ovirt: .: f:mappings: .: f:networkMappings: f:vm: .: f:name: f:startVm: f:targetVmName: Manager: oc Operation: Update Time: 2020-08-23T14:00:10Z API Version: v2v.kubevirt.io/v1alpha1 Fields Type: FieldsV1 fieldsV1: f:metadata: f:annotations: .: f:vmimport.v2v.kubevirt.io/source-vm-initial-state: f:status: .: f:conditions: Manager: vm-import-controller Operation: Update Time: 2020-08-23T14:00:16Z Resource Version: 3087366 Self Link: /apis/v2v.kubevirt.io/v1alpha1/namespaces/default/virtualmachineimports/v2v-cirros-vm-for-tests-import UID: 22d6ebbf-0f43-4cd4-bc6c-95d49f5acd28 Spec: Provider Credentials Secret: Name: blue Source: Ovirt: Mappings: Network Mappings: Source: Name: ovirtmgmt/ovirtmgmt Target: Name: pod Type: pod Vm: Name: v2v-cirros-vm-for-tests Start Vm: true Target Vm Name: v2v-cirros-vm-for-tests Status: Conditions: Last Heartbeat Time: 2020-08-23T14:00:15Z Last Transition Time: 2020-08-23T14:00:15Z Message: Validation completed successfully Reason: ValidationCompleted Status: True Type: Valid Last Heartbeat Time: 2020-08-23T14:00:15Z Last Transition Time: 2020-08-23T14:00:15Z Message: VM specifies IO Threads: 1, VM has NUMA tune mode secified: interleave, Interface b7fb2701-0bae-4005-8cd4-629309eaa631 uses profile with a network filter with ID: d2370ab4-fee3-11e9-a310-8c1645ce738e. Reason: MappingRulesVerificationReportedWarnings Status: True Type: MappingRulesVerified Last Heartbeat Time: 2020-08-23T14:00:16Z Last Transition Time: 2020-08-23T14:00:15Z Message: Creating virtual machine Reason: ProcessingFailed Status: False Type: Processing Last Heartbeat Time: 2020-08-23T14:00:16Z Last Transition Time: 2020-08-23T14:00:16Z Message: Error while creating virtual machine default/v2v-cirros-vm-for-tests: admission webhook "virt-template-admission.kubevirt.io" denied the request: This VM requires more memory.: Some of values [1073741824] are not in interval [1610612736, N/A] Reason: VMCreationFailed Status: False Type: Succeeded Events: Type Reason Age From Message ---- ------ ---- ---- ------- Warning VMCreationFailed 3s virtualmachineimport-controller Error while creating virtual machine default/v2v-cirros-vm-for-tests: admission webhook "virt-template-admission.kubevirt.io" denied the request: This VM requires more memory.: Some of values [1073741824] are not in interval [1610612736, N/A] Template: --------- Name: rhel8-server-medium-v0.11.3 Namespace: openshift Created: 2 days ago Labels: flavor.template.kubevirt.io/medium=true os.template.kubevirt.io/rhel8.0=true os.template.kubevirt.io/rhel8.1=true os.template.kubevirt.io/rhel8.2=true template.kubevirt.io/type=base template.kubevirt.io/version=v0.11.3 workload.template.kubevirt.io/server=true Description: Template for Red Hat Enterprise Linux 8 VM or newer. A PVC with the RHEL disk image must be available. Annotations: defaults.template.kubevirt.io/disk=rootdisk iconClass=icon-rhel name.os.template.kubevirt.io/rhel8.0=Red Hat Enterprise Linux 8.0 or higher name.os.template.kubevirt.io/rhel8.1=Red Hat Enterprise Linux 8.0 or higher name.os.template.kubevirt.io/rhel8.2=Red Hat Enterprise Linux 8.0 or higher openshift.io/display-name=Red Hat Enterprise Linux 8.0+ VM openshift.io/documentation-url=https://github.com/kubevirt/common-templates openshift.io/provider-display-name=KubeVirt openshift.io/support-url=https://github.com/kubevirt/common-templates/issues tags=hidden,kubevirt,virtualmachine,linux,rhel template.kubevirt.io/editable=/objects[0].spec.template.spec.domain.cpu.sockets /objects[0].spec.template.spec.domain.cpu.cores /objects[0].spec.template.spec.domain.cpu.threads /objects[0].spec.template.spec.domain.resources.requests.memory /objects[0].spec.template.spec.domain.devices.disks /objects[0].spec.template.spec.volumes /objects[0].spec.template.spec.networks template.kubevirt.io/version=v1alpha1 template.openshift.io/bindable=false validations=[ { "name": "minimal-required-memory", "path": "jsonpath::.spec.domain.resources.requests.memory", "rule": "integer", "message": "This VM requires more memory.", "min": 1610612736 } ] Parameters: Name: NAME Description: VM name Required: false Generated: expression From: rhel8-[a-z0-9]{16} Name: PVCNAME Description: Name of the PVC with the disk image Required: true Value: <none> Object Labels: <none> Message: <none> Objects: VirtualMachine.kubevirt.io ${NAME} controller logs: attached.
I think this issue would happen in 2.4 unless there were some changes in common templates. @Omer are you aware of any changes in medium flavour templates?
@Piotr, This bug might have raised now (on CNV-2.4.1) since the source VMs memory settings has probably changed to 1024 M. I happen to have a record of the rhel8 medium template, on CNV-2.4.0: # check the minimum supported memory under 'validation' annotation of the template: oc get templates -n openshift rhel8-desktop-medium-v0.10.0 -o yaml |less validations: | [ { "name": "minimal-required-memory", "path": "jsonpath::.spec.domain.resources.requests.memory", "rule": "integer", "message": "This VM requires more memory.", "min": 1610612736 } ] The minimum required memory has not changed.
No changes were made to the memory requirements in templates lately To the points Amos mentioned: 1. In a case of an import, template-validator always refers to the destination VM 2. I assume this is a vm-import issue, as it refers to RHV VM configurations 3. When N/A appears in an iterval it means either 0 or infinity depends on the context. For example [1610612736, N/A] means memory between 1610612736 and infinity and [N/A, 1610612736] means memory between 0 and 1610612736. I suppose we can try and improve the messaging around that.
@Omer we are using medium flavour and server workload and you confirmed this is not specific to 2.4.1. I see 2 improvements on our side: 1. fail the import on validation 2. bump target vm memory requirements with a warning in the CR @Amos, @Ilanit which solution would be better from your point of view?
@Piotr, As 2. is not noticeable, I prefer 1. Is there a way to block the VM import, on Source VM memory smaller than the Minimum required by the template? If possible, I think it's a better user experience, then failing the import.
This bug will handle fail the import on memory limit validation. Error message can be something like: "VM can't be imported. CNV template requires minimum X memory. Please increase source VM's memory, max memory & Physical Memory Guaranteed." For point 3 in the bug description, opened SSP bug 1873771.
This issue looks like it's related to templates. Changing component to SSP for proper triage.
Why is it using medium template by default? IIUC, the CPU and memory are overridden during the import, so using the smallest possible template wouldn't block really small VMs.
@Fabian, In the past not all OSes had small templates. It would require from us to understand whether there is small template or not. medium templates are for all of them. This implies that we still need the memory check validation rule. Based on agreement we have from comment #6 we need add one validation rule. This will be done in vm-import.
@Piotr, thanks for the explanation. Then, why not provide the number of vCPUs and the memory size to templateProvider.Find() method, instead of the flavor? This would allow to look at the template validation rules and pick the best fit, rather than always looking for the medium flavor. In that case, the error would be "No template matches the vCPU and memory allocation for the VM". Then, we could revisit the provided templates to be sure that there is a tiny flavor for each operating system that actually implements the minimum requirements for the given operating system.
We can improve template selection process but we would still need to have logic discussed here since not for all OSes small templates are provided. I suggest to handle template selection as enhancement and fix the this bug.
I created this enhancement to track template selection improvement: https://github.com/kubevirt/vm-import-operator/issues/403
Moving this issue back to ASSIGNED It was tested with OCP 4.6.0-fc.8 / CNV 2.5.0 By Omer Yahud: "The validation section is the requirement, the spec.domain.resources.requests.memory is the recommendation by us. The 'min' field in the validation rule specifies the minimum amount of memory in bytes that is required for a VM of this type" Thanks
*** Bug 1884173 has been marked as a duplicate of this bug. ***
Verified on CNV 2.5 1)RHEL 7 template on CNV [nachandr@localhost cfme_tests]$ oc get templates -n openshift rhel7-server-medium-v0.11.3 -oyaml validations: | [ { "name": "minimal-required-memory", "path": "jsonpath::.spec.domain.resources.requests.memory", "rule": "integer", "message": "This VM requires more memory.", "min": 1073741824 } ] 2)I then tried importing a RHEL 7 VM from RHV with Defined Memory: 512 MB 3)With the fix , the VM import failed with this error message: MappingRulesVerificationFailed: Source VM memory 536870912 is lower than 1073741824 enforced by rhel7-server-medium-v0.11.3 template.