你好呀,
我有很多PD,在这些PD中,我有很多VM。如果可能的话,我希望能够运行NCLI(或类似)的VM使用通配符。例子:
NCLI PD UNPROTECT名称= protectionDomain vm_name = vm*
任何人都对如何通过通配符毫无保护的机器来一次删除批量量?
最好的答案谢尔盖·伊万诺夫(Sergei Ivanov)
unfortunately, the traditional wildcard will not work there. You can use the following for-loop as a workaround:<\/p>
for i in $(ncli pd list name=<PD-NAME> | grep \"VM Name\" | grep \"<PART-OF-VM-NAME>\" | awk {'print $NF'}); do ncli pd unprotect name=<PD-NAME> vm-names=$i; done<\/p>
Just replace the <PD-NAME> from in the command above with the name of the Protection Domain and replace <PART-OF-VM-NAME> with what you would write before the * as if you used the wildcard. For example, if you want to remove only the VMs from the PD that have \u201caccounting\u201d in their name, put \u201caccounting\u201d there.<\/p>
I know it is not a beautiful solution and it is rather slow, but it works.<\/p>","className":"post__content__best_answer"}">