Saturday, May 28, 2011

Using Custom Attributes to Manage VMs

This may not be the most technical post, but it should hopefully give VM administrators some ideas on managing their VMs.

Despite having tools like VirtualCenter, keeping track of your VMs can still be a mission. Today I look after thousands of virtual machines running on hundreds of ESX hosts in several data centres. Most of these VMs are production systems, some are clones of production systems, some are test and some are dev. Creating and managing machines for new services is not always an issue. We have processes in place to control VM sprawl. We know which VMs belongs to which customers. We also know who to contact in regards to which VM. This is all documented in change records and CMDBs. However, having to go back to CMDBs and change records every time you need to know who owns a VM is a bit of a slog. Sure we’ve tried adding relevant information into the “Notes” Attribute, but it gets messy and some administrators “forget” to add all the information we need into the notes.

To try and keep track of who owns what, I use a simple but very effective tool inside vCenter to manage VMs. It’s the “Custom Attribute” function of vCenter that allows administrators to specify custom attributes for all the VMs and hosts in vCenter. Custom Attributes are by no means a new feature in Virtual Infrastructure or vSphere, yet a lot of administrators don’t use them as they simply don’t realise that custom attributes functions exists or what custom attributes are for. I’ve seen many virtual Infrastructures built on VMware VI 3 (small environments to large enterprise environments) and I simply can’t recall ever seeing custom attributes being used.

What are custom attributes?

Custom Attributes are attributes that a administrator can define for all Virtual Machines and Hosts in vCenter. The attributes are then displayed in the “Annotations” box for each VM. The custom attributes are also displayed alongside the VM Name, Status, State, CPU Usage, etc, when listing virtual machines in the Datacenter, cluster, host, and resource pool views.

Why use them?

Daily, we receive lots of clone requests for VMs. Clones are very good for application development and application troubleshooting. When an application on a VM goes pear shaped, the application vendor may request a clone for a system. They can then work on the clone system to try and fix some issues while the production system (if not broken completely) may in some cases still remain partially available to the end users. Once they are confident that they have resolved the issue, they can then implement the fix in the production environment.

This is all good and well, but here’s the problem. Clones are a drain on your resources. As administrator, you should be very careful to simply hand out clones as the requests come in. Virtual Machine clones can create a nightmare for administrators as they use huge amounts of additional disk space. Some of the clones we have today are in excess of 420GB. When creating clones, we need to make sure that the following information is recorded somewhere in vCenter:

· Who requested the clone;

· The requestor’s contact number/email address

· The date that the clone was made;

· The size of the clone on disk (all vDisk sizes combined + the amount of RAM assigned to the VM);

· Does it need to be backed up (Yes / No);

· Reason for the clone;

Specifying your own Custom Attributes

Creating custom attributes is very simple. In the VI (or vSphere) client on the menu bar, click “Administration” >> “Custom Attributes...”

You’ll now be presented with the Custom Attributes dialog:

Image
Create your attributes by using the Add button. I created Virtual Machine attributes for this post.

Once you’ve created your attributes, you’ll see them in each VM’s annotation’s box on the summary page.

Image
To edit the custom attributes, click

When you click on the "edit" label in the annotations box, you get:

Image
Edit Attributes Dialog

Fill out the information for each attribute:

Image
Attributes filled out

When looking at the annotations box on the summary page of the VM, the custom attributes will be recorded and displayed for that VM:

Image
Annotations is displaying custom attribute information

The cluster view will also now display all the custom attributes. They can be filtered like any other VM attribute:

Image
Cluster View of custom attributes

No comments:

Post a Comment