Bug 2056962

Summary: [MTC UI] UI shows the wrong migration type info after changing the target namespace
Product: Migration Toolkit for Containers Reporter: Prasad Joshi <prajoshi>
Component: UIAssignee: Mike Turley <mturley>
Status: CLOSED ERRATA QA Contact: Prasad Joshi <prajoshi>
Severity: low Docs Contact: Richard Hoch <rhoch>
Priority: low    
Version: 1.7.0CC: ernelson, rjohnson
Target Milestone: ---   
Target Release: 1.7.2   
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: 2022-07-01 09:52:59 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 Prasad Joshi 2022-02-22 13:05:06 UTC
Description of problem: While creating an intra-cluster state migration plan, change the target namespace value to the same as source. UI is showing migration type as a state-migration but from backend it’s showing it as storage class conversion.


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


How reproducible: Always


Steps to Reproduce: 
1. Create an empty project in source cluster
$ oc new-project test
2. Login to the MTC UI and Click on "Create migplan" button
3. Enter the plan name
4. Select migration type as a "State migration"
5. Select target and source cluster as a same
6. On the namespace page click on the edit button(Pencil Icon) and change the target namespace value to similar as source.
7. Click on Next and create a migplan


Actual results: Backend is treating this plan as a storageclass conversion but the UI is showing the migration type as a state migration. 


Expected results: UI should not allow us to change/edit the target namespace value which is equal to source namespace. 


Additional info: 
$ oc get migplan test -o yaml
apiVersion: migration.openshift.io/v1alpha1
kind: MigPlan
metadata:
  annotations:
    migration.openshift.io/selected-migplan-type: state
  name: test
  namespace: openshift-migration
spec:
  destMigClusterRef:
    name: source-cluster
    namespace: openshift-migration
  migStorageRef:
    name: automatic
    namespace: openshift-migration
  namespaces:
  - ocp-32834-pvc-terminating:ocp-32834-pvc-terminating
  srcMigClusterRef:
    name: source-cluster
    namespace: openshift-migration
status:
  conditions:
  - category: Advisory
    lastTransitionTime: "2022-02-22T12:36:35Z"
    message: This is an intra-cluster migration plan and none of the source namespaces are mapped to different destination namespaces. This plan can only be used for Storage Conversion.
    reason: StorageConversionPlan
    status: "True"
    type: MigrationTypeIdentified
  - category: Required
    lastTransitionTime: "2022-02-22T12:36:36Z"
    message: The `persistentVolumes` list has been updated with discovered PVs.
    reason: Done
    status: "True"
    type: PvsDiscovered
  - category: Required
    lastTransitionTime: "2022-02-22T12:36:36Z"
    message: The storage resources have been created.
    reason: Done
    status: "True"
    type: StorageEnsured
  - category: Required
    lastTransitionTime: "2022-02-22T12:36:36Z"
    message: The migration plan is ready.
    status: "True"
    type: Ready
  destStorageClasses:
  - accessModes:
    - ReadWriteOnce
    default: true
    name: gp2
    provisioner: kubernetes.io/aws-ebs
  excludedResources:
  - imagetags
  - templateinstances
  - clusterserviceversions
  - packagemanifests
  - subscriptions
  - servicebrokers
  - servicebindings
  - serviceclasses
  - serviceinstances
  - serviceplans
  - operatorgroups
  - events
  - events.events.k8s.io
  - rolebindings.authorization.openshift.io
  observedDigest: e97b7e5e0e9393493fa3ffb090f69dcae0201b10c34382305e5a15f2f3efc1f4
  srcStorageClasses:
  - accessModes:
    - ReadWriteOnce
    default: true
    name: gp2
    provisioner: kubernetes.io/aws-ebs

Comment 5 Prasad Joshi 2022-06-22 08:14:05 UTC
Verified with MTC 1.7.2 (Stage)

UI is not allowing target namespace as source. I see the below warning under the target namespace section when source and target namespace name is same.

"""
Target namespace name cannot be the same as source namespace name. Enter a unique name for this target namespace.
"""

Moving this to verified status.

Comment 11 errata-xmlrpc 2022-07-01 09:52:59 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.7.2 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:5483