openzfsonwindows / ZFSin

OpenZFS on Windows port
https://openzfsonwindows.org
1.2k stars 69 forks source link

Logman Session creation and deletion #303

Closed vrajendra-datacore closed 3 years ago

vrajendra-datacore commented 3 years ago

This fix provides a new command trace for zfsinstaller.exe to create a logman (auto)session.

Once driver is installed, user can issue the command "zfsinstaller trace [-f Flags] [-l Levels] [-s Size] [-p PathOfETL]" to create a logman session. After reboot, the logs get collected in the path (AbsolutePathOfETL).

Also, handled are some scenarios i) If the provided Etl (path) exists already (We rename the existing etl and go ahead with provided etl file name) ii) We will not create logman session if one already exists.

The etl file size is restricted to 'SizeOfETLInMB'. When it exceeds 'SizeOfETLInMB', older logs gets removed so as to maintain the etl size to 'SizeOfETLInMB'.

The session gets deleted when the driver is uninstalled or when issued the command (zfsinstaller.exe trace -d)

One important point to note is that logman session creation/deletion requires a reboot.

Utilized getopt function from libspl library for parsing the arguments; Have also changed the order of build process for zfsinstaller project