+ Fix output when no vm on the datastore
This commit is contained in:
parent
c39d908c15
commit
eaf8b91988
|
@ -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,
|
||||
|
|
Loading…
Reference in New Issue