Bug 1615730

Summary: VirtualMachineReplicaSet does not delete finished VMs
Product: Container Native Virtualization (CNV) Reporter: Guohua Ouyang <gouyang>
Component: VirtualizationAssignee: Roman Mohr <rmohr>
Status: CLOSED CURRENTRELEASE QA Contact: Guohua Ouyang <gouyang>
Severity: medium Docs Contact:
Priority: medium    
Version: 1.1CC: fdeutsch, fsimonce, gouyang, ipinto, rmohr, sgordon
Target Milestone: ---Keywords: Reopened
Target Release: 1.3   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: kubevirt-0.9.4-2.gd763ed8.6e00282 cnv-libvirt-container-v1.3.0-3 virt-api-container-v1.3.0-11 virt-controller-container-v1.3.0-13 virt-handler-container-v1.3.0-12 virt-launcher-container-v1.3.0-13 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2019-01-15 14:05:57 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:

Comment 4 Roman Mohr 2018-09-18 08:04:44 UTC
That's fixed here: https://github.com/kubevirt/kubevirt/pull/1237

Comment 8 Israel Pinto 2018-11-12 12:54:16 UTC
Verify with:
virtctl version
Client Version: version.Info{GitVersion:"v0.9.4", GitCommit:"6e0028292ab269f4b4b5d98b1870ca5b84a47b10", GitTreeState:"clean", BuildDate:"2018-11-07T17:08:16Z", GoVersion:"go1.9.4", Compiler:"gc", Platform:"linux/amd64"}
Server Version: version.Info{GitVersion:"v1.3.0-11-1-g3f367f7", GitCommit:"78435f76c79c97c4491fd7c0549744633c98a53d", GitTreeState:"clean", BuildDate:"2018-11-08T14:55:47Z", GoVersion:"go1.9.4", Compiler:"gc", Platform:"linux/amd64"}


Steps:
1. oc create -f replicaset.yaml                                                  
output: virtualmachineinstancereplicaset.kubevirt.io/vmi-replicaset-fedora created
2. oc adm drain cnv-executor-ipinto-node1.example.com --delete-local-data --ignore-daemonsets=true --force --pod-selector=kubevirt.io=virt-launcher                     
output:
node/cnv-executor-ipinto-node1.example.com cordoned
WARNING: Deleting pods with local storage: virt-launcher-vmi-replicaset-fedoramsgxc-lhvsk, virt-launcher-vmi-replicaset-fedorazwtnx-fqwsx; Deleting pods not managed by ReplicationController, ReplicaSet, Job, DaemonSet or StatefulSet: virt-launcher-vmi-replicaset-fedoramsgxc-lhvsk, virt-launcher-vmi-replicaset-fedorazwtnx-fqwsx
pod/virt-launcher-vmi-replicaset-fedorazwtnx-fqwsx evicted
pod/virt-launcher-vmi-replicaset-fedoramsgxc-lhvsk evicted
3. oc get vmi                                                                                                                                                           
output: 3 vmi-replicaset
NAME                         AGE
test-cache                   2d
vmi-replicaset-fedorafnzxl   9s
vmi-replicaset-fedoral69fn   9s
vmi-replicaset-fedoravmvl8   2m
4. oc delete -f replicaset.yaml                                                
output:
virtualmachineinstancereplicaset.kubevirt.io "vmi-replicaset-fedora" deleted



used yaml:

apiVersion: kubevirt.io/v1alpha2
kind: VirtualMachineInstanceReplicaSet
metadata:
  creationTimestamp: null
  name: vmi-replicaset-fedora
spec:
  replicas: 3
  selector:
    matchLabels:
      kubevirt.io/vmReplicaSet: vmi-replicaset-fedora
  template:
    metadata:
      creationTimestamp: null
      labels:
        kubevirt.io/vmReplicaSet: vmi-replicaset-fedora
    spec:
      domain:
        devices:
          disks:
          - disk:
              bus: virtio
            name: registrydisk
            volumeName: registryvolume
        machine:
          type: ""
        resources:
          requests:
            memory: 512M
      terminationGracePeriodSeconds: 0
      volumes:
      - name: registryvolume
        registryDisk:
          image: kubevirt/fedora-cloud-registry-disk-demo:latest
status: {}