Bug 2083594 - virtctl guestfs incorrectly assumes image name
Summary: virtctl guestfs incorrectly assumes image name
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Container Native Virtualization (CNV)
Classification: Red Hat
Component: Storage
Version: 4.10.1
Hardware: Unspecified
OS: Unspecified
high
high
Target Milestone: ---
: 4.10.2
Assignee: Alex Kalenyuk
QA Contact: Kevin Alon Goldblatt
URL:
Whiteboard:
Depends On: 2068905
Blocks:
TreeView+ depends on / blocked
 
Reported: 2022-05-10 12:26 UTC by Yan Du
Modified: 2022-06-14 17:43 UTC (History)
8 users (show)

Fixed In Version: kubevirt-virtctl-4.10.2-499, CNV v4.10.2-1
Doc Type: If docs needed, set a value
Doc Text:
Clone Of: 2068905
Environment:
Last Closed: 2022-06-14 17:42:17 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Github kubevirt kubevirt pull 7718 0 None open [release-0.49] Manual backport of 7592 2022-05-12 18:56:46 UTC
Red Hat Product Errata RHSA-2022:5026 0 None None None 2022-06-14 17:43:15 UTC

Description Yan Du 2022-05-10 12:26:36 UTC
+++ This bug was initially created as a clone of Bug #2068905 +++

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"

--- Additional comment from Alex Kalenyuk on 2022-03-27 12:21:39 UTC ---

The hotfix efforts (v4.9.4-hotfix.2.1) helped uncover this issue which has been there for a while;
We are releasing our images on quay.io this time around as opposed to registry.redhat.io:

cnv-qe-jenkins@cnv-qe-infra-01:~/alex$ oc get csv -n openshift-cnv kubevirt-hyperconverged-operator.v4.9.4-hotfix.2.1 -o yaml | grep guestfs
  - image: quay.io/openshift-cnv/container-native-virtualization-libguestfs-tools@sha256:591e6d1e817bbd42b80f24b1ff9863533acc00fa6032c8abcbc38b9bb9e964ae
    name: registry.redhat.io/container-native-virtualization/libguestfs-tools:v4.9.3-4

For registry.redhat.io notice the image name varies:

[cnv-qe-jenkins@c01-hot-494-01-dgrbl-executor ~]$ oc get csv -n openshift-cnv kubevirt-hyperconverged-operator.v4.9.3 -o yaml | grep guestfs
  - image: registry.redhat.io/container-native-virtualization/libguestfs-tools@sha256:591e6d1e817bbd42b80f24b1ff9863533acc00fa6032c8abcbc38b9bb9e964ae
    name: registry.redhat.io/container-native-virtualization/libguestfs-tools:v4.9.3-4

Thanks to Gal Ben Haim's eagle eyes that helped debug this

--- Additional comment from Adam Litke on 2022-03-28 11:13:25 UTC ---

As a workaround I believe you can manually specify the image to use so we could document this in the release notes of the hotfix.

--- Additional comment from Gal Ben Haim on 2022-03-28 12:18:10 UTC ---

Just a note, it may also affect a disconnected install.

--- Additional comment from Vagner Farias on 2022-04-18 17:02:39 UTC ---

I think I'm seeing the same issue, but with a slightly different error message, which didn't tell me much about the real problem. I'm not sure this should be handled in a different bz, but besides fixing the wrong assumption on the image name, a better error message is needed.

vfarias@vfarias-mac ~ % virtctl guestfs -n vfarias-virtualization rhel8-ethical-opossum
unknown

vfarias@vfarias-mac ~ % virtctl guestfs --image quay.io/openshift-cnv/container-native-virtualization-libguestfs-tools@sha256:591e6d1e817bbd42b80f24b1ff9863533acc00fa6032c8abcbc38b9bb9e964ae rhel8-ethical-opossum
Use image: quay.io/openshift-cnv/container-native-virtualization-libguestfs-tools@sha256:591e6d1e817bbd42b80f24b1ff9863533acc00fa6032c8abcbc38b9bb9e964ae
The PVC has been mounted at /disk
[.. unrelated error suppressed ..]

vfarias@vfarias-mac ~ % virtctl version
Client Version: version.Info{GitVersion:"v0.49.0-119-gb7f0c6b53", GitCommit:"b7f0c6b535a00e01f4833d8746f2f9be527208f3", GitTreeState:"clean", BuildDate:"2022-04-01T07:23:21Z", GoVersion:"go1.16.12", Compiler:"gc", Platform:"darwin/amd64"}
Server Version: version.Info{GitVersion:"v0.49.0-119-gb7f0c6b53", GitCommit:"b7f0c6b535a00e01f4833d8746f2f9be527208f3", GitTreeState:"clean", BuildDate:"2022-04-01T07:24:56Z", GoVersion:"go1.16.12", Compiler:"gc", Platform:"linux/amd64"}

--- Additional comment from Alice Frosi on 2022-04-19 06:50:14 UTC ---

So the libguestfs image name is constructed by getting the registry and sha from the KubeVirt CR (https://github.com/kubevirt/kubevirt/blob/main/pkg/virtctl/guestfs/guestfs.go#L189-L210), but it always uses 'libguestfs-tools' as name.
Here, I see that we use 'container-native-virtualization-libguestfs-tools'. How is this constructed for the other container images like virt-launcher? If required I can extend the the GuestfsVersion command and be able to set also the image name, but this is information needs to be presented somewhere.

Comment 1 Kevin Alon Goldblatt 2022-05-26 11:45:12 UTC
Verified with the following code:
--------------------------------------------
oc version
Client Version: 4.10.0-202205190747.p0.g878f5a8.assembly.stream-878f5a8
Server Version: 4.10.15
Kubernetes Version: v1.23.5+3afdacb



oc get csv -n openshift-cnv
NAME                                        DISPLAY                    VERSION    REPLACES                                    PHASE
kubevirt-hyperconverged-operator.4.10.2-3   OpenShift Virtualization   4.10.2-3   kubevirt-hyperconverged-operator.4.10.2-2   Succeeded


Verified with the following scenario:
--------------------------------------------
1. Created a datavolume dv-source
2. Ran 'virtctl guestfs dv-source >>>>>
3. Was also able to run libguestfs-test-tool successfully on the mounted pvc


virtctl guestfs dv-source
Use image: quay.io/openshift-cnv/container-native-virtualization-libguestfs-tools@sha256:34f1e9020cb181a9a38df2b247f303630df6835c6d0cbc57a426484e59ca64ad 
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.+ touch /usr/local/lib/guestfs/done
+ /bin/bash

Was also able to run libguestfs-test-tool successfully on the mounted pvc

Moving to VERIFIED!

Comment 7 errata-xmlrpc 2022-06-14 17:42:17 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 (Moderate: OpenShift Virtualization 4.10.2 Images security and bug fix update), 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-2022:5026


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