Monday, February 27, 2023

How Do I Save the LDoms Configuration under Solaris?

 

 Abstract:

Under SPARC Logical Domains, the Hypervisor is actually running in the firmware of the chassis, where the Control Domain sends commands to partition the hardware underneath the OS's. The hypervisor and all settings are completely in memory... which means if there is a power outage, all virtualization configuration can be lost. The ILOM has onboard storage, to hold the LDoms configuration, when saved, and the hypervisor in the firmware is smart enough to request the configuration from the ILOM on boot, and then simultaneously boot all Logical Domains (including the Control Domain.)

List LDom Configurations

To list all Logical Domain Configurations, which were stored to the ILOM:

sun1824-cd/root# ldm list-spconfig
factory-default
@post-migration [current]
default-config
20190301
20191002
20211014
20220908

Note: in the above example, the "@post-migration" means the configuration was saved the last time someone executed a live migration onto or off of this platform, with the "-s" flag for "save config".

Save Logical Domain Configuration

To save a copy of the LDom configuration:

sun1824-cd/root# ldm add-spconfig `date +%Y%m%d`
sun1824-cd/root#

List Saved Logical Domain Configurations

The newly saved logical domain configuration  should show as the Year, Month, Day combination

sun1824-cd/root# ldm list-spconfig
factory-default
@post-migration
default-config
20190301
20191002
20211014
20220908
20230218 [current]
sun1824-cd/root#



 

Monday, February 20, 2023

How do I reset the ILOM from Solaris?

 

How do I reset the ILOM from Solaris?

Abstract:

A Solaris is comprised of an OS to run the applications under, as well as a variety of instrumentation and virtualization. A typical stack includes: ILOM or SP, CDom, LDom, Zone. If you need to reboot the SP (System Processor) or ILOM (Integrated Lights Out Management), it can be done from the base OS which is normally a Control Domain, and is non-intrusive to the applications running on the base OS (as long as the CDom is not trying to save the state of the LDoms or attempting to read-write the configuration.)

Check ILOM UpTime

The ILOM tracks it's uptime and it is available through the IPMI Tool

sun1824-cd/root# ipmitool sunoem cli
Connected. Use ^D to exit.
-> 

-> show /SP/clock

 /SP/clock
    Targets:

    Properties:
        datetime = Fri Feb 17 22:47:14 2023
        timezone = EST (America/New_York)
        uptime = 34 days, 14:45:14
        usentpserver = enabled

    Commands:
        cd
        set
        show

 
-> exit
Disconnected

Rebooting the ILOM

The System Processor Card can be rebooted from the base Solaris OS acting as a Control Domain via:

sun1824-cd/root# PATH=/opt/ipmitool/sbin/ipmitool:/usr/sbin
sun1824-cd/root# export PATH
sun1824-cd/root# ipmitool sunoem cli
Connected. Use ^D to exit.
-> reset /SP
Are you sure you want to reset /SP (y/n)? y
Performing reset on /SP

-> exit
Disconnected

Verify ILOM Reboot

The ILOM reboot can be verified by using the IPMI tool.

sun1824-cd/root# ipmitool sunoem cli
Connected. Use ^D to exit.
-> show /SP/clock

 /SP/clock
    Targets:

    Properties:
        datetime = Sat Feb 18 22:49:25 2023
        timezone = EST (America/New_York)
        uptime = 0 days, 00:07:43
        usentpserver = enabled

    Commands:
        cd
        set
        show

-> exit
Disconnected
sun1824-cd/root#





 

 

Friday, February 17, 2023

NAWK: How can I get uptime & boot time in Solaris?

 

[Solaris Logo, courtesy former Sun Microsystems, Oracle]

Abstract:

This is part of a small article series on lesser known uses of UNIX nawk. Why nawk? This POSIX language has not changed in decades, gets very few code changes, and is mostly bug free in any reasonable operating system. Scripts written in POSIX nawk will basically run, forever. Master this simple language, and there is virtually nothing that can not be done.

What is AWK?

Awk is a scriptable text language, originally written by the authors of UNIX and C: Alfred Aho, Peter Weinberger, and Brian Kernighan. It's concepts are managing Page Header (the BEGIN clause), Page Body (multiple Pattern -> Action clauses), and Page Footer (the END clause.) 

Awk is suitable for building & manipulating any textual or markup text, which is page oriented (i.e. SQL output, Text, Adobe PostScript, Adobe FrameMaker portable maker format, HTML, XML, Microsoft RTF, Microsoft CSV, etc.)

NAWK: How can I get uptime & boot time in Solaris?

The CTime or Epoch Time can be easily retrieved from nawk using the "srand()" function, if there is no seed passed into the function. This number represents the seconds since 00:00:00 on January 1, 1970.

The boot time is the CTime/Epoch Time [in seconds], at the time of the last OS boot, and can be retrieved from "kstat". Simple subtraction and division can provide reasonably accurate conversions.

The following examples show: CTime, Boot Time, Seconds Difference, Minutes Difference, Hours Difference, Days Difference.

Example 1 - Solaris 10:

Solaris10/root# kstat -n system_misc | nawk '
BEGIN { CTime=srand() };
/boot_time/ { BTime=$2; Diff=CTime-BTime };
END { printf "CTime:\t%s\nBTime:\t%s\nScDif:\t%s\nMnDif:\t%s\nHrDif:\t%s\nDyDif:\t%s\n",
      CTime,BTime,Diff,Diff/60,Diff/60/60,Diff/60/60/24 }'

CTime:  1676683570
BTime:  1676106161
ScDif:  577409
MnDif:  9623.48
HrDif:  160.391
DyDif:  6.68297

Example 2 - Solaris 11:

Solaris 11/root# kstat -n system_misc | nawk '
BEGIN { CTime=srand() };
/boot_time/ { BTime=$2; Diff=CTime-BTime };
END { printf "CTime:\t%s\nBTime:\t%s\nScDif:\t%s\nMnDif:\t%s\nHrDif:\t%s\nDyDif:\t%s\n",
      CTime,BTime,Diff,Diff/60,Diff/60/60,Diff/60/60/24 }'

CTime:  1676683533
BTime:  1662691183
SecDif: 13992350
MinDif: 233206
HrDif:  3886.76
DayDif: 161.948

Does the code look similar? It should, Solaris 10 and Solaris 11 are POSIX compliant.

What about GAWK?

GNU's Awk is not 100% compatible with POSIX Nawk, which is a huge disappointment. I have seen code, which worked for decades, never able to run unchanged under GNU's awk.