-
Notifications
You must be signed in to change notification settings - Fork 16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Only 100 items returned? #4
Comments
It seems that this is actually a limitation of the vSphere API. According to this link on the VMware Communities forum, people seem to be having similar issues. Just brainstorming here, but perhaps it's possible to split the result set up into smaller groups using filters, and then join them all in the end? |
I thought I had a hacked solution, but I seem to have lost it. I think I can handle it in my code. Will keep you posted, but if the result set exceeds 100 items there is a |
@reedog117 I posted this on stack a while ago. we really need a method of calling ContinueRetrievePropertiesEx with arguments that includes the token returned along with some other aspect... |
OK this is what I am doing to solve the problem outside of the library (using the library): const getVirtualMachines = (vc) => {
return new Task( (reject, resolve) => {
const rootFolder = vc.serviceContent.rootFolder;
const vms = vc.getMORefsInContainerByType( rootFolder, 'VirtualMachine');
vms.once('result', (initial) =>{
if(initial.returnval.token == undefined) {
resolve(initial)
return
}else {
const thisReceiveAll = receiveAll(reject, resolve)
thisReceiveAll(vc, initial)
}
})
vms.once('error', reject)
})
}
const receiveAll = (reject, resolve) => (vc, initial) => {
const executeContinueReceive = function executeContinueReceive(previous) {
const args = {
_this: {"attributes":{"type":"PropertyCollector"},"$value":"propertyCollector"},
token: previous.returnval.token
}
vc.vc.runCommand('ContinueRetrievePropertiesEx', args).once('result', function(current){
const previousObjects = previous.returnval.objects
const currentObjects = current.returnval.objects
const allObjects = previousObjects.concat(currentObjects)
current.returnval.objects = allObjects
if(current.returnval.token == undefined) {
resolve(current);
return
}
return executeContinueReceive(current)
}).once('error', reject);
}
executeContinueReceive(initial)
} Essentially when I retreive the intial result set, and check for a token. If the token is there I enter a recursive "receiveAll" function which calls runCommand('ContinueRetrievePropertiesEx', args) and appends its results. Again checking the token at the end, and either returning the result OR make another recursive call. It works -- BUT I wonder if this should migrate back into the library somehow. @reedog117 let me know if there is anything else I can do. |
I have the following app that I want to use to grab a bunch of fields from vSphere and stick into a monog repository (which I am then cross reference to chef data and nmap scans to provide visibiliy inot network configuration and orchestration).
The relevant portions are the connect and getVirtualMachines methods. The first is pretty straight forward and returns a Task type resolving to (on success) the VC library instance. I would love the second method getVirtualMachines to return a Task resolving to (on success) all the virtual machines managed by the vcenter instance I am connected to. I am managing 104 virtual machiens in this instance - yet the request only returns an array of 100.
Is this a bug - OR am I not utiuilizing the library correctly?
The text was updated successfully, but these errors were encountered: