-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
Return Virtual Machine Instance View from list() or list_all() methods #573
Comments
It seems that the REST API itself does not provide this feature: @devigned do you have someone in the Compute team which can help us here? The SDK 2.0.0rc2 is using the 2016-03-30 Swagger file. |
Any insights on this one? |
I agree completely on this! Having to call VirtualMachines.Get on every machine in a LIst() is terribly inefficient and very slow. Been over a year and no progress :-( |
@squillace what do you think about making this happen? |
Is this feature still being considered to be added to the REST API? |
I'm trying to fetch the VM instances with the status. It would be great if we get the all VM details (VM size, memory, IP, status, etc..) in one place. |
@squillace or @singhkays any feedback on this issue? |
@nibhat should be able to answer decisively once he's back from leave but I haven't heard anything about this being considered as an add to the REST API over the many other priorities for the Compute team. |
Thank you, @singhkays! |
Has there been any progress on this issue, or is anyone from Microsoft able to comment on this? I see that the REST documentation for List All virtual machines now includes in results 'properties.instanceView', but when I call this api directly the instance view is not returned. |
apologies, @davidbairdala I'll ping the appropriate people. I'm not the one to handle it. |
Thanks @squillace |
@lmazuel can you have a look? Thanks so much. |
As far as I know, this is still not supported. We are investigating alternative ways, but nothing solid enough to be documented and suggested yet. |
This would be a really nice enhancement to have. It's impossible, as far as processing time is concerned, to have the power state along with other VM info. Any update on this? |
Hey Team! I'm doing some report right now, using PowerBI and the Azure API's, It will be great, if the status of the machine cannot be added to the standard ListAll VMs call, at least have a ListAll for the instaceView, so you can call all the instanceView at once and after that cross the information. Thanks! |
Adding this would benefit the cli as well. |
I want this too, because i have to create new http for every VM to get the instanceView, which makes the program very slow. |
To get the power state for the instances in bulk you can use following CLI option. az vmss list-instances --expand instanceView --select instanceView --resource-group "resourceGroupName" --subscription "subID" --name "vmssName" |
Hi @shandilvarun compute_client.virtual_machine_scale_set_vms.list(expand="instanceView") |
Good request. Having to query all vm's and then the instanceviews per vm to get the powerstate takes too long. Please add the instanceview to the list or listall. That will make things easier and much faster. Update: I found the following page https://docs.microsoft.com/en-us/rest/api/dtl/virtualmachines/list#computevminstanceviewstatus which is able to add an $expand: https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines?$expand={$expand}&$filter={$filter}&$top={$top}&$orderby={$orderby}&api-version=2018-09-15 Please note that this is DevTestLab of Microsoft, i hope this feature will come to https://management.azure.com/subscriptions/{subscriptionId}/providers/Microsoft.Compute/virtualMachines?api-version=2018-06-01 |
I am bumping this as well. Please consider this! |
I think this feature needed and I have for a long time. Right now if you need to do this through the API you have to make n+1 API requests where n is the number of VM's. This means if you have 500 VM's, 501 API calls are made to list and get each machine instead of a big paginated list. Is there somewhere else this issue lives as well? This is an deeper issue than just python SDK. We use the rest service exclusively these days and would love to see this resolved. |
I wonder now... Is this why the power state of the VMs is always slow and lagging behind when you get the full list of VMs on the AzureStack portal??? 😬😬😬 Update: It actually seems so! The Ibiza portal uses Knockout JS to get its data from the API and immediately present it to the view, and whilst you get an almost immediate response when it comes to the List of VMs, It seems that there is a request being sent for every single VM, and on the Integrated AzureStack that i manage(one of many), it takes a very long time to get the status of all of the VMs. Similar behavior on the Azure Off-Prem Portal. It is how the API is designed... |
I have managed to workaround (on the GUI) this using:
2.For every VM that gets processed, it would immediately write a row in the paginated jQuery Datatable to display to the user immediately and make an asynchronous AJAX call with the parameters of vmname, vmrg, region, and subid to the "vmstatus" api that i have waiting in Flask.
The experience is exactly like the one using the Ibiza portal. The user gets, what appears to be, an immediate response but of course it will not work with Ansible :( sorry. |
Is this resolved yet or one still needs to perform get call by lopping over the list of vms to get the status. |
Hi @chouseknecht. Thank you for opening this issue and giving us the opportunity to assist. We believe that this has been addressed. If you feel that further discussion is needed, please add a comment with the text “ |
Hi @chouseknecht, since you haven’t asked that we “ |
Hi zsandrus, only the original author of the issue can ask that it be unresolved. Please open a new issue with your scenario and details if you would like to discuss this topic with the team. |
1 similar comment
Hi zsandrus, only the original author of the issue can ask that it be unresolved. Please open a new issue with your scenario and details if you would like to discuss this topic with the team. |
For those looking to get the instance status for all VMs without having to make API calls for each VM one-by-one, I had success using the Hope that helps! |
This only returns the statuses but not the instance views. |
If you are wanting to get instance view properties for a list of VMs in an efficient manner you might consider just using the Graph API instead (see https://learn.microsoft.com/en-us/graph/use-the-api) |
Thanks, this works for my use case. It's still one additional call, but that's better than one call per VM. |
Is there a way to get an instance view returned from the list() or list_all() methods of the VirtualMachineOperations class?
Building the Azure inventory script for Ansible. Fetching the list of machines for a subscription of for a specific resource group returns data within 3 or 4 seconds. However, the machine objects do not include the instance view and thus no power state information. To get that information I'm calling the get() method for each machine and providing an expand parameter value of 'instanceView', which makes the overall process very slow.
Is there a more efficient way to do this?
The text was updated successfully, but these errors were encountered: