0

I am using Java api (azure-compute:version 0.9.0) to perform VM operation. I want to make sure cloud operation on VM is performed successfully. I am getting some issue in Delete operation.

  • While beginDeleting(async) VM, I get Future and status in DeleteOperationResponse is Error once I get the response after future is Done.
  • Later after submitting beginDeleting(async), I am getting VM from VMGetResponse and then checking provisioningState after every 1 sec. After several 'Deleting', I get 'Error' state.

My expectation is to get VM object even after termination of instance with status like Deleted(or terminated) as I get in Amazon. So that I can get assured my cloud operation is successful.

Rishi Anand
  • 162
  • 1
  • 3
  • 11
  • 1
    (1) why you are getting an error while deleting - please provide detailed error message. you can always look the at resource logs via the portal. (2) do not expect to get a VM object after it was deleted. you can look at the resource group's logs to see previous operations – itaysk Feb 05 '17 at 08:18
  • Any way to get last n number of logs from java api or *OperationResponse object of last n operations. Can you suggest any good documentation or architecture flow diagram for azure java api. – Rishi Anand Feb 05 '17 at 19:20

1 Answers1

2

Any APIs call of Azure SDK for Java are really calling the related Azure REST APIs. So according to the references of REST API Delete a virtual machine & Get information about a virtual machine, you only could get the error status which comes from the response 404 status code, as below, because the resource has been deleted.

  1. Quote from the description of Response of Delete a virtual machine.

    If resource does not exist, 404 (NotFound) is returned.

  2. Quote from the description of Response of Get information about a virtual machine.

    otherwise 404 (Not Found) is returned.

For your question in the comment, if you want to get the last n number of logs, the only way is using Azure Monitor REST API in Java. On Azure Offical website, you can refer to the documents below to know Azure Monitor service.

  1. Audit Logs in Azure Preview Portal
  2. Get started with Azure Monitor
  3. View events and activity logs
Peter Pan
  • 20,663
  • 4
  • 18
  • 35