#208 log files should be apended instead of being overwritten
Closed: SOLVED 5 years ago Opened 5 years ago by till.

qemu is called in a way that it overwrites the logfile: https://pagure.io/standard-test-roles/blob/master/f/inventory/standard-inventory-qcow2#_142

The removes all information from previous runs when a VM is started multiple times. Also other messages such as stdout from calling qemu is overwritten.


@till Hi!

STI at https://fedoraproject.org/wiki/CI/Standard_Test_Interface

has next text:

  TEST_ARTIFACTS: The full path of an empty folder for test artifacts
...
  artifacts: The full path of an empty folder for test artifacts
...

Point is: artifacts dir should be empty before each run.
Logs are stored at artifacts dir.

If you feel that this is not appropriate, please provide your suggestions.

The problem is that qemu overwrites the log with "file,id=pts2,path=" + log,, when the logfile is opened to get the info from starting the qemu process, it is openend to append qemu_proc = subprocess.Popen(qemu_cmd, stdout=open(log, 'a'), stderr=subprocess.STDOUT) but since the qemu process is started after the log file is openend here, the output from qemu will be lost (unless qemu fails to start). If this is solved, then it should just work as I requested.

I see your point from the spec. From a developer POV it would be great to have one overview logfile for all test suites run against a certain NVR or git commit. For example like here:

https://larsu.fedorapeople.org/logs/linux-system-roles-network-pull-58-70e6922-rhel-7-20180530-161100/artifacts/test.log

AFAIU this is not possible with the current specification. Maybe it could be amended to create a subdirectory in the artifacts directory named after the playbook for each playbook? Then the logs for each playbook could go there but the artifacts dir could still contain a summary log file.

The problem is that qemu overwrites the log with "file,id=pts2,path=" + log,, when the logfile is opened to get the info from starting the qemu process, it is openend to append qemu_proc = subprocess.Popen(qemu_cmd, stdout=open(log, 'a'), stderr=subprocess.STDOUT) but since the qemu process is started after the log file is openend here, the output from qemu will be lost (unless qemu fails to start). If this is solved, then it should just work as I requested.

How about put qemu output to independent log file?

log_qemu = os.path.join(artifacts, "{0}.log.qemu{1}".format(os.path.basename(image)), qemu_instance_number)

Then we will have .qemuN suffix in log file name for each qemu process.

PR #226 should fix this issue

Metadata Update from @astepano:
- Issue assigned to astepano

5 years ago

The idea would work for me, I can test it next week.

Metadata Update from @astepano:
- Issue close_status updated to: SOLVED
- Issue status updated to: Closed (was: Open)

5 years ago

Login to comment on this ticket.

Metadata