Microsoft Cluster on VMware and Devices

Well, once again the Microsoft Cluster on VMware bit my ass … As you might know, MSCS on VMware is a particular kind of pain, with each upgrade you end up with the same problem over and over again (SCSI reservations on the RDM-LUNs being one, and the passive node not booting being the other).

So I opened up another support case with VMware, and the responded like this:

Please see this kb entry: http://kb.vmware.com/kb/1016106

This doesn’t completely fit my case, but since the only active cluster-node failed yesterday evening (it’s only our internal file-share server, thus no worries), I thought I’d try to set the options.

And guess what ? My damn cluster works again 🙂

Reconfiguring NTP settings vCenter-wide

I recently started reinstalling all my ESX hosts, so I wrote up a short script that is reconfiguring all hosts and sets the NTP configuration according to my wish:

As you can see, the script takes the vCenter hostname and two NTP servers and basically applies it to each host in your vCenter environment.

Rename a Standard Port Group on all hosts in a cluster

Well, I recently decided to rename a bunch of my Standard Port Groups, since they did no longer reflect the network they were providing. Since I’m a lazy bastard (well lazy as in click lazy), I wrote this little PowerCLI script:

This script basically takes a vCenter instance and a single cluster, then creates a new Port Group on each host, after which it reconfigures all VMs possessing a virtual NIC with that Port Group and then deletes the old Port Group.

VMware Auto Deploy already registered / RuleEngine

I had this weird plugin error the other day which bothered me on Friday. I decided to go fixing it. So after poking around in the vCenter installed software list. I couldn’t find the Auto Deploy in the list, so I figured due to my recent vCenter reinstallation while keeping the database, I forgot to reinstall Auto Deploy.

I went ahead and started the Auto Deploy setup from the DVD again, until I received this weird looking error. Apparently the setup thought (and decided correctly) that Auto Deploy was already installed in my vCenter.

So after a bit of googling, I found this nice explanation on how to manually deregister Auto Deploy from my vCenter. So here are steps retyped:

  1. Run the setup an hold at the window where you’re informed that Auto Deploy is already installed. Copy the MSI package from %TEMP%{RANDOM-GUID} to C:TEMP
  2. Unpack the setup files from the msi
  3. Manually deregister Auto Deploy using autodeploy-register
  4. Run the Auto Deploy setup again

2. Unpack the setup files:

Open a command prompt and extract the msi using msiexec

3. Switch to C:TEMPautodeployProgram FilesVMwareVMware vSphere Auto Deploy and run autodeploy-register.exe against your vCenter installation

4. After that command completes, you simply can run the setup from the DVD again. Afterwards the RuleEngine errors were gone (simply because Auto Deploy is installed again) and Auto Deploy is working again.

Using HPs vibdeposit with VMware Update Manager

As we’re finally at the point, where I only need to bother with HP hardware (which in itself is troublesome enough), I wanted to use HPs vibdeposit with our Update Manager. The whole purpose of the repository is the integration of HPs custom vibs (download able on each hardware under VMware ESXi 5.0) into the VMware Update Manager. That makes it easy to integrate, say the nmi-sourcing driver, into the VMware built ESXi images.

So basically what you do is, add the VIB repository to your vCenter Update Manager download list, and then create a dynamic baseline for everything “Hewlett-Packard” and attach that to the desired level of your environment (I did it at the root level, as I only have Hewlett-Packard). But I’ll show you.

First, visit your Update Manager (you’ll find it under Solutions > Update Manager). We need to update the Configuration of Update Manager in two places. First under “Configuration“, the second is under “Baseline and Groups“. But lets start with “Configuration“, since you can’t add something to a baseline that isn’t there.

Now, you want to add a new Update source:

The URL for that repository is http://vibsdepot.hp.com/index.xml. After that is done, you can click on “Apply” and “Download Now” to add the packages to your local software repository. After this, the VIB’s from HP just need to be applied to a set of hosts.

Now, we’re going to “Baseline and groups“.

As I mentioned before, we need to create the baseline, otherwise you can’t apply the VIBs to your hosts. So we create a new Baseline named “HP Update Bundles” only containing updates/patches labeled “Host Patch”.

Next we want to select the baseline type. Based on your requirements you may either select Fixed or Dynamic. Since I don’t want to update the baseline each time HP releases a new VIB, I chose “Dynamic”. Keep in mind if you select Fixed, you need to select the VIB’s in the dialog window.

But since I selected Dynamic, I just need to apply a filter criteria in this next dialog, telling the baseline to select only VIB’s originating from the vendor “Hewlett-Packard Company”.

You may also exclude specific patches from this baseline using this following dialog, which I decided not to do. Next we need to switch to a set of hosts (for me, it is the root level of the vCenter as I only operate HP hosts). So navigate to the desired folder, cluster, host and select the “Update Manager” tab on the upper right.

Simply click on “Attach” and a new dialog opens from which you can select the newly created Baseline.

After this the baseline is attached to the selected folder and when you Scan/Update your hosts, this baseline is being pulled in also and applied.

Emptying a VMFS datastore with PowerCLI

Well, once again I hacked at the Powershell/PowerCLI the other day. Since we don’t yet have a Enterprise Plus license at work (which would support Datastore Maintaince and Storage DRS), I needed a way to empty one datastore and move all the content into another one, while enabling Thin-Provisioning.

So I googled for a bit, and actually found a few hints … So without further yada-yada, here’s the script I came up with:

Initially I have something different, which was a bit shorter (based on Brian‘s work), but it had a huge downside: If you have vRDMs (like I do), it converts every damn vRDM into a VMDK, so make sure you only run this script on a datastore on VMs that either have only pRDMs or VMs with only VMDKs.

Doing TSM’s job on Windows Server 2008

Ran into another weird problem the other day … Had a few Windows boxens running out of space. Why ? Well, because TSM includes a System-State backup when creating the daily incremental. Now, apparently (as stated by the IBM support) it isn’t TSM’s job to keep track of the VSS snapshots but rather Windows’. Now by default, if you don’t click on the VSS properties of a Windows drive, there is no limit on the volume. Thus, VSS is slowly eating up all your space.

That isn’t the worst of it, but when you want to delete it all … With Windows 2003 you would just this:

However, as with everything Microsoft, Windows 2008 R2 does it a little bit different. As a matter of fact, it won’t allow you to delete application triggered snapshots (as you can see in the example below), so you’re basically shit-out-of-luck.

Well, not really … diskshadow to the rescue. Simply running diskshadow with a simple script like this:

Just for clarification this isn’t my own work, it was someone elses.

Empty Port SSL after ADAM installation

I’ve been meaning to post this, but never actually got around to doing that. When installing vCenter 5.0, an instance of ADAM is installed, which stores all the configration data for Linked Mode.

It basically boils down to running this script and rebooting the box:

This is no new invention of myself, just writing it down for myself from here or here.

Rebooting a virtual machine via Task scheduler

Since the Scheduled Tasks in vCenter ain’t exportable, I went ahead and wrote a rather simple script, which lets me do this in Windows own Task Scheduler. What this script does, is initiate a graceful shutdown and if the VM isn’t shutdown within 60 seconds (12 * 5 seconds) it simply powers the VM off and immediately after that powers it back on.

Before this implementation in PowerCLI, I needed three tasks for each VM that was to be scheduled. And when migrating vCenters (and I usually do an empty install) vCenter’s scheduled tasks are not exportable, thus you need to re-create the tasks on the new vCenter by yourself again, which for more than four virtual machines is really a pain in the ass …

Update: well, found an error that caused shit not to work … Basically Stop-VM also needs the object for $VMname, otherwise the whole point of waiting for the VM to be stopped is kinda moot (seeing as Stop-VM never stops obsessing about not having a Get-VM object or a VM name to work with).

Reoccurring memory limits in vCenter

We recently had, after we migrated from vSphere 4 to vSphere 5, a memory limit in size of the configured memory on each and every VM. Since memory limits on VM level pretty much destroy performance, I went ahead an wrote this simple script to remove all memory limits on all VMs that don’t have “Unlimited” configured:

This script is basically what the guy over at get-admin.com did, just only for memory limits.