5.1.5 Configuring the <modify> Element

This document explains how to configure the <modify> element in vpcs.xml. Within the Manage environment page, a user has the option to modify a VPC. The <modify> element contains all information necessary to modify a VPC and the reservations that exist on them. This element also establishes the rules for modifying configurable attributes of a VPC.

To manage users in vpcs.xml, see Managing VPC Users. To configure generic reservation commands, see Generic Commands.

5.1.5.1 Action Models

In Viewpoint, there are various actions that modify VPCs and reservations. By default, Viewpoint computes how to perform an action, such as adding resources to a reservation or adding users to a VPCs ACL. However, there are some actions that can be configured to perform other types of operations instead of or in addition to the default actions. For example, you can specify that you do not want Viewpoint to add reservations to a VPC, but should instead fire a trigger that takes care of the action. Or, you might configure Viewpoint to fire a trigger every time Viewpoint joins two resource reservations together.

The following actions can be configured using an action model:

All action models have the 'perform-action' attribute where administrators can turn the default action on or off. For example, if the 'perform-action' attribute in the add reservation action model is set to true, Viewpoint runs the 'mschedctl -m vpc:vpcId -a resources=tid' command to add a reservation to the VPC. If the attribute is set to false, Viewpoint does not perform this action.

Action models can have additional commands that can be run by using the <command> element. There can be 0 or more <command> element children for each action model. See XML Syntax for Moab Commands for details on setting up these administrator-specified commands.

Here's an example of an Add Reservation action where Viewpoint performs the Moab action to add the reservation, and then fires a trigger.

<action perform-action="true">
 <command>
  <value>
   <calculate operation="append-in-order">
    <value order="1">mschedctl -c trigger  name="add_new_reservation",etype=START,atype=EXEC,
action="/opt/moab/tools/modify.vpc.pl --vpc_id=\$VPCID --oid=\$OID --cart_item_id=</value>
    <value order="2">
     <component id="cart-item-id" />
    </value>
    <value order="3">" -o rsv:</value>
    <value order="4">
     <component id="rsv-group" />
    </value>
   </calculate>
  </value>
 </command>
</action>

5.1.5.1.1 Add Reservation

The Add Reservation action runs the 'mschedctl -m vpc:vpcId -a resources=tid' command if 'perform-action' is set to true.

The following keywords are available for the Add Reservation <action> element value deciders:

5.1.5.1.2 Decrement Reservation's Resources

The Decrement Reservation Resources action is specified using the <decrement-resources> element. The specific Moab commands necessary to decrement a reservation's resources is dependent on the disk model set up in the configuration.

The following keywords are available for the <decrement-resources> element value deciders:

5.1.5.1.3 Migrate Reservations

The migrate reservation action is specified using the <migrate-rsv> element. The specific Moab commands necessary to migrate a reservation's resources is dependent on the disk model set up in the configuration.

The following keywords are available for the <migrate-rsv> element value deciders:

5.1.5.1.4 Join Reservations

The Join Reservation action is specified using the <join-rsv> element. The specific Moab commands necessary to join a reservation's resources is dependent on the disk model set up in the configuration.

The following keywords are available for the <join-rsv> element value deciders:

5.1.5.1.5 Delete VPC

The Delete VPC action is specified using the <delete-vpc> element of vpcs.xml, and needs to be placed inside the <modify> tags. This optional element defines the action model like the others explained above. If a value is not specified for this element, Viewpoint will take the default action of deleting the VPC using "mschedctl -d vpc:{vpc.id}".

The only keyword available for the <delete-vpc> element is "$VPC". Any occurrences of this keyword will be replaced with the ID of the VPC that is being deleted.

The following is an example of how the <delete-vpc> element is configured:

<modify>
  <decrement-resources perform-action="true" />
  <join-rsv perform-action="true" />
  <migrate-rsv perform-action="true" />
  <resource-ui>
    <procs>
      <description>Processors</description>
        <select-values>
          <select-value api-value="1" display-value="1 CPU" />
          <select-value api-value="2" display-value="2 CPUs" />
          <select-value api-value="4" display-value="4 CPUs" />
        </select-values>
    </procs>
    <memory>
      <description>RAM</description>
      <select-values>
        <select-value api-value="1024" display-value="1 GB" />
        <select-value api-value="2048" display-value="2 GB" />
        <select-value api-value="3072" display-value="3 GB" />
        <select-value api-value="4096" display-value="4 GB" />
        <select-value api-value="8192" display-value="8 GB" />
      </select-values>
    </memory>
    <disk>
      <description>Disk Space</description>
      <number-value type="int">
        <default>0</default>
        <minimum inclusive="true">0</minimum>
        <maximum inclusive="true">1000</maximum>
        <step>10</step>
      </number-value>
    </disk>
  </resource-ui>

  <!-- VPC Example placement -->

  <delete-vpc perform-action="true">
    <command>
      <value>
        <calculate operation="append-in-order">
          <value order="1">echo "This is the Delete VPC"</value>
        </calculate>
      </value>
    </command>
  </delete-vpc>
</modify>