你好!
如果您在必须删除的AHV群集上有几台虚拟机,可以同时从Prism Central中删除它们,还是应该从Prism元素中删除它们?
另外,是否有任何REST API或PowerCli可以执行此过程?
谢谢
最好的答案Nupur.Sakhalkar
For REST API based deletion, we have a rest API to delete a single VM using the VM UUID. So, you will need to create a script to first get the VM UUIDs (using the VM GET API call) in case if you don\u2019t have it already and then use the VM UUIDs to delete the VMs using the VM DELETE REST API call.\u00a0<\/p>
Other way to do it could be via the following process:<\/p>
- Write a list of VM names that you want to delete into a file (each name in new line)<\/em>. For example File name could be - '\/tmp\/vms_to_delete'<\/li>\t
- Run the following command from any CVM in the cluster (login as nutanix user) to delete the VMs listed in step 1 (change the filename based on the name provided in step 1)<\/em>:\t
for i in $(cat \/tmp\/vms_to_delete); do echo $i && acli vm.delete $i; done<\/code><\/pre>\t-- It will ask you to type yes<\/strong> to confirm each of them, so it is quite safe<\/li><\/ol>
\u00a0<\/p>","className":"post__content__best_answer"}">
- Run the following command from any CVM in the cluster (login as nutanix user) to delete the VMs listed in step 1 (change the filename based on the name provided in step 1)<\/em>:\t