Quantcast
Channel: VMware Communities : Discussion List - vRealize Orchestrator
Viewing all articles
Browse latest Browse all 6251

Size of VMDK not attached to VM?

$
0
0

I'm trying to get a list of VMDKs on a datastore along with their associated file sizes so I can attach them to a VM in a workflow.  I slightly modified the getAllVmdkFile action to return a Properties hash with filename = size.  However the size in the VcFileInfo object is null.  How do I get the size of a VMDK given the filename or how do I make it so that the VcFileInfo object has the size property populated?

 

Code:

meh = new Properties();
var fileQuery = new Array(new VcVmDiskFileQuery());
var querySpec = new VcHostDatastoreBrowserSearchSpec();
querySpec.query = fileQuery;


System.log("searching: " + u_datastore.name);
var task = u_datastore.browser.searchDatastoreSubFolders_Task("[" + u_datastore.name + "]", querySpec);
var searchResults = System.getModule("com.vmware.library.vc.basic").vim3WaitTaskEnd(task,false,5);


for (var i in searchResults) {
  for (var j in searchResults[i].file) {  System.log("found " + searchResults[i].folderPath + searchResults[i].file[j].path);  System.log("size: " + searchResults[i].file[j].fileSize);
// meh.put(searchResults[i].folderPath + searchResults[i].file[j].path, searchResults[i].file[j].fileSize);  meh.put(searchResults[i].folderPath + searchResults[i].file[j].path, 0);  }
}

Viewing all articles
Browse latest Browse all 6251

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>