VMware {code} Community
jrackliffe
Hot Shot
Hot Shot
Jump to solution

Mounting a non-existent ISO

Although it doesn't throw an exception is there a way via the SOAP SDK to make sure there is an ISO when generating the IsoBackingInfo? I can basically put in non-sense and if the ISO was put in wrong the VirtualCD just appears empty.

The ISO is not necessarily in the DataStore, but may only be in the filesystem of the ESX host. I don't think that a FileQuery would work, but maybe somebody could correct that assumption.

Again no exception, but just trying to mitigate as much user error as possible.

And this needs to be via the SDK so direct filesystem calls and ssh are not possible.

0 Kudos
1 Solution

Accepted Solutions
SaranshG
Enthusiast
Enthusiast
Jump to solution

You can ensure the existence of an ISO file before mounting by using API[b]SearchDatastore_Task[/b] . You can then use FileInfo Data Object - which is a property of HostDatastoreBrowserSearchResults returned by this API to get IsoImageFileInfo of existent ISO files.

View solution in original post

0 Kudos
2 Replies
SaranshG
Enthusiast
Enthusiast
Jump to solution

You can ensure the existence of an ISO file before mounting by using API[b]SearchDatastore_Task[/b] . You can then use FileInfo Data Object - which is a property of HostDatastoreBrowserSearchResults returned by this API to get IsoImageFileInfo of existent ISO files.

0 Kudos
jrackliffe
Hot Shot
Hot Shot
Jump to solution

Thanks Saransh, looks like it will work for me. Wasn't sure if the generic search supported non-datastore queries \[i.e. empty bracket searches], but with testing it seems so!

I looked through the doco for a repeatable pattern for a "FileExist" function. Can someone point me to an efficient pattern for a FileExist?

This is the current pattern I have is:

HostDatastoreBrowserSearchSpec ss = new HostDatastoreBrowserSearchSpec();

ss.matchPattern = new string[] {""};

ss.searchCaseInsensitive = true;

ss.searchCaseInsensitiveSpecified = true;

ManagedObjectReference task = service.SearchDatastoreTask(", ss);

std monitor pattern

if(result.file != null)

return false;

else

return true;

0 Kudos