+ Fix #39
This commit is contained in:
parent
aa839c2348
commit
a2ec6c55ab
|
@ -111,7 +111,15 @@ sub run {
|
|||
$dsName = $ds_names{$tmp_name};
|
||||
|
||||
$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)) {
|
||||
$msg =~ s/\n/ /g;
|
||||
if ($msg =~ /NoPermissionFault/i) {
|
||||
|
|
|
@ -187,8 +187,7 @@ sub get_view {
|
|||
}
|
||||
|
||||
sub search_in_datastore {
|
||||
my $obj_vmware = shift;
|
||||
my ($ds_browse, $ds_name, $query, $return) = @_;
|
||||
my (%options) = @_;
|
||||
my $result;
|
||||
|
||||
my $files = FileQueryFlags->new(fileSize => 1,
|
||||
|
@ -196,15 +195,19 @@ sub search_in_datastore {
|
|||
modification => 1,
|
||||
fileOwner => 1
|
||||
);
|
||||
my $hostdb_search_spec = HostDatastoreBrowserSearchSpec->new(details => $files,
|
||||
query => $query);
|
||||
my $hostdb_search_spec = HostDatastoreBrowserSearchSpec->new(
|
||||
details => $files,
|
||||
searchCaseInsensitive => $options{searchCaseInsensitive},
|
||||
matchPattern => $options{matchPattern},
|
||||
query => $options{query}
|
||||
);
|
||||
eval {
|
||||
$result = $ds_browse->SearchDatastoreSubFolders(datastorePath=> $ds_name,
|
||||
$result = $options{browse_ds}->SearchDatastoreSubFolders(datastorePath => $options{ds_name},
|
||||
searchSpec => $hostdb_search_spec);
|
||||
};
|
||||
if ($@) {
|
||||
return (undef, $@) if (defined($return) && $return == 1);
|
||||
vmware_error($obj_vmware, $@);
|
||||
return (undef, $@) if (defined($options{return}) && $options{return} == 1);
|
||||
vmware_error($options{connector}, $@);
|
||||
return undef;
|
||||
}
|
||||
return $result;
|
||||
|
|
Loading…
Reference in New Issue