Bug 2068905

Summary: virtctl guestfs incorrectly assumes image name
Product: Container Native Virtualization (CNV) Reporter: Alex Kalenyuk <akalenyu>
Component: StorageAssignee: Alex Kalenyuk <akalenyu>
Status: CLOSED ERRATA QA Contact: Kevin Alon Goldblatt <kgoldbla>
Severity: high Docs Contact:
Priority: high    
Version: 4.9.4CC: afrosi, alitke, cnv-qe-bugs, gbenhaim, vfarias, yadu
Target Milestone: ---   
Target Release: 4.9.5   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: kubevirt-virtctl-4.9.5-341, CNV v4.9.5-24 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
: 2083594 (view as bug list) Environment:
Last Closed: 2022-06-28 16:30:39 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:
Bug Depends On:    
Bug Blocks: 2083594    

Description Alex Kalenyuk 2022-03-27 12:16:27 UTC
Description of problem:
virtctl guestfs makes wrong assumption about image name and thus fails to assemble the correct guestfs pod image URL

Version-Release number of selected component (if applicable):
CNV v4.9.4

How reproducible:
100%

Steps to Reproduce:
1. Create DV
2. Attempt to create guestfs pod (`virtctl guestfs simple-dv`)

Actual results:
ErrImagePull

Expected results:
Success

Additional info:
It appears we make a wrong assumption about the image name being "libguestfs-tools" in:
https://github.com/kubevirt/kubevirt/blob/main/pkg/virtctl/guestfs/guestfs.go#L197

This results in an attempt to create a pod from a wrong URL

cnv-qe-jenkins@cnv-qe-infra-01:~/alex$ virtctl guestfs simple-dv
Use image: quay.io/openshift-cnv/libguestfs-tools@sha256:591e6d1e817bbd42b80f24b1ff9863533acc00fa6032c8abcbc38b9bb9e964ae

while the correct URL is

cnv-qe-jenkins@cnv-qe-infra-01:~/alex$ oc get csv -n openshift-cnv -o yaml | grep guestfs
    - image: quay.io/openshift-cnv/container-native-virtualization-libguestfs-tools@sha256:591e6d1e817bbd42b80f24b1ff9863533acc00fa6032c8abcbc38b9bb9e964ae

Manifests:
cnv-qe-jenkins@cnv-qe-infra-01:~/alex$ cat guestfs_dv.yaml 
apiVersion: cdi.kubevirt.io/v1beta1
kind: DataVolume
metadata:
  name: simple-dv
spec:
  source:
      http:
         url: "http://.../Fedora-Cloud-Base-34-1.2.x86_64.qcow2"
  pvc:
    storageClassName: ocs-storagecluster-ceph-rbd
    accessModes:
    - ReadWriteOnce
    resources:
      requests:
        storage: 8Gi

cnv-qe-jenkins@cnv-qe-infra-01:~/alex$ virtctl guestfs simple-dv
Use image: quay.io/openshift-cnv/libguestfs-tools@sha256:591e6d1e817bbd42b80f24b1ff9863533acc00fa6032c8abcbc38b9bb9e964ae 
The PVC has been mounted at /disk 
Waiting for container libguestfs still in pending, reason: ContainerCreating, message:  
Waiting for container libguestfs still in pending, reason: ContainerCreating, message:  
Waiting for container libguestfs still in pending, reason: ImagePullBackOff, message: Back-off pulling image "quay.io/openshift-cnv/libguestfs-tools@sha256:591e6d1e817bbd42b80f24b1ff9863533acc00fa6032c8abcbc38b9bb9e964ae" 
Waiting for container libguestfs still in pending, reason: ImagePullBackOff, message: Back-off pulling image "quay.io/openshift-cnv/libguestfs-tools@sha256:591e6d1e817bbd42b80f24b1ff9863533acc00fa6032c8abcbc38b9bb9e964ae" 
Waiting for container libguestfs still in pending, reason: ImagePullBackOff, message: Back-off pulling image "quay.io/openshift-cnv/libguestfs-tools@sha256:591e6d1e817bbd42b80f24b1ff9863533acc00fa6032c8abcbc38b9bb9e964ae"

Comment 3 Gal Ben Haim 2022-03-28 12:18:10 UTC
Just a note, it may also affect a disconnected install.

Comment 6 Kevin Alon Goldblatt 2022-05-23 16:23:47 UTC
Verified with the following code:
--------------------------------------------
oc version
Client Version: 4.10.0-202201310820.p0.g7c299f1.assembly.stream-7c299f1
Server Version: 4.9.32
Kubernetes Version: v1.22.8+c02bd9d


oc get csv -n openshift-cnv
NAME                                        DISPLAY                    VERSION    REPLACES                                    PHASE
kubevirt-hyperconverged-operator.4.9.5-29   OpenShift Virtualization   4.9.5-29   kubevirt-hyperconverged-operator.4.9.5-23   Succeeded


Verified with the following scenario:
--------------------------------------------
1. Created a datavolume dv-source
2. Ran 'virtctl guestfs dv-source >>>>>
virtctl guestfs dv-source
Use image: quay.io/openshift-cnv/container-native-virtualization-libguestfs-tools@sha256:8358df78d53bcc4679de886723f43eccaf96ddd842920842172dc2f649a73937 
The PVC has been mounted at /disk 
Waiting for container libguestfs still in pending, reason: ContainerCreating, message:  
Waiting for container libguestfs still in pending, reason: ContainerCreating, message:  
Waiting for container libguestfs still in pending, reason: ContainerCreating, message:  
Waiting for container libguestfs still in pending, reason: ContainerCreating, message:  
If you don't see a command prompt, try pressing enter.+ /bin/bash
[root@libguestfs-tools-dv-source disk]# lib
libguestfs-test-tool  libvirtd              
[root@libguestfs-tools-dv-source disk]# lib
libguestfs-test-tool  libvirtd


Moving to VERIFIED!

Comment 12 errata-xmlrpc 2022-06-28 16:30:39 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 (OpenShift Virtualization 4.9.5 Images), 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/RHEA-2022:5389