We've seen a case on one of our Unity arrays where the SP utilization is very unbalanced. Roughly 25-30% on one SP compared to 80-90% on the other. Some difference is expected, but not this much. One of the first things I wanted to review was trespassed lun status. As it turns out, the Unity array doesn't provide much information in the GUI regarding trespassed luns. About the only thing you can see and set is the SP owner. Also no way to force a trespass. This is all controlled by the array.

I decided to leverage the RESTful API via PERL and the REST::Client module to gather lun ownership and trespass status. I could use the CLI, but I want to move more tasks to REST going forward.

Not a lot of issues getting this done. Be sure to reference the Unity REST documentation for specifics for headers, etc.

I will point out a couple of important settings.

  • setFollow(1); #If this is not set, you'll likely get a 302 (redirect) code.
  • cookie_jar; #Required to enable cookies (via useragent). I was getting a 302 code without this set.

The URI ($geturi) below returns the specific data points I need for lun trespass/ownership ststus.

#Maps to an sp name. Gathered this data from the Unity REST guide.
%sp = ( 0 => spa, 1 => spb, 2989 => unkn );

#Authorization
$u=untyuser;
$p=untypw;
$auth = { 'Authorization' => 'Basic ' . encode_base64($u . ':' . $p) };
 
$uagt = LWP::UserAgent->new( 'ssl_opts' => { verify_hostname => 0 }, 'timeout' => 60, 'cookie_jar' => {} );
$unty = REST::Client->new( {useragent => $uagt} );
$unty->setFollow(1);
$unty->addHeader('Accept', 'application/json');
$unty->addHeader('Content-Type', 'application/json');
$unty->addHeader('X-EMC-REST-CLIENT', 'true');
#########################################################
my $geturi="https://$untyip/api/types/lun/instances".'?fields=id,defaultNode,currentNode';
 
$unty->GET("$geturi", $auth);
if ($unty->responseCode() == 200 ){
   print "  Collection success. Saving data.\n";
   $unty_resp = decode_json($unty->responseContent());
   foreach my $entry (@{$unty_resp->{entries}}){
      my $sv=$entry->{content}->{id};
      my $currnode=$entry->{content}->{currentNode};
      my $deflnode=$entry->{content}->{defaultNode};
      print "$array,$sv,$sp{$currnode},$sp{$deflnode}\n";
   }
}else{
  $respcode=$unty->responseCode();
  print "  Collection ERROR: $array returned code $respcode\n";
}

With the current and default node information I can determine tresspass status. As it turns out, I discovered most of the trespassed luns on my Unity belong to an ESX cluster with VMs driving significant workload. Digging deeper I've also discovered some zoning/pathing inconsistencies which appear to be causing the trespass issue. We are correcting this now. Stay tuned.

Comments

There are no comments on this post.

Recent Posts

Archives


Contact Cecil