CPU and Memory Limit enforcement for vCloud Director

Version 1

    Overview

    vCenter Orchestrator provides a large library of workflows and actions out of the box. This library grows with each new plugin that gets installed. As a result, it becomes easier to build very powerful workflows with little to no knowledge of an API. This document will focus on a package of custom workflows built using plug-ins, library items, and additional scripting.

     

    This package allows a vCloud Director system administrator to limit the maximum CPU and Memory of Virtual Machines deployed in vCloudDirector. The solution utilizes the Deploy vApp blocking task to prevent any VM from powering on if it exceeds the admin-specified limits.

     

    The solution's configuration options include the ability to:

    • Specify the maximum CPU count for any VM to be powered on
    • Specify the maximum Memory (GB) for any VM to be powered on
    • Specify whether or not to automatically reconfigure the VM's CPU and Memory to the specified limit if the user-specified value exceeds the limit
    • Specify a failure message to be shown in vCloud Director if auto reconfigure is not enabled

    Disclaimer: These sample workflows are provided AS IS and are not production quality. Use at your own risk. Feel free to Duplicate and Modify and expand and share your contribution.

    Documentation

    These are the instructions to have the sample workflows working

    Pre-requisite

    • vCenter Orchestrator 5.1 installed and configured
    • AMQP plug-in installed
    • vCloud Director 5.1 plug-in for vCenter Orchestrator installed and configured using the SYSTEM org
    • AMQP server
    • A working vCloud Director 5.1 environment configured to use an AMQP server for notficiations

    vCloud Director

    The blocking task you enable in this section will allow vCenter Orchestrator to subscribe to notifications sent by the task and automatically resume, abort, or fail the operation as needed.

    • Configure blocking tasks settings with AMQP server info and Test the AMQP Connection
    • Check the box to enable the "Start vApp (Deploy from API)" blocking task
      vcd-blockingtask.png

    vCenter Orchestrator

    • Import package in vCenter Orchestrator       
      • Start vCenter Orchestrator Client and login as an administrator
      • Import the package com.vmware.coe.vcd51.limits.package
    • Configure the solution settings
      • Run the workflow "Limits Customization Config"
    • Create AMQP Subscription
      • Start the "Create a vCloud Director notification subscription" workflow               
        • Provide an appropriate Queue name (ie: Limit Deploy vApp or VM)
        • Choose the vCloud Director Host
        • Specify the AMQP password used by the vCloud Director server to communicate to the AMQP server
        • Specify whether or not to create a broker
        • Click Next until you get to step “2d” Blocking Task Operation Type
        • Select “Yes”, then choose the “Vapp Deploy” blocking task
        • Click Next
        • For “Event Type”: select “Yes”, then choose the option for “Create”
        • Leave “Entity type” as “No”
        • For “Workflow”: Choose the “Limit Deploy vApp” workflow
        • Click “Submit”
    • Start the listener workflow or policy: In earlier versions of the AMQP plug-in, there was an issue where the policy would not kick off a workflow. As a work-around, the Subscription Listener workflow was developed       
      • If using Listener workflow: Run the “Start a subscription listener workflow”, choose the Subscription that was just created and click Submit
      • If using Policy: Run the “Create a vCloud Director notification policy” workflow, choose the Subscription that was just created, click Yes for “Start right away” and Yes for “Auto start when vCO server is restarted”, then click Submit

    Test

    • Go to vCD and attempt to Start a VM or vApp that contains VMs that exceed the CPU and/or Memory limits specified
    • Confirm that the VM(s) that were just started are at or below the limits specified
    • Check the “Limit Deploy vApp” workflow execution log
      workflow-execution.png