Uploaded image for project: 'OpenShift Virtualization'
  1. OpenShift Virtualization
  2. CNV-77638

[4.20] Not able to enable restart button and disable pause button for a VM

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Undefined Undefined
    • CNV v4.20.0
    • None
    • CNV User Interface
    • None
    • Product / Portfolio Work
    • False
    • Hide

      None

      Show
      None
    • False
    • None
    • Moderate
    • Customer Reported
    • None

      Description of problem:

      Not able to enable restart button and disable pause button for a VM.

      Version-Release number of selected component (if applicable):

      OCP 4.20.8
      openshift-cnv 4.20.3

      How reproducible:

      Easily

      Steps to Reproduce:

      1. Create a VM from the default template like rhel 8 by a admin user in a new project(my-test). 
      2. Create a new user(testRole) and give this user the default view clusterrole of the my-test project.
      3. Create a custom role with the rules of kubevirt.io apigroups.
      
      - The testRole user has 2 roles.
      $ oc get rolebinding -o wide | grep testRole
      kubevirt.io:testRole        Role/my-vm-role                         34m   testRole                                        
      testRole-view               ClusterRole/view                        80m   testRole                                        
      $ oc get clusterrolebinding -o wide | grep testRole
      $ 
      
      - When use following custom role, the stop, restart, pause, start buttons work as expected (NonDisable01.png, NonDisable02.png).
      
      apiVersion: rbac.authorization.k8s.io/v1
      kind: Role
      metadata:
        labels:
          kubevirt.io: ""
        name: my-vm-role
      rules:
        - apiGroups:
          - subresources.kubevirt.io
          resources:
            - virtualmachineinstances/console
            - virtualmachineinstances/vnc
          verbs:
            - get
        - apiGroups:
            - subresources.kubevirt.io
          resources:
            - virtualmachines/start
            - virtualmachines/stop
            - virtualmachines/restart
            - virtualmachineinstances/pause
            - virtualmachineinstances/unpause  
          verbs:
            - update
            - put
        - apiGroups:
             - kubevirt.io
          resources:
             - virtualmachines
          verbs:
             - get
             - list
             - watch  
      
      - but if you remove virtualmachineinstances/pause and virtualmachineinstances/unpause, the restart button will disappear (DisablePause_VMon.png). The role was deleted and recreated after the change.
      
            - virtualmachines/start
            - virtualmachines/stop
            - virtualmachines/restart
            #- virtualmachineinstances/pause
            #- virtualmachineinstances/unpause
      
      - And if you remove virtualmachines/restart, the pause button will disappear(DisableRestart_VMon.png). The role was deleted and recreated after the change. Click the restart button, no respond(DisableRestart_click.png).
      
            - virtualmachines/start
            - virtualmachines/stop
            #- virtualmachines/restart
            - virtualmachineinstances/pause
            - virtualmachineinstances/unpause  
      

      Actual results:

      The actions of rules virtualmachines/restart and virtualmachineinstances/pause, virtualmachineinstances/unpause are reversed.

      Expected results:

      The actions of rules virtualmachines/restart and virtualmachineinstances/pause, virtualmachineinstances/unpause work as expected.

      Additional info:

       

        1. NonDisable01.png
          122 kB
          Lili Huang
        2. NonDisable02.png
          122 kB
          Lili Huang
        3. DisableRestart_click.png
          146 kB
          Lili Huang
        4. DisableRestart_VMon.png
          125 kB
          Lili Huang
        5. DisablePause_VMon.png
          125 kB
          Lili Huang

              upalatuc@redhat.com Ugo Palatucci
              rhn-support-lilhuang Lili Huang
              Guohua Ouyang Guohua Ouyang
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Created:
                Updated: