Azure-Samples/virtual-machines-python-manage

VM start/stop action too slow

indumathymk opened this issue · 1 comments

Am using following code to start and stop virtual machine,it will take more than 20 minutes to activate.
Have to know any issue with my code or some other reasons.
My code as follows,
**$requestazure = $client->request('GET', "vm?group=$group&name=$name&req=Start");

compute_client = ComputeManagementClient(credentials, subscription_id)
                try:
                        if vmReq == 'Start':
                                async_vm_start = compute_client.virtual_machines.start(group,vmName)
                                async_vm_start.wait()
                        if vmReq == 'Stop':
                                async_vm_stop = compute_client.virtual_machines.deallocate(group,vmName)
                                async_vm_stop.wait()
                        vm_state=compute_client.virtual_machines.get(group,vmName, expand='instanceView',region = '')
                        state=vm_state.instance_view.statuses[1].display_status
                except Exception as e:
                        print(e)**

Thanks.

Hi @indumathymk
There is no problem with your code, at worst you can lose 30 seconds too much (which is the default waiting time of the SDK), but 20 minutes it means Azure needed 20 minutes to start/stop the VM and told the SDK explicitly.
If you believe this is not normal, please open a support ticket using the Azure portal.
thanks!