mirror of
https://github.com/centreon/centreon-plugins.git
synced 2025-07-31 01:24:35 +02:00
+ Fix #39
This commit is contained in:
parent
aa839c2348
commit
a2ec6c55ab
@ -111,7 +111,15 @@ sub run {
|
|||||||
$dsName = $ds_names{$tmp_name};
|
$dsName = $ds_names{$tmp_name};
|
||||||
|
|
||||||
$self->{manager}->{output}->output_add(long_msg => "Checking datastore '$dsName':");
|
$self->{manager}->{output}->output_add(long_msg => "Checking datastore '$dsName':");
|
||||||
my ($snapshots, $msg) = centreon::vmware::common::search_in_datastore($self->{connector}, $browse_ds, '[' . $dsName . ']', [VmSnapshotFileQuery->new()], 1);
|
my ($snapshots, $msg) = centreon::vmware::common::search_in_datastore(
|
||||||
|
connector => $self->{connector},
|
||||||
|
browse_ds => $browse_ds,
|
||||||
|
ds_name => '[' . $dsName . ']',
|
||||||
|
matchPattern => [ "*.vmsn", "*.vmsd", "*-000*.vmdk", "*-000*delta.vmdk" ],
|
||||||
|
searchCaseInsensitive => 1,
|
||||||
|
query => [ FileQuery->new()],
|
||||||
|
return => 1
|
||||||
|
);
|
||||||
if (!defined($snapshots)) {
|
if (!defined($snapshots)) {
|
||||||
$msg =~ s/\n/ /g;
|
$msg =~ s/\n/ /g;
|
||||||
if ($msg =~ /NoPermissionFault/i) {
|
if ($msg =~ /NoPermissionFault/i) {
|
||||||
|
@ -187,8 +187,7 @@ sub get_view {
|
|||||||
}
|
}
|
||||||
|
|
||||||
sub search_in_datastore {
|
sub search_in_datastore {
|
||||||
my $obj_vmware = shift;
|
my (%options) = @_;
|
||||||
my ($ds_browse, $ds_name, $query, $return) = @_;
|
|
||||||
my $result;
|
my $result;
|
||||||
|
|
||||||
my $files = FileQueryFlags->new(fileSize => 1,
|
my $files = FileQueryFlags->new(fileSize => 1,
|
||||||
@ -196,15 +195,19 @@ sub search_in_datastore {
|
|||||||
modification => 1,
|
modification => 1,
|
||||||
fileOwner => 1
|
fileOwner => 1
|
||||||
);
|
);
|
||||||
my $hostdb_search_spec = HostDatastoreBrowserSearchSpec->new(details => $files,
|
my $hostdb_search_spec = HostDatastoreBrowserSearchSpec->new(
|
||||||
query => $query);
|
details => $files,
|
||||||
|
searchCaseInsensitive => $options{searchCaseInsensitive},
|
||||||
|
matchPattern => $options{matchPattern},
|
||||||
|
query => $options{query}
|
||||||
|
);
|
||||||
eval {
|
eval {
|
||||||
$result = $ds_browse->SearchDatastoreSubFolders(datastorePath=> $ds_name,
|
$result = $options{browse_ds}->SearchDatastoreSubFolders(datastorePath => $options{ds_name},
|
||||||
searchSpec=>$hostdb_search_spec);
|
searchSpec => $hostdb_search_spec);
|
||||||
};
|
};
|
||||||
if ($@) {
|
if ($@) {
|
||||||
return (undef, $@) if (defined($return) && $return == 1);
|
return (undef, $@) if (defined($options{return}) && $options{return} == 1);
|
||||||
vmware_error($obj_vmware, $@);
|
vmware_error($options{connector}, $@);
|
||||||
return undef;
|
return undef;
|
||||||
}
|
}
|
||||||
return $result;
|
return $result;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user