h2. Purpose
Target Discovery module (also referred as TD in text below) collects information about system which is selected as target for the installation. At time of being, following information is obtained:
* disk configuration (device name, vendor, size, ...)
* fdisk partition configuration (partition device name, start and size, ID, active flag) - only for x86 platform
* VTOC configuration (slice device name, start and size, flag, tag)
* information about existing Solaris instances installed on UFS filesystem (slice containing root filesystem, Solaris version)
h2. Dependencies
* libdiskmgt library - this library is consumed for most of the discovery tasks (disk, partition, slice discovery)
* libnvpair(3LIB) library - Target Discovery obtains information from libdiskmgt in format of lists of name-value pairs and uses the same model for providing collected information to the caller. libnvpair(3LIB) library is consumed for manipulating data structures stored as lists of name-value pairs.
h2. Debugging tips
h3. Using standard commands
When problem is encountered in Target Discovery module (e.g. when target disk is not found), initially it is good starting point to verify, if Solaris itself can recognize that target correctly. Standard Solaris commands can be used for this.
h4. Disks
Interactive format(1M) command or non-interactive iostat(1M), cfgadm(1M), prtconf(1M) commands might be used for obtaining information about disks Solaris can recognize on target system.
{code}
# iostat -En
{code}
{code}
# cfgadm -avl
{code}
{code}
# prtconf -Dv
{code}
h4. Partitions
Solaris fdisk(1M) command invoked in non-interactive mode gives information about fdisk partition configuration:
{code}
# fdisk -W - c0t0d0p0
{code}
However, since it can't recognize logical volumes defined within extended partition, it is also good to take a look using other non-Solaris tools, for instance Linux fdisk command.
{code}
# fdisk -l /dev/sda
{code}
h4. Slices
Either interactive tool format(1M) or non-interactive prtvtoc(1M) could be used for this.
{code}
# prtvtoc /dev/rdsk/c1t1d0s2
{code}
h3. Test drivers
After it is verified that system can recognize target correctly and that the problem is probably in Target Discovery module, it is time to take advantage of Target Discovery test drivers which were developed to test and debug Target Discovery module (libtd library).
There are two test drivers available - test_td and tdmgtst. test_td provides formatted output, but can't display information about existing Solaris instances.
Both test drivers are available in two modifications - static and dynamic. Static versions have all installer libraries statically linked (libtd, liblogsvc), so it is not necessary to have those libraries present on inspected system.
Test drivers are built as part of full build of slim_source installer gate and are bundled in SUNWinstall-test package. This package can be obtained from IPS repository. Since it is part of 'redistributable' cluster, it is not installed on system by default, but can be obtained using standard pkg(1M) command.
{code}
# pkg install SUNWinstall-test
{code}
As Target Discovery consumes libdiskmgt library for most of the tasks, it is better to let libdiskmgt work in debugging mode - then additional information is provided about what libdiskmgt is internally doing. Debug messages are posted to standard error output.
{code}
# export DM_LIBDISKMGT_DEBUG=2
{code}
Target Discovery module can be also run in debugging mode. It is accomplished by setting LS_DEST and LS_DBG_LVL environment variables.
{code}
# export LS_DBG_LVL=4
# export LS_DEST=2
{code}
Now Target Discovery will work in the verbose debug mode and all messages will be captured in /tmp/install_log file. They were intentionally redirected to that file (by setting LS_DEST variable), so that they don't collide with libdiskmgt debug messages.
Once the environment is set, we can invoke test driver itself to inspect behavior of Target Discovery module.
h3. Disks
{code}
# /opt/install-test/bin/test_td -dv 2>/tmp/libdiskmgt_debug_out
{code}
h3. Partitions
{code}
# /opt/install-test/bin/test_td -v -p all 2>/tmp/libdiskmgt_debug_out
{code}
h3. Slices
{code}
# /opt/install-test/bin/test_td -v -s all 2>/tmp/libdiskmgt_debug_out
{code}
h3. Solaris instances
{code}
# /opt/install-test/bin/tdmgtst -d
{code}
Target Discovery module (also referred as TD in text below) collects information about system which is selected as target for the installation. At time of being, following information is obtained:
* disk configuration (device name, vendor, size, ...)
* fdisk partition configuration (partition device name, start and size, ID, active flag) - only for x86 platform
* VTOC configuration (slice device name, start and size, flag, tag)
* information about existing Solaris instances installed on UFS filesystem (slice containing root filesystem, Solaris version)
h2. Dependencies
* libdiskmgt library - this library is consumed for most of the discovery tasks (disk, partition, slice discovery)
* libnvpair(3LIB) library - Target Discovery obtains information from libdiskmgt in format of lists of name-value pairs and uses the same model for providing collected information to the caller. libnvpair(3LIB) library is consumed for manipulating data structures stored as lists of name-value pairs.
h2. Debugging tips
h3. Using standard commands
When problem is encountered in Target Discovery module (e.g. when target disk is not found), initially it is good starting point to verify, if Solaris itself can recognize that target correctly. Standard Solaris commands can be used for this.
h4. Disks
Interactive format(1M) command or non-interactive iostat(1M), cfgadm(1M), prtconf(1M) commands might be used for obtaining information about disks Solaris can recognize on target system.
{code}
# iostat -En
{code}
{code}
# cfgadm -avl
{code}
{code}
# prtconf -Dv
{code}
h4. Partitions
Solaris fdisk(1M) command invoked in non-interactive mode gives information about fdisk partition configuration:
{code}
# fdisk -W - c0t0d0p0
{code}
However, since it can't recognize logical volumes defined within extended partition, it is also good to take a look using other non-Solaris tools, for instance Linux fdisk command.
{code}
# fdisk -l /dev/sda
{code}
h4. Slices
Either interactive tool format(1M) or non-interactive prtvtoc(1M) could be used for this.
{code}
# prtvtoc /dev/rdsk/c1t1d0s2
{code}
h3. Test drivers
After it is verified that system can recognize target correctly and that the problem is probably in Target Discovery module, it is time to take advantage of Target Discovery test drivers which were developed to test and debug Target Discovery module (libtd library).
There are two test drivers available - test_td and tdmgtst. test_td provides formatted output, but can't display information about existing Solaris instances.
Both test drivers are available in two modifications - static and dynamic. Static versions have all installer libraries statically linked (libtd, liblogsvc), so it is not necessary to have those libraries present on inspected system.
Test drivers are built as part of full build of slim_source installer gate and are bundled in SUNWinstall-test package. This package can be obtained from IPS repository. Since it is part of 'redistributable' cluster, it is not installed on system by default, but can be obtained using standard pkg(1M) command.
{code}
# pkg install SUNWinstall-test
{code}
As Target Discovery consumes libdiskmgt library for most of the tasks, it is better to let libdiskmgt work in debugging mode - then additional information is provided about what libdiskmgt is internally doing. Debug messages are posted to standard error output.
{code}
# export DM_LIBDISKMGT_DEBUG=2
{code}
Target Discovery module can be also run in debugging mode. It is accomplished by setting LS_DEST and LS_DBG_LVL environment variables.
{code}
# export LS_DBG_LVL=4
# export LS_DEST=2
{code}
Now Target Discovery will work in the verbose debug mode and all messages will be captured in /tmp/install_log file. They were intentionally redirected to that file (by setting LS_DEST variable), so that they don't collide with libdiskmgt debug messages.
Once the environment is set, we can invoke test driver itself to inspect behavior of Target Discovery module.
h3. Disks
{code}
# /opt/install-test/bin/test_td -dv 2>/tmp/libdiskmgt_debug_out
{code}
h3. Partitions
{code}
# /opt/install-test/bin/test_td -v -p all 2>/tmp/libdiskmgt_debug_out
{code}
h3. Slices
{code}
# /opt/install-test/bin/test_td -v -s all 2>/tmp/libdiskmgt_debug_out
{code}
h3. Solaris instances
{code}
# /opt/install-test/bin/tdmgtst -d
{code}