+ Fix output when no vm on the datastore

This commit is contained in:
garnier-quentin 2015-10-09 10:51:07 +02:00
parent c39d908c15
commit eaf8b91988
1 changed files with 12 additions and 0 deletions

View File

@ -155,6 +155,12 @@ sub run {
}
}
if (scalar(@vm_array) == 0) {
$self->{manager}->{output}->output_add(severity => 'OK',
short_msg => "No virtual machines on the datastore");
return ;
}
@properties = ('name', 'runtime.connectionState', 'runtime.powerState');
my $result2 = centreon::vmware::common::get_views($self->{connector}, \@vm_array, \@properties);
return if (!defined($result2));
@ -170,6 +176,12 @@ sub run {
$ref_ids_vm{${$result2}[$i]->{mo_ref}->{value}} = ${$result2}[$i]->{name};
}
if ($multiple == 0 && scalar(@{$result2}) == 0) {
$self->{manager}->{output}->output_add(severity => 'OK',
short_msg => "No active virtual machines on the datastore");
return ;
}
# Vsphere >= 4.1
my $values = centreon::vmware::common::generic_performance_values_historic($self->{connector},
$result2,