Add a logs dict to the vm object where one can just throw in names and unix sockets to have the bits written out to a logfile.
Signed-off-by: Gerd Hoffmann <[email protected]> --- client/virt/kvm_vm.py | 11 +++++++++++ 1 files changed, 11 insertions(+), 0 deletions(-) diff --git a/client/virt/kvm_vm.py b/client/virt/kvm_vm.py index 8cffe2e..2096e2f 100644 --- a/client/virt/kvm_vm.py +++ b/client/virt/kvm_vm.py @@ -74,6 +74,8 @@ class VM(virt_vm.BaseVM): # } # This structure can used in usb hotplug/unplug test. self.usb_dev_dict = {} + self.logs = {} + self.logsessions = {} self.driver_type = 'kvm' self.params['driver_type_'+self.name] = self.driver_type # virtnet init depends on vm_type/driver_type being set w/in params @@ -1553,6 +1555,15 @@ class VM(virt_vm.BaseVM): output_params=("serial-%s.log" % name,), prompt=self.params.get("shell_prompt", "[\#\$]")) + for key, value in self.logs.items(): + outfile = "%s-%s.log" % (key, name) + logging.info("add log: %s" % outfile) + self.logsessions[key] = aexpect.Tail( + "nc -U %s" % value, + auto_close=False, + output_func=virt_utils.log_line, + output_params=(outfile,)) + finally: fcntl.lockf(lockfile, fcntl.LOCK_UN) lockfile.close() -- 1.7.1 _______________________________________________ Autotest mailing list [email protected] http://test.kernel.org/cgi-bin/mailman/listinfo/autotest
