Bug 1642231

Summary: Check preset conflict doesn't work
Product: Container Native Virtualization (CNV) Reporter: zhe peng <zpeng>
Component: VirtualizationAssignee: Fabian Deutsch <fdeutsch>
Status: CLOSED NOTABUG QA Contact: zhe peng <zpeng>
Severity: medium Docs Contact:
Priority: medium    
Version: 1.3CC: cnv-qe-bugs, fdeutsch
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2018-10-24 09:23:45 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description zhe peng 2018-10-24 05:41:58 UTC
Description of problem:


Version-Release number of selected component (if applicable):
OCP 3.11
CNV 1.3

How reproducible:
always

Steps to Reproduce:
1. create a preset with label and set memory to 64M
$ cat vmi-preset-small.yaml 
apiVersion: kubevirt.io/v1alpha2
kind: VirtualMachineInstancePreset
metadata:
  creationTimestamp: null
  name: vmi-preset-small
spec:
  domain:
    devices: {}
    machine:
      type: ""
    resources:
      requests:
        memory: 64M
  selector:
    matchLabels:
      kubevirt.io/vmPreset: vmi-preset-small

2.create vmi with label and set memory to 128M: 
apiVersion: kubevirt.io/v1alpha2
kind: VirtualMachineInstance
metadata:
  creationTimestamp: null
  labels:
    special: vmi-preset
    kubevirt.io/vmPreset: vmi-preset-small
  name: vmi-preset
spec:
  domain:
    devices:
      disks:
      - disk:
          bus: virtio
        name: registrydisk
        volumeName: registryvolume
    machine:
      type: ""
    resources:
      requests:
        memory: 128M
  terminationGracePeriodSeconds: 0
  volumes:
  - name: registryvolume
    registryDisk:
      image: kubevirt/cirros-registry-disk-demo:latest
status: {}


3.when vmi running, check status of vmi
$kubectl describe vmi vmi-preset

Actual results:
$kubectl describe vmi vmi-preset
Name:         vmi-preset
Namespace:    default
Labels:       kubevirt.io/nodeName=cnv-executor-zpengds13-node1.example.com
              kubevirt.io/vmPreset=vmi-preset-small
              special=vmi-preset
Annotations:  <none>
API Version:  kubevirt.io/v1alpha2
Kind:         VirtualMachineInstance
Metadata:
  Creation Timestamp:  2018-10-24T05:37:54Z
  Finalizers:
    foregroundDeleteVirtualMachine
  Generation:        1
.....

and run kubectl get event
no log like this:
Unable to apply VirtualMachineInstancePreset 'vmi-preset-small': spec.resources.requests[memory]: {{64 6} {<nil>} 64M DecimalSI} != {{128 6} {<nil>} 128M

Expected results:
in vmi should have:
Annotations:  virtualmachinepreset.kubevirt.io/vmi-preset-small=kubevirt.io/v1alpha2

in event log should have:
Unable to apply VirtualMachineInstancePreset 'vmi-preset-small': spec.resources.requests[memory]: {{64 6} {<nil>} 64M DecimalSI} != {{128 6} {<nil>} 128M

Additional info:

Comment 1 Fabian Deutsch 2018-10-24 09:23:45 UTC
In it's current form, presets do not conflict.
On epreset will win.

However, we plan to change the behavior to follow the PodPreset behavior, this however is a feature, rather than a bug.

Comment 2 zhe peng 2018-10-24 10:29:06 UTC
(In reply to Fabian Deutsch from comment #1)
> In it's current form, presets do not conflict.
> On epreset will win.
> 
> However, we plan to change the behavior to follow the PodPreset behavior,
> this however is a feature, rather than a bug.

get it, so i thought we need to update related doc in user-guide, right?
https://kubevirt.io/user-guide/#/workloads/virtual-machines/presets