Quantcast
Channel: VMware Communities : Discussion List - All Communities
Viewing all articles
Browse latest Browse all 176483

Workflow export vc:datastore object

$
0
0

Hello,

 

first of all I am new at this, so as a "self study" I am playing around with vCO. What I am trying to do is loop through some datastores get the one with most free space and export this as a vc:datastore object.

 

I know I could do this in one custom script, but as I am trying to get a hang of vCO and how it works with attributes / parameters etc. I am trying this with a for each loop with counters.

 

So what I am doing is

     -     getting all the datastores from 1 host. and export as Array of vc:datastores

     -     for each datastore loop

     -     setting current datastore to datastores[current counter]

     -     get free space and % free usage from this datastore.

          -    I see the initial "bestPercentFree" (number) attribute to 0 and check if the % free space is bigger then the current value in the attribute.

               if it is bigger I set the current datastores free space (  bestPercentFree = percentFree;)

               I also set the bestDatastore (Vc:Datastore) attribute to the currentdatastore

    

I repeat this till i am through all the datastores.

 

Now what happens is that the attribute with the bestPercentFree gets updated everytime it finds a datastore with a higher % free. But the bestDatastore attribute ends up "not set".

If I log it's value it looks like it's back to "null" once it goes to the next datastore. If this is default behaviour I would expect the same with the bestPercentFree attribute.

 

Once I finished the loop I have an output parameter selectedDatastore (Vc:Datastore) which would output the bestDatastore attribute

 

I am doing something wrong with how vCO works? .....


Viewing all articles
Browse latest Browse all 176483

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>