PowersHell: Enabling DPM Settings (IPMI/iLO/BMC)
In vSphere4 there’s a new method enabling the “Distributed Power Management” options for a DPM enabled cluster. In the past you were dependent on the “wake-on-LAN” and so-called “magic packets” to suspend and resumme an ESX host. In ESX4, you able to configure a user on the iLO/IMPI/BMC/DRAC/RAC board and with the right settings get the ESX host to suspend and resumme itself via the ACPI functionality which has been around for some years.
You can configure it in the GUI like so:
That’s all well and good I guess. Follower of this blog will know I’ve recently been trying to port all my usually setup routines (commonly in my kickstart install scripts) to PowerShell. This is part of my preparation for getting ready for an ESXi only world where the days of esxcfg-commands will be long gone.
So how do you this in PowerShell. Well, I was stumped for days on this even though I was VERY close. In fact to this day, I really don’t see how my bad PS scripts didn’t work, and good one does work. I’ll just blame that on the ghost in my machine! In the end I was helped out by Stuart Radnidge of vInternals. I’m very grateful for Stu for sharing his PS script for DPM on the VMware Forums, after he responded to my forum post/question. That’s how first started delving into the more murker depths of the VMware SDK APIs. Stu has a very nice post explaining (for idiots/mere mortals like me) how deep into the SDK using PowerShell has your pick-axe. It’s called PowerShell Mastery - http://vinternals.com/powercli-mastery/.
Additionally, if you into DPM the other thing Stu has shown, is how to create DPM user account on a HP ILO using the HP ILO command-line utilities. That means the entire job (create DPM using in ILO and configure on ESX host) can be scripted. Of course the tricky thing to script I would imagine is getting hold of the MAC address of ILO. I imagine you can do that with the HP ILO CLI commands…
http://vinternals.com/2009/08/create-users-with-the-hp-ilo-cli/
Anyway, that’s the background. Here’s Stu’s DPM script. Stu wasn’t bothered about me giving him all credit – but I think he deserves it. All he requested was some gratious swearing in this blog post. (Well, thank fuck for that, I thought he was gonna ask for book royalities!)
I’ve slight modified it (no major surgery) so it matches the conventions used in other samples on RTFM…
$vmhost = “esx4.vi4book.com”
$login = “vmware_dpm_user”
$password = “password”
$hostview = get-vmhost $vmhost | % {Get-View $_.Id}
$IpmiInfo = New-Object Vmware.Vim.HostIpmiInfo
$IpmiInfo.BmcIpAddress = “192.168.3.204″
$IpmiInfo.BmcMacAddress = “00:16:35:37:F8:02″
$IpmiInfo.Login = $login
$IpmiInfo.Password = $password
$hostview.UpdateIpmi($IpmiInfo)
Update:
Since writing this post I think I’ve figured out why Stu’s script worked and mine didn’t. He was including | % {Get-View $_.Id} and I wasn’t (not sure if that was significant). Additionally, it seems to be the case that the ESX host must added into vCenter first for the script to work. I found DPM didn’t have to be enabled on the cluster to allow the DPM configuration to go through.






RSS
iTunes