9.4 Manual Management

The example provided in this section is a general purpose job that only provisions a resource.

You might use a job like this, for example, each day at 5:00 p.m. when your accounting department requires extra SAP servers to be available. As a developer, you would create a job that provisions the required VMs, then use the Orchestrator Scheduler to schedule the job to run every day at the time specified.

In this example, the provision job retrieves the members of a resource group (which are VMs) and invokes the provision action on the VM objects.

To setup to create the provision.job, use the following procedure:

  1. Create your VMs and follow the discovery process in the Orchestrator console so the VMs are in the Orchestrator inventory.

  2. In Orchestrator console, create a Resource Group called sap and add the required VMs as members of the group.

  3. Given the .jdl and .policy below you would create a .job file (jar them):

    >jar cvf provision.job provision.jdl provision.policy
  4. Deploy the provision.job file to the Orchestrator Server using either the Orchestrator console or the zosadmin command line.

To run the job, use either of the following procedures:

Manually Using the ZOS Command Line:

  1. At the command line, enter:

    >zos login <zos server>
    >zos run provision VmGroup="sap"

For more complete details about entering CLI commands, see The ZOS Command Line Tool in the Novell ZENworks Orchestrator 1.2 Job Management Guide.

Automatically Using the Orchestrator Console Job Scheduler:

  1. Create a New schedule.

  2. Fill in the job name (provision), user, priority.

  3. For the jobarg VmGroup, enter sap.

  4. Create a Trigger for the time you want this job to run.

  5. Save the Schedule and enable it by clicking Resume.

You can manually force scheduling by clicking Test Schedule Now.

For more complete details about using the ZOS Control Scheduler. See also Section 9.5, Automatically Provisioning a VM Server.

9.4.1 Provision Job JDL

"""Job that retrieves the members of a supplied resource group and invokes the provision action on all members. For more details about this class, see Job. See also ProvisionSpec.

The members must be VMs.

class provision(Job):

    def job_started_event(self):

        # Retrieves the value of a job argument supplied in
        # the 'zos run' or scheduled run.
        VmGroup = self.getFact("jobargs.VmGroup")

        # Retrieves the resource group grid object of the supplied name.
        # The job Fails if the group name does not exist.
        group = getMatrix().getGroup(TYPE_RESOURCE,VmGroup)
        if group == None:
            self.fail("No such group '%s'." % (VmGroup))

        # Gets a list of group members and invokes a provision action on each one.
        members = group.getMembers()
        for vm in members:
           print "Provision action requested for VM '%s'" % (vm.getFact("resource.id"))

Job Policy:
    The policy definition for the provision example job.
    This specifies the job argument VmGroup' which is required


        <fact name="VmGroup"
              description="Name of a VM resource group whose members will be provisioned"