Cloud Forms Automate Integration and Orchestration David Simmons, Principal Solutions Architect Kevin Morey, Senior Solutions Architect Red Hat Standard Provisioning Workflow CloudForms 3 The 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 If group instance exists? Yes No /System/Request/UI_Provision_Info Group profile instance will be used Default profile .missing instance will be used Set initial VM name Step2 Depending on the template chosen will determine the dialog that is loaded Lookup provisioning dialog (Note: Dialogs are located in Automate / Customization Standard Provisioning Workflow Synthetic event MiqProvisionRequest is raised Validate Request? Yes Send email to end user that the request has been approved Yes No Send email to user and approver that request is pending Approver approves or denies Request? Step3 No Send email to user that Request is denied Standard Provisioning Workflow Validate quotas? No Synthetic even MiqProvisionRequest starting is raised Yes Set VM name Step4 Yes Send email to user that Request is denied Standard Provisioning Workflow Create Provision Task Get the StateMachine Class and Instance name Begin Provision StateMachine Map any customization specifications and templates (ks.cfg) Execute Task Step4.1 Set VLAN, notes & annotations and vCenter folder Standard Provisioning Workflow CheckProvisioned checks to ensure that the VM is created best_fit_with_scope (VMware), best_placement_with_scope (RHEV), best_fit_availability_zone (EC2 & RHOS), 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 What does Cloud Forms Need during Provisioning? 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 IP Address Management - Infoblox What does Cloud Forms Need during Provisioning? 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 *** IP Address Management - Infoblox Ok, What’s the REST Call look like? Include the required gems require 'rest_client‘ Obvious require 'json‘ JSON Data Structure require 'nokogiri‘ XML Parser require 'ipaddr‘ Human Readable IP String IP Address Management - Infoblox Ok, What’s the REST Call look like? url = 'https://myinfobloxserver/wapi/v1.2.1/network’ dooie = RestClient.post url, :_function => 'next_available_ip', :num => '1' doc = Nokogiri::XML(dooie) root = doc.root nextip = root.xpath("ips/list/value/text()") $evm.log("info", "GetIP --> NextIP is - #{nextip}") return nextip ipaddr = nextip 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 1 2 3 Flexing Workloads – Create Service Catalog Item ① Create a new service catalog item ① Point the catalog item to your Service Flex Dialog 1 ① Make the Entry Point ServiceFlex_CatalogItemInitialization 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 2 3 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. 1 4 ① Or alternatively execute the Service Flex button on your Flex Monitored VM for ad hoc flexing 3 2 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) 3 1 2 4 Flexing Workloads – How the Sausage is Made # ServiceFlex_Processing # Get vm object from root vm = $evm.root['vm'] # Get miq_provision from vm prov = vm.miq_provision # Get the serviceflex_monitor tag from the vm serviceflex_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 root prov = $evm.root['miq_provision'] # Get vm object from miq_provision vm = prov.vm # Add vm to parent service vm.add_to_service(parent_service) # Tag the parent service reducing the pending tag by 1 parent_service.tag_assign("serviceflex_pending/#{serviceflex_pending-1}") # Add custom attribute serviceflex_reason => serviceflex_reason to VM vm.custom_set(:serviceflex_reason, serviceflex_reason].to_s) Flexing workloads - DEMO
© Copyright 2024 ExpyDoc