Bug 1982026

Summary: Direct image migration fails if the source URI contains a double slash ("//")
Product: Migration Toolkit for Containers Reporter: Vincent Lours <vlours>
Component: OperatorAssignee: Pranav Gaikwad <pgaikwad>
Status: CLOSED ERRATA QA Contact: Xin jiang <xjiang>
Severity: medium Docs Contact: Avital Pinnick <apinnick>
Priority: high    
Version: 1.4.5CC: alpatel, ernelson, jmatthew, musman, prajoshi, rjohnson
Target Milestone: ---   
Target Release: 1.6.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2021-09-29 14:35:03 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:

Description Vincent Lours 2021-07-14 02:11:59 UTC
Description of problem:

A running MigPlan with some images failed to migrate part of the image.
Example:
~~~
    - destNamespace: test
      directMigration:
        name: 772df3e0-e2cf-11eb-8c21-f7a857a1d488-vw64j-rhmvv
        namespace: openshift-migration
      errors:
      - 'Invalid source name docker://default-route-openshift-image-registry.apps.example.com//test/java@sha256:4cd6e0506d53cd47a31f594a4b60ae13fecb88a816e132e995bab88a72833419: invalid reference format'
      name: java
      namespace: vision
~~~

Version-Release number of selected component (if applicable):
~~~
mtc-operator.v1.4.5                 Migration Toolkit for Containers Operator   1.4.5      mtc-operator.v1.4.4                 Succeeded
~~~

How reproducible:
N/A in global, but the "invalid reference format" error message can be replicated"

Steps to Reproduce:
1. running a skopeo inspect on a valid URI works: `skopeo inspect docker://registry.fedoraproject.org/fedora:latest | jq -r '.Name'`
2. Adding a second '//' in the URI to create the issue:
~~~
$ skopeo inspect docker://registry.fedoraproject.org//fedora:latest
FATA[0000] Error parsing image name "docker://registry.fedoraproject.org//fedora:latest": invalid reference format
~~~
3.

Actual results:
Part of the images has been transferred. Please advise why this is happening and how to fix it

Expected results:
All images should be transferred whether or not a '//' is part of the URI.

Additional info:

Comment 10 Erik Nelson 2021-07-20 16:43:36 UTC
I'm going to add this to an upcoming release to see some better validation around this and an explicit error message to ensure it's properly formatted.

Comment 11 Vincent Lours 2021-07-21 07:48:14 UTC
The KCS https://access.redhat.com/solutions/6202272 has been created to address this issue until a fix will be deployed.

Comment 13 Vincent Lours 2021-08-01 22:39:06 UTC
Hi Eric,

I've made a Pull Request to automatically solve this error, based on what was done with the "http(s)://" format: https://github.com/konveyor/mig-controller/pull/1158
Please feel free to review/approve/merge it.

I'm not sure about the process for this BZ, as I'm not part of the engineering team.
Could you please advise who should be assigned and follow up on the status.

Cheers,
Vincent

Comment 14 Erik Nelson 2021-08-11 00:53:39 UTC
Thank you for the contribution Vincent! Moving to MODIFIED as it’s shipping with the 1.6.0 release.

Comment 19 Xin jiang 2021-09-01 12:59:30 UTC
Verified with MTC 1.6.0

$ oc get migcluster source-cluster -o yaml | grep exposedRegistryPath
        f:exposedRegistryPath: {}
  exposedRegistryPath: default-route-openshift-image-registry.apps.cam-src-23950.qe.devcluster.openshift.com/

while executing migration, it automaticaly trimmed the `/` if it has '/' at the end of the "Exposed route host to image registry" value. Logs as below

$ oc logs migration-log-reader-b5dcb7974-9z2lf -c plain | grep "default-route-openshift-image-registry.apps.cam-src-23950.qe.devcluster.openshift.com/test1"
openshift-migration migration-controller-6df9dcd9cd-5vtwq mtc {"level":"info","ts":1630476792.44678,"logger":"directimagestream","msg":"[imagecopy] copying from: docker://default-route-openshift-image-registry.apps.cam-src-23950.qe.devcluster.openshift.com/test1/django-psql-persistent@sha256:2e599227f44cd027951f53d1473722004124abec1f2354d89a57f975a85dbe26","dism":"migration-ac55a-gpt7b-kbz6l","migMigration":"migration-ac55a","phase":"MigrateImageStream"}

Comment 21 errata-xmlrpc 2021-09-29 14:35:03 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: Migration Toolkit for Containers (MTC) 1.6.0 security & bugfix 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-2021:3694

Comment 22 Red Hat Bugzilla 2023-09-15 01:35:02 UTC
The needinfo request[s] on this closed bug have been removed as they have been unresolved for 365 days