Cloud Forms Automate Integration and Orchestration · PDF fileCloud Forms Automate Integration...
Transcript of Cloud Forms Automate Integration and Orchestration · PDF fileCloud Forms Automate Integration...
Cloud Forms Automate Integration and Orchestration
David Simmons, Principal Solutions ArchitectKevin Morey, Senior Solutions Architect
Red Hat
Standard Provisioning Workflow
CloudForms 3The Phases of CFME Automate VM Provisioning
Step1: Build Request
Step2: Request Approval
StateMachine
Step3: Quota Validation
Step4: Provisioning
Standard Provisioning Workflow
User clicks on Lifecycle / Provision
/System/Request/UI_Provision_Info
Depending on the template chosen will determine the dialog that is loaded
Default profile .missing instance will be used
Group profile instance will be used
No
If group instance exists?Yes
Lookup provisioning dialog (Note: Dialogs are located in Automate /
Customization
Set initial VM name
Step2
Standard Provisioning Workflow
NoYesSynthetic event MiqProvisionRequest is raised
Validate Request?
Send email to user and approver that request is pending
Send email to end user that the request has been approved
Approver approves or denies Request?
Send email to user that Request is denied
No
Yes
Step3
Standard Provisioning Workflow
Synthetic even MiqProvisionRequest starting is raised
Validate quotas?
No
Yes
Yes
Send email to user that Request is denied
Step4
Set VM name
Standard Provisioning Workflow
Create Provision Task
Get the StateMachine Class and Instance name
Begin Provision StateMachine
Map any customization specifications and templates
(ks.cfg)
Set VLAN, notes & annotations and vCenter
folder
Execute Task
Step4.1
Standard Provisioning Workflow
best_fit_with_scope (VMware), best_placement_with_scope
(RHEV), best_fit_availability_zone (EC2 & RHOS),
CheckProvisioned checks to ensure that the VM is created
Perform any post provisioning tasks here
Eamil user that VM provisioning job is complete
Standard Provisioning Workflow
Now Let’s Change the Workflow and Integrate!
IP Address Management - Infoblox Example
Change the Instance Reflecting new Method
Alter “Provision VM from Template”
IP Address Management - Infoblox
Remove Blank Value then point to new Instance
IP Address Management - Infoblox
Create the Method
Create the Instance
IP Address Management - Infoblox
prov = $evm.root["miq_provision"]
Create new object “prov” from EVM.ROOT MIQ_PROVISION
prov.set_option(:sysprep_spec_override, 'true')
Override Sysprep Options
prov.set_option(:addr_mode, ["static", "Static"])
Set IP Address to Static
prov.set_option(:ip_addr, "#{ipaddr}")
Set IP Address
What does Cloud Forms Need during Provisioning?
IP Address Management - Infoblox
prov.set_option(:subnet_mask, "#{netmask}")
Set NetMask
prov.set_option(:gateway, "#{gateway}")
Set Gateway
prov.set_option(:vm_target_name, "#{hostname}")
Set Target Name *** This is the Display Name within Virtual Center and RHEV ***
prov.set_option(:linux_host_name, "#{hostname}")
Set Host Name *** Host Name of Linux VM ***
What does Cloud Forms Need during Provisioning?
IP Address Management - Infoblox
Include the required gems
require 'rest_client‘
Obvious
require 'json‘
JSON Data Structure
require 'nokogiri‘
XML Parser
require 'ipaddr‘
Human Readable IP String
Ok, What’s the REST Call look like?
IP Address Management - Infoblox
url = 'https://myinfobloxserver/wapi/v1.2.1/network’dooie = RestClient.post url, :_function => 'next_available_ip', :num => '1'doc = Nokogiri::XML(dooie)root = doc.rootnextip = root.xpath("ips/list/value/text()")$evm.log("info", "GetIP --> NextIP is - #{nextip}")return nextip
ipaddr = nextip
Ok, What’s the REST Call look like?
VOILÀ Use ipaddr in the afore-mentioned prov values to Set the IP Address delivered from InfoBlox!
CloudForms – Flexing workloads
Flexing Workloads - Problem
Our web application must be able to automatically flex during peak times.
Flexing Workloads - Solution
Using CloudForms we can leverage real-time performance metrics along with automation to auto-scale our application and provide optimum performance for our customers
Flexing Workloads – Create Service Dialog
① Create a Service Dialog
① Add more options if you like
① Add flex monitor/maximum tags
3
2
1
Flexing Workloads – Create Service Catalog Item
① Create a new service catalog item
① Point the catalog item to your Service Flex Dialog
① Make the Entry Point ServiceFlex_CatalogItemInitialization
1
2
3
Flexing Workloads – Provision Service Flex
① Order a service flex
① Set Service Flex Monitor to true
① Set the Flex Maximum
1
2
3
Flexing Workloads – Review Service Tags
① serviceflex_current: Current number of flexes for this service
① serviceflex_maximum: Maximum number of flexes for this service
① serviceflex_monitor: True means that this service is flexible
① serviceflex_pending: Number of VMs currently provisioning
1
3
2
4
Flexing Workloads – Alert Driven Event or ad hoc① Create a new Alert profile I.e.
“ServiceFlex: CPU % Used > 50”
① Assign the Alert profile to an infrastructure item
① When this alert is triggered it will flex a new VM into the Service using the same parameters as the previous VM and sets a custom attribute on the flexed VM's summary page that shows why the VM was flexed.
① Or alternatively execute the Service Flex button on your Flex Monitored VM for ad hoc flexing
1
3
2
4
Flexing Workloads – A Look at Automate
① ServiceFlex_CatalogItemInitialization: (Service dialog -processes service dialog options and creates tags)
① ServiceFlex_Processing: (Alert - provisions new VMs using parent VM parameters)
① ServiceFlex_AddToService: (Provisioning - adds new VMs to the parent service)
① ServiceFlex_RemoveFromService: (Retirement – removes VM from the parent service)
4
3
2
1
Flexing Workloads – How the Sausage is Made
# ServiceFlex_Processing
# Get vm object from rootvm = $evm.root['vm']
# Get miq_provision from vmprov = vm.miq_provision
# Get the serviceflex_monitor tag from the vmserviceflex_monitor = vm.tags(:serviceflex_monitor).first
If $evm.root['object_name'] == 'Event'args = "name=#{prov.vm_template.name}args += "vm_name=#{new_vm_name}”args += "|cores_per_socket=#{prov.get_option(:cores_per_socket)}"args += "|vm_memory=#{prov.get_option(:vm_memory)}”args += "|vlan=#{prov.get_option(:vlan)}”args += “serviceflex_reason=#{$evm.root['miq_alert_description']}”$evm.execute('create_provision_request', *args)
Flexing Workloads – How the Sausage is Made
# ServiceFlex_AddToService
# Get miq_provision from rootprov = $evm.root['miq_provision']
# Get vm object from miq_provisionvm = prov.vm
# Add vm to parent servicevm.add_to_service(parent_service)
# Tag the parent service reducing the pending tag by 1parent_service.tag_assign("serviceflex_pending/#{serviceflex_pending-1}")
# Add custom attribute serviceflex_reason => serviceflex_reason to VMvm.custom_set(:serviceflex_reason, serviceflex_reason].to_s)
Flexing workloads - DEMO