Bug 2079252

Summary: [MTC] Rsync options logs not visible in log-reader pod
Product: Migration Toolkit for Containers Reporter: ssingla
Component: ControllerAssignee: Jaydip Gabani <jgabani>
Status: CLOSED ERRATA QA Contact: mohamed <midays>
Severity: medium Docs Contact: Richard Hoch <rhoch>
Priority: medium    
Version: 1.7.1CC: ernelson, jgabani, midays, rjohnson
Target Milestone: ---Keywords: Regression
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:53:11 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 ssingla 2022-04-27 09:45:33 UTC
Description of problem: When we try to set any valid/invalid rsync options in the migrationcontroller, the log-reader is not showing any logs regarding the invalid options or about the rsync command being used

Severity: Medium

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

Steps to reproduce:
1. Create a new project and PVC inside that project 
$ oc new-project ocp-40342-invalidrsyncopts

$ cat <<EOF | oc create -f -
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  namespace: ocp-40342-invalidrsyncopts
  name: test-data
spec:
  accessModes:
  - ReadWriteOnce
  resources:
	requests:
  	storage: 1Gi
EOF

2. Create deployment for the PVC to be Bound
cat <<EOF | oc create -f -
apiVersion:  apps/v1
kind: Deployment
metadata:
  labels:
	app: pod-test
  name: pod-test
  namespace: ocp-40342-invalidrsyncopts
spec:
  replicas:  1
  selector:
	matchLabels:
  	app: resize-test
  template:
	metadata:
  	labels:
    	app: resize-test
	spec:
  	containers:
  	- name: podtest
    	imagePullPolicy: Always
    	image: alpine
    	command: [ "/bin/sh", "-c", "--" ]
    	args: [ "while true; do sleep 30; done;" ]
    	restartPolicy: Never
    	volumeMounts:
    	- name: testvolume
      	mountPath: /data/test
  	volumes:
  	- name: testvolume
    	persistentVolumeClaim:
      	claimName: test-data
EOF

3. Patch the migration controller using one valid and one invalid rsync option
oc -n openshift-migration patch migrationcontroller migration-controller  -p '{"spec":{"rsync_opt_extras": "--myextraoption;semicolon", "rsync_opt_bwlimit": "220"}  }' --type='merge';

4. Create the migplan and execute the migration


Actual Result: Log-reader pod is not showing any logs  

Expected Result: Log-reader pod should be having logs regarding new rsync options.  
$ oc -n openshift-migration logs $(oc get pods -l logreader=mig -oname) -c plain |grep semicolon | grep -i invalid

migration-controller-7dd95b5d4-8t4tr mtc {"level":"info","ts":1615996033.166493,"logger":"direct|p9m2n","msg":"Invalid Rsync extra option passed: --myextraoption;semicolon","direct":"openshift-migration/bb42e800-8736-11eb-9e96-c3b93930310e-zr4lf"}

- The command should use the other valid option

$ oc -n openshift-migration logs $(oc get pods -l logreader=mig -oname) -c plain |grep bwlimit=220

migration-controller-7dd95b5d4-8t4tr mtc {"level":"info","ts":1615996033.1665113,"logger":"direct|p9m2n","msg":"Using Rsync command [rsync --bwlimit=220 --archive --delete --recursive --hard-links --partial --info=COPY2,DEL2,REMOVE2,SKIP2,FLIST2,PROGRESS2,STATS2 --human-readable --port 2222 --log-file /dev/stdout /mnt/ocp-40342-invalidrsyncopts/test-data/ rsync://root.248.87/test-data]","direct":"openshift-migration/bb42e800-8736-11eb-9e96-c3b93930310e-zr4lf"}

Comment 1 Erik Nelson 2022-04-28 12:35:08 UTC
Is this a regression that worked in 1.7.0?

I need to know for z stream releases whether or not the z stream release specifically introduced the regression or if it's a regression compared to a prior Y feature release like 1.6.

Comment 2 ssingla 2022-04-28 12:51:35 UTC
@ernelson yes, the logs were visible in 1.7.0, but the test case is failing in 1.7.1

Comment 3 Jaydip Gabani 2022-05-10 16:38:08 UTC
This PR fixes this bug - https://github.com/konveyor/mig-log-reader/pull/28

Result - 

$ oc -n openshift-migration logs $(oc get pods -l logreader=mig -oname) -c plain |grep semicolon | grep -i invalid
openshift-migration migration-controller-7c8b75f6db-sq6pd mtc {"level":"info","ts":1652198448.6757553,"logger":"directvolume","msg":"Invalid Rsync extra option passed","dvm":"migration-4d8b8-5mz6v","migMigration":"migration-4d8b8","option":"--myextraoption;semicolon"}



In my environment, I am  not seeing the below log statement in respective migration controller pod, can you share the source and destination MTC version and kind of migration you are running that generates the below log message @ssingla ?

migration-controller-7dd95b5d4-8t4tr mtc {"level":"info","ts":1615996033.1665113,"logger":"direct|p9m2n","msg":"Using Rsync command [rsync --bwlimit=220 --archive --delete --recursive --hard-links --partial --info=COPY2,DEL2,REMOVE2,SKIP2,FLIST2,PROGRESS2,STATS2 --human-readable --port 2222 --log-file /dev/stdout /mnt/ocp-40342-invalidrsyncopts/test-data/ rsync://root.248.87/test-data]","direct":"openshift-migration/bb42e800-8736-11eb-9e96-c3b93930310e-zr4lf"}

Comment 12 mohamed 2022-06-21 12:54:32 UTC
Verified using MTC 1.7.2 prestage / openshift-migration-operator-metadata-container-v1.7.2-15

Comment 18 errata-xmlrpc 2022-07-01 09:53:11 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