VMware {code} Community
andit
Contributor
Contributor

Actions filtered by ESX version

Hello,

I'm trying to apply menu actions only to hosts that have ESX 5.0 or 5.1

I've tried to filter them using the propertyCondition tag but didn't worked so far. I've spent some time looking over the HostSystem object documentation in vSphere 5.1 and found that the HostSystem.config.product.version should have the ESX version. Any ideas on what is wrong?

<propertyCondition>
    <com.vmware.data.query.CompositeConstraint>
        <nestedConstraints>
            <com.vmware.data.query.PropertyConstraint>
                <propertyName>config.product.version</propertyName>
                <comparator>EQUALS</comparator>
                <comparableValue>
                    <String>5.0</String>
                </comparableValue>
            </com.vmware.data.query.PropertyConstraint>
            <com.vmware.data.query.PropertyConstraint>
                <propertyName>config.product.version</propertyName>
                <comparator>EQUALS</comparator>
                <comparableValue>
                    <String>5.1</String>
                </comparableValue>
            </com.vmware.data.query.PropertyConstraint>
        </nestedConstraints>
        <conjoiner>OR</conjoiner>
    </com.vmware.data.query.CompositeConstraint>
</propertyCondition>

Thanks

0 Kudos
3 Replies
laurentsd
VMware Employee
VMware Employee

Versions have 3 digits so you should test against 5.0.0 and not 5.0.

If you want everything above 5.0.0, you can do the following:

        <propertyConditions>
            <com.vmware.data.query.CompositeConstraint>
               <nestedConstraints>
                  <com.vmware.data.query.PropertyConstraint>
                     <propertyName>config.product.version</propertyName>
                     <comparator>GREATER</comparator>
                     <comparableValue>
                        <String>5.0.0</String>
                     </comparableValue>
                  </com.vmware.data.query.PropertyConstraint>
                  <com.vmware.data.query.PropertyConstraint>
                     <propertyName>config.product.version</propertyName>
                     <comparator>EQUALS</comparator>
                     <comparableValue>
                        <String>5.0.0</String>
                     </comparableValue>
                  </com.vmware.data.query.PropertyConstraint>
               </nestedConstraints>
               <conjoiner>OR</conjoiner>
            </com.vmware.data.query.CompositeConstraint>
         </propertyConditions>
0 Kudos
noye
Contributor
Contributor

PropertyConditions filter the entire extension - how can I filter some actions by one rule and other actions by another?

For example, say I have an extension with 3 actions - a, b, c.

I want a condition that will always filter c, and will filter only one of a and b, by some property value

Can it be done?

Thanks,

Eitan

0 Kudos
laurentsd
VMware Employee
VMware Employee

In that case you need to split up your actions into several extensions. It is perfectly OK to have several extensions of "vise.actions.sets".

0 Kudos