I have been using the zonestats.pl script for a while and came across an odd
issue. I have a host that has a zone stuck in the "shutting_down" state that
I haven't been able to get clean up. When zonestats runs it sees this zone
and tries to zlogin into it which has the effect of hanging up the script.

I made a modification to the script to check the zone status and if it's not
in a "running" state then skip it.

In the section that of code that gathers the zones names:
Current:
#
# Gather list of zones, their status and pool type and association.
if ($DEBUG) { print "/usr/sbin/zoneadm list -v\n"; }
open (NAMES, "/usr/sbin/zoneadm list -v|");
$znum=0;
while (<NAMES>) {
 if (/^\s+(\S+)\s+(\S+)/) {
   if ($1 eq "ID") { next; }
   $znames[$znum++]=$2;
   $zoneid{$2}=$1;
   if ($opt_N) {
     $zlen = length ($znames[$znum-1]);
     $Nmaxznamelen = $zlen > $Nmaxznamelen ? $zlen : $Nmaxznamelen;
   }
 }
}
close NAMES;

Proposed:
#
# Gather list of zones, their status and pool type and association.
if ($DEBUG) { print "/usr/sbin/zoneadm list -v\n"; }
open (NAMES, "/usr/sbin/zoneadm list -v|");
$znum=0;
while (<NAMES>) {
 if (/^\s+(\S+)\s+(\S+)*\s+(\S+)*/) {
   if ($1 eq "ID") { next; }
   *if ($3 ne "running" ) { next; }*
   $znames[$znum++]=$2;
   $zoneid{$2}=$1;
   if ($opt_N) {
     $zlen = length ($znames[$znum-1]);
     $Nmaxznamelen = $zlen > $Nmaxznamelen ? $zlen : $Nmaxznamelen;
   }
 }
}
close NAMES;


Regards,
Derek
_______________________________________________
zones-discuss mailing list
zones-discuss@opensolaris.org

Reply via email to