import com.vmware.vim25.*
import com.vmware.vim25.mo.*
// VMWare ESXiに接続
host = "https://192.168.1.161/sdk"
user = "root"
password = "password"
si = new ServiceInstance(new URL(host), user, password, true)
rf = si.getRootFolder()
// 仮想マシンのCPU割り当て制限を一覧表示
sc = [["VirtualMachine", "name"]] as String[][]
vms = new InventoryNavigator(rf).searchManagedEntities(sc, true)
for( vm in vms ){
println "${vm.name}:${vm.config?.cpuAllocation?.limit==-1?"no limit":vm.config?.cpuAllocation?.limit}(MHz)"
}
si.getServerConnection().logout()
動作環境
groovy 1.7.1, JDK6 Update19, VMware VI (vSphere) Java API vijava2u120091204,
VMWare ESXi 4.0 Update1
関連情報
groovyとVI Java APIのまとめ
VMware VI (vSphere) Java APIのホームページ
http://vijava.sourceforge.net/
0 件のコメント:
コメントを投稿