I noticed the same thing on ours.  The "remarkably comprehensive" code
is remarkably slow.  I played around with commenting some of the
FileQuery objects out before but never committed any updates.  The
VmDiskFileQuery impacts performance the most.  It can be omitted when
searching for anything other than .vmdk files.  It is needed under
some circumstances for .vmdk files because it allows vmdk disk extent
information to be returned which is used in some places.  I think
adding an if statement to check if the argument contains /\.vmdk/
should work.

I also found that the order of the *FileQuery objects makes a
difference.  I think it only uses the first one that matches, so if
VmDiskFileQuery is after FileQuery, the additional disk information is
not returned.

-Andy

On Tue, Jul 23, 2013 at 3:49 PM, Aaron Coburn <[email protected]> wrote:
> Hi, Folks,
> In the vSphere_SDK provisioning module, I have noticed that the 
> `_get_file_info` subroutine is really slow -- at least it is on my system.
>
> For example, this is called when looking for *.vmx files on the datastore of 
> running VMs. I would expect the query to take only a few seconds, but it is 
> usually several minutes before the query returns.
>
> I have done some testing and found that the sluggishness is related to the 
> 'query' parameter given to the HostDatastoreBrowserSearchSpec constructor. 
> That parameter is an array of different types of objects to query. The 
> current code appears to be remarkably comprehensive (around lines 2474 - 2525 
> of vSphere_SDK.pm):
>
> query => [
>   VmDiskFileQuery->new(...),
>   FileQuery->new(),
>   FloppyImageFileQuery->new(),
>   FolderFileQuery->new(),
>   IsoImageFileQuery->new(),
>   VmConfigFileQuery->new(),
>   VmLogFileQuery->new(),
>   VmNvramFileQuery->new(),
>   VmSnapshotFileQuery->new()]
>
> I have found that, by commenting out everything but VmDiskFileQuery, 
> FileQuery and FolderFileQuery, I reduce the query time down to a few seconds 
> (instead of minutes). Do any of you know why I would want vcld to query all 
> of those other object types?
>
> Thanks!
> Aaron C
>
>
>
> --
> Aaron Coburn
> Academic Technology Services, Amherst College
> [email protected]<mailto:[email protected]>
>
>
>
>
>
>
>

Reply via email to