Posts
Men and Mice API Client Gem for Ruby
Part of what I am doing these days is integrating Red Hat CloudForms / ManageIQ with the Men and Mice IP address management (IPAM) application. In order to reduce gem dependencies, reduce duplication, and handle some architecture issues I have been working on a client gem that uses the JSON-RPC API provided by Men and Mice.
If you are using Ruby and want to integrate with M&M please check out the gem and provide any feedback you have through Github issues.
Posts
Helper utility for ManageIQ/CloudForms Automate
As I do Automate development on RedHat CloudForms I am seeing a lot of copy/paste code which is the opposite of DRY. Our process was to put commonly used code in a starting template for an Automate method. This is nice because someone new to development gains the experience of a nice starting point, but it results in a lot of extra code. We also lose the benefit of bug fixes to the helper methods.
Posts
Getting ManageIQ instance attributes without executing methods/states
I want to use the values from the ProvisionRequestQuotaVerification instance. The problem is that using $evm.instantiate will cause the code to run. This results in an exception or error.
Digging around I found
1 $evm.instance_get(path) Which works as long as you know the full path including the domain, but then you can not rely on domain inheritance.
1 my_instance = $evm.instance_get("/ManageIQ/Infrastructure/VM/Provisioning/StateMachines/ProvisionRequestQuotaVerification/default") Here is my current workaround:
Posts
Red Hat CloudForms/ManageIQ – Examples
For me, one of the easier ways to begin to learn something is to learn by example. Even if the example does not solve my exact problem, I can use it to figure out ways of extracting the information I need and patterns for implementing new functionality. As a response to a forum question regarding provisioning approvals, Kevin Morey pointed out a Github repository that I was unaware of (https://github.com/ramrexx/CloudFormsPOC). This repo is a great source of example code to get you started exploring more advanced usage of CloudForms.
Posts
Foreman ESXi Installation Never Completes
In our environment we want to use Foreman to build our OCP hardware. It was working well except that the installation would repeatedly PXE boot to reinstall because Foreman would not know that the PXE portion was complete.
The standard notification code below was failing for some reason.
1 2 %post --interpreter=busybox --ignorefailure=true wget -O /dev/null <%= foreman_url %> After running the unattended install in a Fusion VM so I could have console access I reviewed the install log and a misleading message from wget about the URL being bad.
Posts
OpenZIS installation guide
I have spent a day or so trying to get the OpenZIS project up and running on a CentOS machine. A lack of updated instructions and an older code base made this process harder than I expected.
While I am still investigating if OpenZIS will meet my needs, I wanted to publish what I did as a reference to others who might try to install it. The doc is in my forked version of OpenZIS.
Posts
Problems with intuitive availability calculations
I often see/hear comments from people whose common sense approach to availability design includes eliminating a single point of failure. This is a great goal when required, but care must be take that the “common sense” approach is actually achieving what is required. I have found that using a fault tree approach to evaluating design decisions can be insightful.
The last instance of this is a book, while otherwise great, gave the advice of separating a database from the application function onto separate servers because there was a single point of failure.
Posts
PowerCLI Move-Datastore Function
Moving datastores into folders via drag/drop can be painful. In some cases vCenter does not want to allow a drag from a long list. Here is a quick function to make moving via PowerCLI a little bit easier.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 Function Move-Datastore { param ( [VMware.VimAutomation.ViCore.Impl.V1.DatastoreManagement.VmfsDatastoreImpl[]] $datastore = $(throw "Datastore(s) must be provided.
Posts
Convenience Functions for Connecting to Multiple vCenters
In a large environment repeatedly connecting and disconnecting from groups of vCenters can be tedious so I created some helper functions and put them in my PowerShell profile.
1 2 3 Connect-VIServerGroup lab Connect-VIServerGroup desktops Disconnect-VIServerGroup lab 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 Function Connect-VIServerGroup { param ( [String]$group = $(throw "A VI server group name must be specified.
Posts
Single pane for multiple vCenter alarms
When you have multiple vCenters it can be a pain to go through each one checking for alarms. Hence the script below. You can specify the vCenters you want to connect to and it will display a nice sortable/filterable grid view of all of the triggered alarms.
# Usage .\Get-TriggeredAlarms -vCenters vc001,vc002 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 param ( [String[]]$vCenters ) Function Get-TriggeredAlarms { param ( $vCenter = $(throw "A vCenter must be specified.
Posts
PowerShell: Alternate script behavior when dot sourced vs run directly
I use dot sourcing in my PowerShell scripts to reuse functions* and sometimes I want different behavior if they are included (dot sourced) or run directly. This concept is used in Python to provide an easy way to run tests against the code when run directly but not when it is imported.
You are not restricted to running tests using this approach, but I think that automated testing is useful so that is the example I provide below.
Posts
Validate datastore visibility between hosts
This script will check a set of hosts and report on whether the available datastores match. The first host found becomes the reference host and the others are compared against it.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 param ( [VMware.