How to setup serial console login of OpenSolaris-0906 for virsh console mode under KVM

I'll show my memorandum about setting up serial console login of OpenSolaris-0906 for virsh console mode under KVM.

Notice: This method IS NOT suitable for totally manipulate opensolaris via virsh console. This method only support to login after acomplish of booting.

Step 1. Check the serial driver is loaded.
In OpenSolaris guest,

prtconf | fgrep asy

If '(driver not attached)' are shown, using modload.

pfexec modload -p drv/asy
prtconf | fgrep asy

Check '(driver not attached)' is disappeard.

Step 2. Reconfigure ttymon.

In OpenSolaris-0906, using the 'pmadm' command for the serial login.

To check available tty definition,

pmadm -l

Possibly, the result as below,

PMTAG PMTYPE SVCTAG FLGS ID
zsmon ttymon ttya u root /dev/term/a I - /usr/bin/login - 9600 ldterm,ttcompat ttya login: - tvi925 y #
zsmon ttymon ttyb u root /dev/term/b I - /usr/bin/login - 9600 ldterm,ttcompat ttyb login: - tvi925 y #

Then, reconfigure ttya using pmadm,

pfexec pmadm -r -p zsmon -s ttya
pfexec pmadm -a -p zsmon -s ttya -i root -v `ttyadm -V` -m "`ttyadm -i 'Disabled' -l 9600 -m ldterm,ttcompat -S y -d /dev/term/a -s /usr/bin/login -T vt100`" -f u

checking reconfiguration,

pmadm -l

the result as below,

PMTAG PMTYPE SVCTAG FLGS ID
zsmon ttymon ttyb u root /dev/term/b I - /usr/bin/login - 9600 ldterm,ttcompat ttyb login: - tvi925 y #
zsmon ttymon ttya u root /dev/term/a - - /usr/bin/login - 9600 ldterm,ttcompat login: Disabled vt100 y #

Step 3. Restarting tty service

To restart tty service,

pfexec sacadm -k -p zsmon
pfexec sacadm -s -p zsmon

To check enable/starting tty service,

sacadm -l

the result shown like this,

PMTAG PMTYPE FLGS RCNT STATUS COMMAND
zsmon ttymon - 0 ENABLED /usr/lib/saf/ttymon #

or

PMTAG PMTYPE FLGS RCNT STATUS COMMAND
zsmon ttymon - 0 STARTING /usr/lib/saf/ttymon #

Step 4. Connect from KVM Host to OpenSolaris Guest.

Then virsh console command from KVM Host,

sudo virsh console

If succeed, the respond are below,

Connected to domain osol-01
Escape character is xx
login: