Tuesday, September 27, 2011

hpacucli: Error: No controllers detected. with hpsa and SmartArray P410i

I have encountered a fucking weird problem with hpacucli (HP utility for their RAID controllers) on ProLiant DL360 G7 or whatever. The controller was HP SmartArray P410i and the problem was simple:

root@XYZ:~# hpacucli 
HP Array Configuration Utility CLI 8.70-8.0
Detecting Controllers...Done.
Type "help" for a list of supported commands.
Type "exit" to close the console.

=> ctrl all show

Error: No controllers detected.

The solution is: Load the sg driver and that's it:

root@XYZ:~# modprobe sg
root@XYZ:~# hpacucli 
HP Array Configuration Utility CLI 8.70-8.0
Detecting Controllers...Done.
Type "help" for a list of supported commands.
Type "exit" to close the console.

=> ctrl all show

Smart Array P410i in Slot 0 (Embedded)    (sn: 500143801630C980)

Sunday, September 18, 2011

Moose (a postmodern thing in Perl, or whatever) and circular reference+inheritence

Now speaking of Moose, the postmodern object system in Perl 5, taken from Perl 6, chewed, digested and... Whatever:-) Let's assume I have a class Animal like that:

package Animal;
use Moose;
use Animal::Dog;
use Animal::Cat;

has 'type' => (is=>'ro', isa=>'Str');

sub make_noise { print "Making noise."; }

sub specify {
  my $self = shift;

  return Animal::Dog->new({type=>$self->type()}) if($self->type() eq 'dog');
  return Animal::Cat->new({type=>$self->type()}) if($self->type() eq 'cat');
  return $self;
}

And two subclasses:

package Animal::Dog;
use Moose;
extends 'Animal';

override 'make_noise' => sub { print "Wuf!"; }



package Animal::Cat;
use Moose;
extends 'Animal';

override 'make_noise' => sub { print "Meow!"; }


It simply does not work. You will get some fucking strange message that the first override in the Animal::Cat failed (TODO: Add here the real message...) and I can understand why: In order to compile the Animal class it has to use (=load and compile) the Animal::Dog and Animal::Cat.

Any way around it? To use something like Factory design pattern known from Java. But, does it really mean I can not use any subclass in a superclass with Moose? Is it a feature or a bug?:-)

Thursday, September 8, 2011

Build environment for OpenIndiana

Just a quick post - I wanted to build few things like Nagios NRPE, few Perl modules with C bindings etc. So I needed to install toolchain, compiler (rather Sun Studio than gcc) etc.

The easy way is:

pkg install SUNWcvs SUNWsvn SUNWarc SUNWj6dmo SUNWj6dev SUNWj6dmx SUNWj6dvx \
SUNWj6cfg SUNWj6rtx SUNWj6man SUNWgnu-automake-19 SUNWgnu-automake-110 SUNWaconf \
SUNWmercurial SUNWlibtool ss-dev SUNWsfwhea SUNWhea SUNWxwinc SUNWxorg-headers \
SUNWi2cs SUNWgpch SUNWgnome-common-devel SUNWgmake SUNWbison SUNWflexlex

pkg install SUNWcvs SUNWsvn SUNWarc SUNWj6dmo SUNWj6dev SUNWj6dmx SUNWj6dvx \
SUNWj6cfg SUNWj6rtx SUNWj6man SUNWgnu-automake-19 SUNWgnu-automake-110 SUNWaconf \
SUNWmercurial SUNWlibtool ss-dev SUNWsfwhea SUNWhea SUNWxorg-headers SUNWi2cs \
SUNWgpch SUNWgnome-common-devel SUNWgmake SUNWbison SUNWflexlex

pkg install developer/sunstudio12u1