første xml update
[virt-orchestrator.git] / vFLOWER / content / Actions / com.vmware.library.vc.resourcePool / getValidResourcePoolForNetwork.action.xml
1 <?xml version="1.0" encoding="UTF-8"?>
2 <dunes-script-module name="getValidResourcePoolForNetwork" result-type="Array/VC:ResourcePool" api-version="3.1.0" id="824faaf4-383c-4224-919a-18dbece89ce6" version="0.2.0" allowed-operations="fv">
3     <description>Get valid resourcePools for a network</description>
4
5     <param n="network" t="VC:Network"/>
6
7     <script encoded="false">
8 var hosts = network.host;
9 var resourcePools = new Array();
10 for(var i in hosts){
11         var parent = hosts[i].parent;
12         while(! (parent instanceof VcComputeResource || parent instanceof VcClusterComputeResource)){
13                 parent = parent.parent;
14         }
15         
16         var pool = parent.resourcePool;
17         resourcePools.push(pool);
18         var childs = System.getModule("com.vmware.library.vc.resourcePool").getAllChildResourcePool(pool);
19         for(var j in childs){
20                 resourcePools.push(childs[j]);
21         }
22         
23 }
24
25 return resourcePools;
26     </script>
27 </dunes-script-module>