Bug 1832179 - [virt] VM with runStrategy attribute (instead of 'running' attribute) does not have 'RUNNING' state in cli
Summary: [virt] VM with runStrategy attribute (instead of 'running' attribute) does no...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Container Native Virtualization (CNV)
Classification: Red Hat
Component: Virtualization
Version: 2.3.0
Hardware: Unspecified
OS: Unspecified
unspecified
high
Target Milestone: ---
: 2.4.0
Assignee: Igor Bezukh
QA Contact: Ruth Netser
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2020-05-06 09:35 UTC by Ruth Netser
Modified: 2020-07-28 19:10 UTC (History)
4 users (show)

Fixed In Version: virt-operator-container-v2.4.0-45 hco-bundle-registry-container-v2.3.0-300
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2020-07-28 19:10:05 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)
VM overview screen (72.44 KB, image/png)
2020-05-06 09:35 UTC, Ruth Netser
no flags Details


Links
System ID Private Priority Status Summary Last Updated
Github kubevirt kubevirt pull 3414 0 None closed Fix inconsistency in VM CRD CLI output 2020-08-25 22:14:36 UTC
Red Hat Product Errata RHSA-2020:3194 0 None None None 2020-07-28 19:10:21 UTC

Description Ruth Netser 2020-05-06 09:35:51 UTC
Created attachment 1685606 [details]
VM overview screen

Description of problem:
A VM with runStrategy=Always has a running VMI but:
1. In cli 'RUNNING' column is empty
2. In the UI - the VM status is 'Stopping'


Version-Release number of selected component (if applicable):
OCP 4.4, CNV 2.3

How reproducible:
100%

Steps to Reproduce:
1. Create a VM with container disk and runStrategy: Always
2. Check VM status in CLI
3.Check VM status in UI

Actual results:
1. In cli 'RUNNING' column is empty

$ oc get vm,vmi -A
NAMESPACE                                       NAME                                                AGE   RUNNING   VOLUME
virt-general-vm-lifecycle-test-vm-run-strateg   virtualmachine.kubevirt.io/vm-with-container-disk   20m             

NAMESPACE                                       NAME                                                        AGE   PHASE     IP            NODENAME
virt-general-vm-lifecycle-test-vm-run-strateg   virtualmachineinstance.kubevirt.io/vm-with-container-disk   20m   Running   10.0.2.2/24   host-172-16-0-22


2. In the UI - the VM status is 'Stopping'; see attached screenshot

Expected results:
Correct VM status should be displayed (running).

Additional info:
I guess that this is caused by the fact that the information is extracted from 'running' element in the VM (?)
If so, this is problematic as 'runStrategy' and 'running' cannot coexist.

=========== VM yaml ===========
$ oc get vm vm-with-container-disk -n virt-general-vm-lifecycle-test-vm-run-strateg -oyaml
apiVersion: kubevirt.io/v1alpha3
kind: VirtualMachine
metadata:
  annotations:
    kubevirt.io/latest-observed-api-version: v1alpha3
    kubevirt.io/storage-observed-api-version: v1alpha3
  creationTimestamp: "2020-05-06T09:10:35Z"
  generation: 6
  labels:
    kubevirt.io/vm: vm-with-container-disk
  name: vm-with-container-disk
  namespace: virt-general-vm-lifecycle-test-vm-run-strateg
  resourceVersion: "1561505"
  selfLink: /apis/kubevirt.io/v1alpha3/namespaces/virt-general-vm-lifecycle-test-vm-run-strateg/virtualmachines/vm-with-container-disk
  uid: a5ba4d57-18e5-4db9-9e99-e6520702edf8
spec:
  runStrategy: Always
  template:
    metadata:
      annotations:
        ansible: '{"ansible_user": "fedora", "ansible_ssh_pass": "fedora", "ansible_become":
          true, "ansible_become_method": "sudo"}'
      creationTimestamp: null
      labels:
        kubevirt.io/domain: vm-with-container-disk
        kubevirt.io/vm: vm-with-container-disk
    spec:
      domain:
        cpu:
          cores: 1
        devices:
          disks:
          - disk:
              bus: virtio
            name: containerdisk
          interfaces:
          - masquerade: {}
            name: default
          rng: {}
        machine:
          type: q35
        resources:
          requests:
            memory: 1Gi
      networks:
      - name: default
        pod: {}
      terminationGracePeriodSeconds: 0
      volumes:
      - containerDisk:
          image: quay.io/redhat/cnv-tests-fedora-staging:31
        name: containerdisk
status:
  created: true

Comment 1 sgott 2020-05-06 12:30:23 UTC
Tomas, I suspect two similar bugs got rolled into one here. How does the UI obtain/determine the status of a VM?

Igor, I can reproduce this on the command line. It seems to apply with RunStrategy is used as the client is literally reporting "Running" (which is in fact nil). Can you take a look at that?

Comment 2 Tomas Jelinek 2020-05-11 14:21:33 UTC
> Tomas, I suspect two similar bugs got rolled into one here. How does the UI obtain/determine the status of a VM?

a long answer is in code: https://github.com/openshift/console/blob/master/frontend/packages/kubevirt-plugin/src/statuses/vm/vm-status.ts#L308

the tl;dr version is status.phase

Comment 3 Igor Bezukh 2020-05-12 07:01:41 UTC
OK, looks like we have 2 different issues. Following my conversation with David Vossel I will bind the RUNNING column to the status.ready field of the VM resource. Currently the problem is that the status field is not immediately created upon VM instance creation. I will try to figure that out.

Comment 4 Ruth Netser 2020-05-12 07:42:35 UTC
I created https://bugzilla.redhat.com/show_bug.cgi?id=1834671 for the UI

Comment 5 Igor Bezukh 2020-05-14 07:05:44 UTC
Submitted PR in U/S

https://github.com/kubevirt/kubevirt/pull/3414

Comment 6 Igor Bezukh 2020-05-21 14:39:17 UTC
We have made a decision to remove the RUNNING column from the output of `oc get vm`
Later on we will introduce a proper column. Currently you can rely on the status of the corresponding VMI of the created VM. If VMI does not exist for the VM then you can assume the VM is stopped.
If you will run `oc get wm -owide` you will notice the CREATED column which indicates whether the VMI was created for the particular VM.

Comment 7 Ruth Netser 2020-05-26 10:51:46 UTC
To add mote info:
A stopped VM with runStrategy: Manual cannot be started from the UI.
The VM status is either 'Unknown' or 'VM error'

Comment 8 Ruth Netser 2020-05-26 10:54:14 UTC
(In reply to Ruth Netser from comment #7)
> To add mote info:
> A stopped VM with runStrategy: Manual cannot be started from the UI.
> The VM status is either 'Unknown' or 'VM error'

Please ignore my last comment

Comment 10 Igor Bezukh 2020-06-03 13:18:34 UTC
Upstream PR that needs to be merged to release-0.29 : https://github.com/kubevirt/kubevirt/pull/3467

Comment 11 Israel Pinto 2020-07-01 07:15:45 UTC
Verify no RUNNING status on VM
# oc get vm -n default 
NAME                AGE   VOLUME
fedora31            42h   
fedora31-1          41h   
vk-fedora-sriov     21h   
vk-fedora-sriov-1   19h   
vm-fedora-cdisk     46h   

Kubevirt: v0.30.1

Comment 14 errata-xmlrpc 2020-07-28 19:10:05 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHSA-2020:3194


Note You need to log in before you can comment on or make changes to this bug.