List<ObjectContent> ocs = _context.getService().retrieveProperties(
_context.getPropertyCollector(), pfSpecArr);
assert(ocs != null);
String vmName = null;
VirtualMachineFileInfo fileInfo = null;
assert(ocs.size() == 1);
for(ObjectContent oc : ocs) {
List<DynamicProperty> props = oc.getPropSet();
if(props != null) {
assert(props.size() == 2);
for(DynamicProperty prop : props) {
if(prop.getName().equals("name")) {
vmName = prop.getVal().toString();
} else {
fileInfo = (VirtualMachineFileInfo)prop.getVal();
}
}
}
}
assert(vmName != null);
assert(fileInfo != null);
// .vmsd file exists at the same directory of .vmx file
DatastoreFile vmxFile = new DatastoreFile(fileInfo.getVmPathName());
return vmxFile.getCompanionPath(vmName + ".vmsd");
}