February 4, 2012

The late recap post : AKA Top 7 things I learned in 2011

2011 was a banner year for me in accomplishing great things and learning new lessons. To recap my 2011 I thought I would share:

 

 Top 7 Things I Learned in 2011

 

1. I must be doing something right

This is the obligatory stats part of my list. Comparing 2011 to 2010 I doubled my visits, unique visitors, and pageviews. Time on site went up about 33% per visit which may just be because I cleaned up the look and made it easier to find stuff. The most interesting thing is my traffic has been much higher in the last half of this year. It is yet to be seen if I can keep this up in 2012. [Read more...]

Now for something completely different : Ubuntu 11.10, KVM, & VLAN trunking

Sometimes the path to learn something means using very different tools along the way. In my case, I have been learning more on the developing virtual network world along with some of the new DevOps toolsets popping up.

As part of this I have started using KVM as a hypervisor on an Ubuntu 11.10 platform in a portion of my home lab. I have learned quickly that getting something simple done in vSphere can be a bit of a chore in the KVM world. But on the flipside, KVM has been a fun learning experience in understanding virtualization in a more raw format.

One of these challenges I have decided to share is a simple one. I was wanting to play with the Dell-created DevOps deployment tool: Crowbar. Crowbar is an wrapper for OpsCode Chef Server. While a pretty slick little utility to research in the cloud deployment and automation space; one glaring problem is it is designed to run on Dell PowerEdge servers. Since I don’t have PowerEdge servers lying around anymore I needed to run this in a virtual machine. This in itself isn’t a huge problem as a virtual machine can pretty much match most of the logical hardware pieces needed. But, the one problem I ran into was that Crowbar out of the box likes to have a couple interfaces with the ability to tag VLANs itself. In a bare-metal world connecting 802.1q trunk ports to a server is pretty common. And even in the VMware vSphere world you can create trunk portgroups for a guest VM using documented methods(See VGT). But the problem I ran into is how do I pass a trunk port through in KVM/QEMU when using the default bridge-utils setup (not using ovswitch in this case)? [Read more...]

For Advanced Users : UBERAlign API / CLI / Powershell

From the beginning I knew some UBERAlign users would want to go into power user mode. The UBERAlign Console was designed to allow for easy use for the average Joe. But, there are people out there with the desire, guts, and ability to script and automate that want more. So this post will inform you on two other options for UBERAlign.

1. The CLI

Each vAligner is a Ubuntu Linux VM. On the VM is a set of binary files that do all work. One is a startup file for initializing, one is a daemon for accepting new jobs via the REST API, and the final is the actual magic behind the scenes. From the beginning UBERAlign was designed to be run from the command line. In fact back months ago the vSpecialist actually got a copy of this to try out and help me test. So for those that do not want to use the Console here are some reasons and instructions on how to run alignment, reclaim, and alignment+reclaim jobs manually.

Some of the reasons you may want to do this:

  1. Hate MS Windows – Since the console is a .Net WPF app some Mac users (@mcowger) have already asked how to skip using a Windows VM.
  2. VM size is too big – If the VM is more than 50% of the size of the datastore then a snapshot of it can potentially cause an out of space issue if it grows to full size (which and align can do). So if you have a good backup or are using array-based snapshots why use VMware snapshots? The CLI allows you to skip having to use a VMware snapshot which is required for using the Console.
  3. Aligns disks not attached to a VM -  The manually method just needs a valid VMDK file. Whether from a backup or anywhere. The Console requires a VM. Technically you can use tricks with snap and copy similar to the way VMware Converter works with online VM’s if you want.

So here are the steps:

  1. You must have the vAligner running and it must be on a vSphere host than can reach the datastore your VMDK is on.
  2. Make sure that any secondary disks are removed from the vAligner from a previous job.
  3. Make sure no UBERAlign Consoles are using this vAligner. Easy way is to disconnect the NIC and use the console if you are worried. If you console is showing weird FD0 garbage, grab a new copy of the vAligner OVA as this was patched.
  4. Add a Hard Disk to the vAligner (while it is running) to SCSI 0:1. Make sure and choose an existing disk and point it to the VMDK you want to run against.
  5. Login to the vAligner with root/UBERAlign.
  6. Make sure at least 15-20 seconds have passed since step 4. From the command line run: ‘fdisk –lu’ and make sure /dev/sdb is showing. Confirm the partition layout is as expected.
  7. Change directory to the UBERAlign binaries with ‘cd /opt/uberalign/bin’

Now that you have everything attached we are running to run a job. If you run ‘./uberalign’ you will see a printout of the command syntax like what follows:

./uberalign MODE  DEVICE  [OFFSET]  [ID]  [NAME]

MODE = The mode you want to run in and is formatted. Syntax:  -r:[a|r|s|c]

  • [a] = Align & Reclaim
  • [r] = Align only
  • [s] =  Simulate
  • [c] = Check alignment only
  • [z] = Reclaim only

DEVICE = The hardware device your VMDK is mounted on(normally /dev/sdb): Syntax: /dev/sdb

OFFSET = The target offset you want to align to. This defaults to 2048 sectors if not specified.

ID / NAME = Only useful for the API leave these off or use for logging purposes.

Example:

./uberalign –r:a /dev/sdb 2048

Once you run this command the uberalign program will process and log to the screen it’s progress while it works. When it completes, disconnect your VMDK from the vAligner and check your VMDK within a VM. It is as simple as that.

2. The API

The UBERAlign vAligner comes with a REST API that the UBERConsole uses for managing. While the state machine, orchestration for vSphere, and GUI are all a part of the console; you can still use the vAligner API to integrate into any existing processes you may have. Here is a short guide to the REST API. All data is return in JSON format. The first section explains the API get/put and the second explains the object structure in a pseudo format.

Methods

Root Path: http://<valigner IP>/uberalign/api/

Get Current State (GET)
Path: /uberalign/api/state
Parameter: n/a
Return: UAState
Description: Returns the current state of the vAligner

Get Current Job (GET)
Path: /uberalign/api/job/current
Parameter: n/a
Return: UAJob
Description: Returns the current job of the vAligner. On first boot this is an rather blank object.

Get All Completed(Historical) Jobs (GET)
Path: /uberalign/api/job
Parameter: n/a
Return: UAJob[]
Description: Returns an array with all completed jobs. This list will include all jobs still the vAligner was first deployed. Can be useful for historical purposes.

Get Session (GET)
Path: /uberalign/api/session
Parameter: n/a
Return: UASessionLock
Description: Returns the session lock information. This object contains information on the current lock status of the vAligner.

Lock vAligner (PUT)
Path: /uberalign/api/session/lock
Parameter: UASessionLock
Return: string (“true” | “false”)
Description: Used to lock a vAligner for 30 seconds. A locked vAligner will not accept new jobs from another source. Once a job is started it will not accept a new job until idle again. Use this method to maintain a lock on a vAligner while using it. Must specify a unique GUID that must match the GUID in the job ticket. GUID is a string and should be unique and not change for the duration of the session.

Submit New Job Ticket (PUT)
Path: /uberalign/api/job/new
Parameter: UAJobTicket
Return: string (“true” | “false”)
Description: Used to submit a new job ticket to the vAligner. A job ticket goes into a queue and is picked up by the daemon <15 seconds. The submitted UAJobTicket must have the same GUID as the lock and a lock must exist. Also the vAligner state must either be in Idle(0) or IdleWithError(9). You can use both the Get Current State and Get Current Job to watch for a job starting. The Current Job returns the UAJob object which will have a Name and ID that will match the  UAJobTicket Name and GUID fields you submitted.

 

Object Definitions:

Class UAState
{
string ip;
string errmsg;
string mac;
States state;
}

Class UAJob
{
string id;
string name;
string disk;
UADiskDetails diskdetails;
int offset;
States type;
string errmsg;
string currentstep;
string laststep;
double duration;
UAPartition[] partitions;
string msg;
string timestamp;
string completetimestamp;
}

Class UAPartition
{
string _system;
string _aligned;
string _id;
string _device;
string _offsetdiff;
string _boot;
string _start;
string _blocks;
string _end;
}

Class UADiskDetails
{
string _cyclinders;
string _size;
string _sectorsize;
string _totalsectors;
string _sectoratrack;
string _heads;
string _diskserial;
}

Class UASessionLock
{
string guid;
string ip;
int timestamp;
bool locked;
int secondsleft;
}

Class UAJobTicket
{
States type;
double offset;
string id;
string name;
string guid;
}

Enum States
{
Idle = 0,
AlignNoZero = 1,
AlignWithZero = 2,
Simulate = 3,
CheckOnly = 4,
ZeroOnly = 5,
GrowOnly = 6,
IdleWithError = 9
}

The objects above are simplified from my C# class structure.

This workflow for a job submission would look like this:

  1. Check vAligner state (is idle?)
  2. Lock vAligner (and continue to re-lock <30s until done with it)
  3. Mount Disk using vSphere API/Manually
  4. Create and submit new Job Ticket
  5. Watch vAligner State and Current Job to watch status
  6. After seeing the job completes (state=Idle or IdleWithError) un-mount disk

 

 

I know what some of you are going to say now: “But, Nick – how can I use the API now?”. The answer is provided by the vSpecialist rock-star Clint Kitson in his EMC Community release today. Clint built an awesome example of using Powershell to integrate and control UBERAlign via the REST API. This is so cool because if you already have scripting/code toolsets you use for automation, you can integrate UBERAlign right in. Check out more on this in Clint’ post here.

This is a basic overview and I am sure will probably just lead to more questions Smile. Please feel free to play around with both the CLI and API and post questions/comments below.

Thanks,

.nick

Straighten up with a new UBER tool : Presenting UBERAlign

NOTICE: For more info on UBERAlign Advanced (API / CLI / Powershell) features also read the new post here: http://nickapedia.com/2011/11/07/for-advanced-users-uberalign-api-cli-powershell/

You know how in cartoons they show a small snowball rolling down a hill until it grows into a massive beast of a snow boulder?

Well, that is kind of how my most recent UBER project has gone. I know it is a been a little while since I have released a tool for the community and I am hopefully making that up with my newest creation: UBERAlign.

The idea of creating this came from the lack of a decent free alignment tool out there for VMware admins. Most every other one at there was either something you had to purchase or you had to be a customer of the vender to get access to it. And even after getting access these tools were either (in my opinion) limited in what they did, how they did it, or had become obsolete in a console-less vSphere 5 architecture.

For those they don’t know, alignment with Virtual Machine disks on top of Storage Arrays has been a performance issue for a long time. I won’t go into long detail explaining the problem or the benefits to alignment. There are great posts by Duncan (http://www.yellow-bricks.com/2010/04/08/aligning-your-vms-virtual-harddisks/) and Kevin(http://www.blueshiftblog.com/?p=300) on what the issues are and some of the tools available.

So my goal in creating UBERAlign was to once and for all create a free and powerful tool resolve this issue for everyone in the VMware community. Along the way I ended up probably overdoing the way I went about it. Turns out there are issues with aligning Windows boot disks, drive letter mappings getting lost on changes, current tools requiring copying of the whole disk, and tools frying NTFS metadata. I ended up deep in the weeds learning more than I have wanted to about NTFS, MBR/GPT, and disk logical formats. I also ended spending days writing data movement algorithms on my whiteboard over and over and I tried to solve specific problems with aligning a VM. And along the way I realized I had an opportunity to solve another issue that did not have a good universal answer.

So let me cut the background story down and get right to the details.

Presenting UBERAlign, a tool for VMware Virtual Machine alignment and Space Reclamation3

Features:

  • Allows for fast alignment checking of virtual machines with detailed logging.
  • Can perform alignment to any offset you want. Even the crazy ones that you shouldn’t choose.
  • Works with both Windows 2000/XP/2003/2008 (NTFS) and Linux Distros (EXT2/EXT3/EXT4).
  • Is able to work on NTFS boot drives perfectly. It does this by rewriting NTFS Metadata (the right way).
  • Auto detects Windows 2008 and Windows 7 native installs (alignment not needed). Will not touch a System Reserved Partition (important for Windows 2008).
  • Preserves all Windows drive mapping (AFAIK only one to do so). This means no having to remap drive letters and complete support for non “C:\”  system drives with some Windows builds (some Citrix stuff).
  • Doesn’t trash the NTFS and Boot mirrors like other tools.
  • Handles Primary and Extended partitions like it is no big deal on both Windows and Linux.
  • Has the ability to handle multiple disks for a VM.
  • Multiple disks + Multiple Partitions + Multiple types (primary, logical) + Multiple file systems (NTFS, EXT#) =  no problem
  • Also allows for optional Space Reclamation on both NTFS and Ext! That’s right: you can choose to do space reclamation at the same time as an alignment or as a option to itself. This means you can retrieve space no longer used on Thin VM’s using UBERAlign.
  • Operational model allows for completely CONCURRENCY with processing VMs. You can run up to 6 simultaneous jobs per Console and as many Consoles as your VCenter can handle. This was designed to allow people with big environments to process through a large set of VM’s.
  • Options to check, align, or reclaim any choice of disks in a VM.
  • Powerful very simple to use graphic console and easy to deploy OVA’s.
  • Orchestration for batch operations allowing you to process groups of VM’s with just a couple clicks.
  • Getting started is simple with just entering VCenter credentials/IP and pointing at a vAligner.
  • Space Reclamation should also help with possibly speeding up defragmentation of some NTFS file systems after. Your mileage may vary.
  • Space Reclamation can help you turn a thick VM into a thin one and actually get the space back!
  • Does all operations IN-PLACE! My first big goal was this. No more having to copy disks using the ESX command line(especially since ESX is going away). This will process a VM’s disks in-place.
  • Automatically makes a snapshot before running for failback. If you turn on your VM to check it and see anything you don’t like you can simply revert to the UBERAlign snapshot and be right back. (You should always have a backup and test also, see prereqs)
  • Automatically rolls the snapshots back if it sees an error. UBERAlign has the ability to do health check throughout the jobs and if it sees something wrong it will roll back it’s own snapshots for you.
  • Automatically enables CHKDSK scanning on each NTFS volume on the next boot.
  • Completely Storage Array agnostic. That’s right: if it connects to vSphere and host storage UBERAlign will work with it. This includes local disks (see prereqs below) and arrays other than EMC. Don’t say that the EMC vSpecialists don’t love all VMware users.
  • Completed tested against vSphere 4.1 / 5 environments.

So as you can see UBERAlign got to be a bit of a beast along the way.

2UBERAlign comes in two pieces. The UBERAlign Console which is a graphical interface meant to be run on a Windows XP/7/Server system with .Net 4.0 or greater. And the UBERAlign vAligner vAppliance which is deployed from OVA into a vSphere environment. The console connect to the vSphere via SOAP and to up to 6 vAligners via REST interface. The way it works is: each vAligner can process VM’s on the storage the vSphere Host it lives on has access to. So you should spread vAligners across clusters and make sure one is on any vSphere Host that has local storage you want to access.

These features are meant to make the life of a VMware admin much easier when taking on this kind of task. But, let me cover some prereqs and how-to information.

Prerequisites/Tips/Caveats:

  • All VM’s must be turned off to run any operation on. I won’t go into detail on why in-place + on is risky but suffice to say I wasn’t going to give it to you Smile
  • Console has been tested on Windows 7 SP1 and Windows 2008 R2. You need the very latest .Net 4.0 updates also.
  • As said above: only VM’s powered off and residing on storage visible to an attached vAligner will be selectable. You don’t have to restart the console but it may take up to 60 seconds for you to see a newly turned off VM.
  • Only vAligners managed by the VCenter you connected will be useable. One VCenter per console.
  • Concurrency is based on the VM level. Which means each vAligner can handle and process through different VMs. But, a single VM with multiple disks will not be split across multiple vAligners. They will process in a linear fashion one at a time.
  • If UBERAlign detects an error on a VM disk when a previous disk was processed it will revert the previous jobs also. This is because snapshots are handled at a VM-level.
  • When doing multi-disk Windows VM’s it is recommended to align them all and to use the same offset. When the System disk is processed it assumes all the disks will be done and at the same offset. You don’t HAVE to do this but you may have to remap drive letters otherwise (not a huge deal, just annoying).
  • In order for Space Reclamation to work you must boot VM (check that it is healthy), delete all snapshots, svMotion to a different datastore while specifying that you want it thin (important). Another option is to clone the existing VM from a power off state to a new VM on another datastore while 1specifying Thin for the disk format.
  • By default *Natively* installed Windows 2008 and Windows 7 installs don’t need alignment. Upgrades from Windows 2003 do. But Space Reclamation works on all of them.
  • Space Reclamation does make alignment jobs take about 15-20% longer. It all depends on the speed of the storage underneath.
  • You need to have at least 20% free space on any NTFS volume to safely align/reclaim. This can be less on a very large volume but is a safe rule to follow. If you have to, expand a drive to make a little extra room. The alignment check reports information you can use to check.
  • vAligners currently pick up a DHCP address. You can view what the address has become by looking at the info pane in VCenter. Or you can set an IP manually. The vAligners are running Ubuntu and the login is root/UBERAlign.
  • I have tested the console over WAN (Texas –> North Carolina) and it works very well.
  • LVM’s are NOT supported. Long story but #1 the test cases for this are crazy and difficult to QA and #2 technically LVM gives you its own options.
  • UBERAlign is aware of how much storage space is used/available within a datastore. It keeps track and will not start jobs if there is a possibility it could cause an out of space error.

*DISCLAIMER*
Ok, before I go any further I want to mention one important thing. UBERAlign is an experimental tool and carries no support from EMC Corporation or myself (Nicholas Weaver). It is being released in beta state and while it does have functions that allow for failback you should only perform operations on Virtual Machines for which you have a solid backup. Also, I recommend you test in your lab thoroughly to make sure you understand it fully. You accept full responsibility when you use this tool.
*DISCLAIMER*

Ok, now that that is out of the way here are a few videos showing off the console and some of the cool things you can do (these are some quick/rough cuts):

.

And now for the downloads:
(New links are HTTP, no more FTP issues)

UBERAlign Console 1.1 – FTP

UBERAlign vAligner OVA (~500 MB) – FTP

This was a long process for me. It was something I started in June and had to delay because of VMworld 2011 and side projects. It is my last tool as a vSpecialist (more on my move here) and I hope it helps the VMware community somehow. The good news is this was designed from the beginning to be hypervisor agnostic so watch for a Hyper-V and Xen version in the future.

I also want to thank Larry Whitlock (EMC vSpec) who was the primary tester during the harder part of this. Without his help I would not have gotten anywhere.

Questions, comments, and critisism are all welcomed.

.nick

Note to self : Scary choices pay off

Self-reflection is something I don’t do very often. I tend to focus on the next impossible goal and not look back. But, these last few weeks I spent a lot of my time looking back. I have been thinking about what a great run I have had so far here at EMC.

 

If you would have gone back in time and told me (relevant post : Fear and Atmosphere) that I was going to do some of the things I did in the last 1 ¾ years I would have thought you were crazy.

To be honest, when I first joined the vSpecialist team I was scared to death I would fail. I was so far outside my comfort zone going to work for a pre-sales organization with a major vendor that I didn’t have a really good idea what my job would be exactly and if I could do it.

Fast forward to now and I am sitting here typing on my Mac and thinking of all the impact that the vSpecialist organization has enabled for me. I have been able to move the ball with vAppliance and Virtual Storage hackery. I made a rap video extolling the tenacity of my group (which was watched by the CEO). I spoke at my first conference session (VMworld). I was able to help do things at both EMCWorld conferences that were never done before (VPLEX demo /Labs). And I released a ton of free tools that helped enable my community.

I also had the privilege of learning, working, and having fun next to the coolest group of men and women there is. I have made a great many friends and will always consider my run as a vSpec as a turning point in my career.

But, this post isn’t about success itself. It is about knowing that sometimes you can do great/fun things by stepping out into the unknown.

So having said that, I am excited to announce I will officially be leaving the vSpecialist organization. I have accepted a position with the EMC Office of the CTO as a technologist working with the Advanced R&D team. My new role will be as a part of the team attacking the new challenges around cloud and helping EMC be ahead of the curve in providing value to this new paradigm.

This is a bitter-sweet change as I am leaving the vSpecialists where I have a strong personal connection. I will be leaving my Tech Enablement buddies and no longer working for the management that made me who I am today.

But, life is about change and growth. And this decision is based around that goal. I had a great many choices (which I won’t share here) and making this decision was one of the hardest I have had to make. Yet, ultimately moving to the Office of the CTO is going to challenge me in a way I have never been challenged before. In my original logic I decided that EMC was a great opportunity to develop and this move is a continuation of that goal.

From a blog/community perspective this blog will no longer be as dedicated to purely VMware tools/gadgets (though it will include those also). 99% of what I am going to be working on will be confidential. But, the work will allow me to expand and comment on newer technologies and broader cloud-computing topics.

I want to thank the vSpecialist organization from my peers to my management for the incredible run and helping set me up to where I am going. I will never forget what an amazing experience it was to work with such an awesome group. I also want to thank those who provided insight and wisdom in this decision (You know who you are).

Life is full of safe and scary choices. Sometimes the scary ones pay off the most. You never know till you try.

Wish me luck.

.nick

PowerPath/VE : Free trial

If you are lucky enough to have an EMC backed virtual environment to work with; did you know that you can test drive PowerPath Virtual Edition (VE) for free? Go over to: https://community.emc.com/message/11590 and signup for a free 45 day trial.

This of course requires you use ISCSI or Fibre (i.e. block storage) with either VMware vSphere or Microsoft Hyper-V. But, if you have always been curious about what a truly intelligent multipathing could do for your environment, then this is a great way to give it a shot.

Also check out the information and video on Chad’s site (http://virtualgeek.typepad.com/virtual_geek/2010/09/emc-powerpathve-54-sp2-vsphere-enterprise.html). Also, you will need to have at least Enterprise level licensing of vSphere for a VMware environment.

.nick