Fix empty for NasDatastores and type in list

This commit is contained in:
Quentin Garnier 2015-01-27 15:42:02 +01:00
parent 895f24100c
commit 2639799984
2 changed files with 13 additions and 3 deletions

View File

@ -96,6 +96,7 @@ sub run {
#my %uuid_list = (); #my %uuid_list = ();
my %disk_name = (); my %disk_name = ();
my %datastore_lun = (); my %datastore_lun = ();
my $ds_checked = 0;
foreach (@$result) { foreach (@$result) {
next if (centreon::esxd::common::datastore_state(connector => $self->{obj_esxd}, next if (centreon::esxd::common::datastore_state(connector => $self->{obj_esxd},
name => $_->{'summary.name'}, name => $_->{'summary.name'},
@ -106,6 +107,7 @@ sub run {
if ($_->info->isa('VmfsDatastoreInfo')) { if ($_->info->isa('VmfsDatastoreInfo')) {
#$uuid_list{$_->volume->uuid} = $_->volume->name; #$uuid_list{$_->volume->uuid} = $_->volume->name;
# Not need. We are on Datastore level (not LUN level) # Not need. We are on Datastore level (not LUN level)
$ds_checked = 1;
foreach my $extent (@{$_->info->vmfs->extent}) { foreach my $extent (@{$_->info->vmfs->extent}) {
$disk_name{$extent->diskName} = $_->info->vmfs->name; $disk_name{$extent->diskName} = $_->info->vmfs->name;
if (!defined($datastore_lun{$_->info->vmfs->name})) { if (!defined($datastore_lun{$_->info->vmfs->name})) {
@ -118,6 +120,12 @@ sub run {
#} #}
} }
if ($ds_checked == 0) {
$self->{manager}->{output}->output_add(severity => 'UNKNOWN',
short_msg => "No Vmfs datastore(s) checked. Cannot get iops from Nas datastore(s)");
return ;
}
my @vm_array = (); my @vm_array = ();
my %added_vm = (); my %added_vm = ();
foreach my $entity_view (@$result) { foreach my $entity_view (@$result) {

View File

@ -72,11 +72,13 @@ sub run {
foreach my $datastore (@$result) { foreach my $datastore (@$result) {
if (defined($self->{disco_show})) { if (defined($self->{disco_show})) {
$self->{manager}->{output}->add_disco_entry(name => $datastore->summary->name, $self->{manager}->{output}->add_disco_entry(name => $datastore->summary->name,
accessible => $datastore->summary->accessible); accessible => $datastore->summary->accessible,
type => $datastore->summary->type);
} else { } else {
$self->{manager}->{output}->output_add(long_msg => sprintf(" %s [%s]", $self->{manager}->{output}->output_add(long_msg => sprintf(" %s [%s] [%s]",
$datastore->summary->name, $datastore->summary->name,
$datastore->summary->accessible)); $datastore->summary->accessible,
$datastore->summary->type));
} }
} }