Bug 2164431

Summary: Default CPU request in namespace limitrange takes precedence over the VMs configured vCPU
Product: Container Native Virtualization (CNV) Reporter: Igor Bezukh <ibezukh>
Component: VirtualizationAssignee: Igor Bezukh <ibezukh>
Status: CLOSED CURRENTRELEASE QA Contact: Denys Shchedrivyi <dshchedr>
Severity: high Docs Contact:
Priority: high    
Version: 4.10.0CC: dholler, kbidarka, nashok, sgott, zpeng
Target Milestone: ---   
Target Release: 4.10.8   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: virt-operator-container-v4.10.8-9 hco-bundle-registry-container-v4.10.8-37 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: 2152534
: 2164432 (view as bug list) Environment:
Last Closed: 2023-08-08 10:27:41 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On: 2152534    
Bug Blocks: 2164432    

Comment 1 zhe peng 2023-03-03 06:48:35 UTC
verify with build CNV-v4.10.8-37
step:
1. created LimitRange:
$cat limit.yaml
apiVersion: v1
kind: LimitRange
metadata:
  name: resource-limits
  namespace: default
spec:
  limits:
  - default:
      cpu: "2"
      memory: 4Gi
    defaultRequest:
      cpu: 100m
      memory: 4Gi
    max:
      cpu: "2"
      memory: 5Gi
    type: Container
2. created a vm with domain.cpu.cores is 10
oc get vm vm-fedora -o yaml 
...
cores: 10
sockets: 1
threads: 1

3: check vmi 
$ oc get vmi vm-fedora -o yaml
...
 cpu:
      cores: 10
      model: host-model
      sockets: 1
      threads: 1

...
  resources:
      requests:
        memory: 2Gi
...

4: check virt-launcher pod:
$ oc get pods virt-launcher-vm-fedora-spcsp -o yaml
requests:
        cpu: "1"
        devices.kubevirt.io/kvm: "1"
        devices.kubevirt.io/tun: "1"
        devices.kubevirt.io/vhost-net: "1"
        ephemeral-storage: 50M
        memory: 2437Mi

move to verified.