how to manage VMware VM instances through REST API ?

soibam_ana_sing
Giga Contributor

How do we manage (stop/terminate etc.) VMware vm instances through REST APIs ? 

In cmdb table "cmdb_ci_vmware_instance" , we try to terminate vm instance by changing vm's state to "terminated". VM instance is not deleted from vCenter. its just change state to "terminated" in form. 

response = requests.put(url, auth=(config.snow_username, config.snow_password), headers=headers ,data="{\"state\":\"terminated\"}"

Thanks in advance for your helps/suggestions. 

Regards

Soibamfind_real_file.png

 

 

2 REPLIES 2

Chuck Tomasi
Tera Patron

All of this is available in VMWare Cloud Management. If you choose to write your own REST APIs, it's going to be time consuming to build and maintain, whereas if you purchase orchestration, you can drop the activities on the workflow and maintain them easier going forward.

Cloud Management setup guide for VMware | ServiceNow Docs

Thanks Chuck Tomasi for reply. Developing  own workflow is time consuming.

1. Manually we can terminate/stop VM by just clicking associated UI action "Terminate VM/Stop VM". Is there any way where we can trigger this UI action through business rules/REST API or other means ?

2. VM instance "TEST-OSB" is in power on state and have proper IP address. but same ip address is not reflected in ip address field in table "cmdb_ci_vmware_instance". we are observing this issue in all VMs discovered in SNOW.  how do we update ip address in table?

find_real_file.png