VMware Communities > VMTN > VMTN Solutions > Submit a User Solution > Documents

Linked Clones implementation for VMware VDI environment at UC Santa Barbara, ResNet

VERSION 3 Published

Created on: Dec 17, 2008 8:37 AM by lamw - Last Modified:  Jan 22, 2009 8:56 PM by lamw

Description:

Motivated by heavy disk costs and slow deployment processes, scripts were developed in-house to make VDI administration easier without incurring any additional costs above that which is necessary. The outcome of these scripts is two tools whose usage will be described in this document.

Our current environment is a small installation of about twenty thinclients (and associated virtual machines) that make up our student accessible lab computers. Total storage consumption is hovering around 80 GB on a single datastore with Linked Clones distributed across 2 ESX hosts. Each VM is configured with 2 vCPUs and 1 GB of memory. At the moment, standard applications like office productivity software is being used on the production VMs. A discussion to extend the application set to include engineering and graphics design oriented software is currently underway thanks to the capabilities of HP RGS.



Update - (1/22/2009)

An issue was found with linked clones that are joined to a Windows domain. Win2k/WinXP/Win2k3 domain members change their computer account passwords every 30 days. When linked clones have been sealed in Step 7, the computer account password generated after joining the domain is saved in the snapshot. This becomes an issue on the 30th day (or 7th day in pre-Win2k machines) when the computer account password is changed and the domain controller receives the new password. Step 8 in the procedure defines that the linked clones are reverted to their state immediately after joining the domain. On the 30th day, this causes the old computer account password of the linked clone to be in effect consequently disallowing any communication between the domain controller and the linked clone.

This problem can be solved in five ways (in order of increasing work and accessibility):

Proactive Solutions:
1) Disable machine account password changes on the domain controller as per instructions from:
http://technet.microsoft.com/en-us/library/cc785826.aspx

This can be limited to just linked clone domain members by applying the necessary group policy security setting to these domain members. This is the solution we employed. Any linked clones that are "Powered On" should be "Rebooted" or "Reverted" and then subsequently "Powered On" after updating the GPO.

2) Disable machine account password changes on the master image (before link cloning) as per instructions from:
http://support.microsoft.com/kb/154501
These instructions apply to Windows 2000 and NT. Use the Windows 2000 instructions on Windows XP. This hasn't been tested. It doesn't seem as though the domain controller will override this setting but it is up to the user to find out.

3) Retire linked clones every month which will probably happen often due to image updates.

4) Delete linked clone snapshots before password update occurs on the 30th day and resnap the clones afterwards.

Reactive Solution:
5) Delete linked clone snapshots, unjoin each linked clone from the domain, rejoin each linked clone to the domain and resnap each linked clone using my-vmware-cmd.sh. This can actually be relatively quick and effortless if scripted properly.



Tools and Hardware:

  • ghetto-esx-linked-clones.sh
  • my-vmware-cmd.sh
  • VMware ESX 3.5u3
  • VMware Virtual Center 2.5u3
  • HP SAM (Session Allocation Manager) [VDI Connection broker]
  • HP RGS Sender/Receiver
  • HP BL460c
  • HP EVA4400
  • HP T5730 thinclients


Implementation:


Step 1.
Create a Master VM image with Windows XP Professional, install VMware Tools and all applications that will be available on the Linked Clone VMs (including SAM registration and RGS Sender services). Ensure that the Master VM is set to automatically obtain an IP address via DHCP and that it is on the correct network that linked clones will be operating on.

Step 2.
Shutdown Master VM image.

Step 3.
Create Linked Clones using ghetto-esx-linked-clones.sh.

Step 4.
Create DHCP reservations on Windows DHCP server from the MAC address file that "ghetto-esx(i)-linked-clones.sh" creates using a custom .vbs DHCP IP reservation script.

Step 5.
Power on all newly created Linked Clones using VIClient if resources allow it.

Step 6.
Once powered on, a custom .vbs script utilizing WMI calls to request that the new Linked Clones join our Active Directory domain is executed from a Windows machine.

Step 7.
Once all VMs have been joined to the domain, the snap function of my-vmware-cmd.sh is run on these VMs. This is required to capture the pristine state of the system right after joining the domain.

Step 8.
At this point, the VMs are ready to be utilized by the available thinclients that have the HP SAM client installed on them. Changes that are made to the Linked Clones by users are discarded because the Linked Clones are refreshed every night using the revert function of my-vmware-cmd.sh that is scheduled with a crontab.

Step 9.
When an image needs to be rebuilt/upgraded, the Master VM image is cloned and worked on while the existing Linked Clones are online. Steps 1 through 7 are followed again on the new Master VM image and new Linked Clones are created with special attention towards disabling these new Linked Clones inside HP SAM.

Step 10.
The old inactive Linked Clones are disabled in HP SAM with old active Linked Clones left alone. The new Linked Clones are then enabled inside HP SAM. The old active Linked Clones will be manually disabled once the user logs out.

Step 11.
The purge function of my-vmware-cmd.sh is then used to destroy the old Linked Clones and all old Linked Clones are removed from HP SAM resources.

Note: With the advent of the new HP RGS licensing model, HP hardware is no longer necessary in a VMware VDI environment utilizing this display protocol.
Tags: vdi, linked, clones, ucsb
Average User Rating
(2 ratings)




Dec 19, 2008 8:59 AM lamw  says:

Forgot to mention, you can also find more scripts/resources located at:

http://engineering.ucsb.edu/~duonglt/vmware/

Jan 15, 2009 12:43 PM miji2  says:

In Step 6, would you not have to sysprep all child VMs? Or would you recommend sysprep'ping the parent VM before "sealing" it?

Jan 22, 2009 7:17 PM duonglt  says: in response to: miji2

Hi, sorry for the late reply. We do not employ sysprep here but have read a bit about how to implement it in an environment with physical PCs. The parent VM (the image that the link clones are based off of) is the one that should be sysprepp'd before running the linked clone script in step 3. Hope this helps.

Oct 15, 2009 9:41 AM cookieme  says:

Hi don't you run into networking and security issues if you don't use sysprep? I mean aren't all the child VMs identical following your procedure above? You say that you don't employ sysprep, so are you using some other tool or just leaving the child VMs as they are after they've been created?

Thanks

Oct 15, 2009 9:44 AM lamw  says: in response to: cookieme

We're using some scripts/tools we've developed in house to do the 'magic' to customize all Linked Clones VM(s) so they're unique ... else they would cause conflicts and we would not be able to add them to AD.


=========================================================================
William Lam
VMware vExpert 2009
VMware ESX/ESXi scripts and resources at: http://engineering.ucsb.edu/~duonglt/vmware/
vGhetto Script Repository
VMware Code Central - Scripts/Sample code for Developers and Administrators
VMware Developer Comuunity
Twitter: @lamw

http://engineering.ucsb.edu/~duonglt/vmware/vexpert_silver_icon.jpg

If you find this information useful, please award points for "correct" or "helpful".

Oct 15, 2009 10:16 AM duonglt  says: in response to: cookieme

And to add to this, when any system is joined to the domain, a new SID is generated for it.

VMware ESX 3.x and ESXi Scripts & Resources:
http://www.engr.ucsb.edu/~duonglt/vmware

Oct 15, 2009 10:25 AM cookieme  says: in response to: duonglt

Thank you both for you replies! If I'm going to do this in a workgroup environment (<5 virtual desktops) what is the recommended way to do the "magic"? To use sysprep? Do you perform the magic on the parent VM before making linked clones or after clones are created?

Also, in your lab environment you have setup the linked clones to be non-persistent by running a cronjob to revert any changes. I'm curious but how do you prevent the logged in users making any changes before this refresh? Do you somehow lock down the linked clones, so that all a user can do is access certain apps and their documents? Are you using anything fancy for this like Faronics Deep Freeze or something else?

Oct 19, 2009 5:26 AM cookieme  says:

Hi another question about your linked clones implementation.

I had a look through the ghetto-esx-linked-clones.sh to try and understand what it does to create the linked clones. Does it simply create new virtual machines without creating new disks and then point to the mastervm.vmdk? Or is the script doing something more complicated? The reason I'm asking is that I'm trying to understand how the child VMs are "linked clones". Are they "clones" because their .vmx files are the same (but different MAC and UUID)?
Are they "linked" because they use an existing vmdk of another vm?

Oct 20, 2009 9:26 AM lamw  says: in response to: cookieme

This doc is definitely out of date but the concepts/definitions between a thick and linked clones still hold true and should help you understand the differences: http://www.vmware.com/support/ws5/doc/ws_clone_overview.html

Here's another great article on how Linked Clones work (this is how LC's work in VMware View VDI solution ) http://rodos.haywood.org/2008/12/storage-analysis-of-vmware-view.html

=========================================================================
William Lam
VMware vExpert 2009
VMware ESX/ESXi scripts and resources at: http://engineering.ucsb.edu/~duonglt/vmware/
vGhetto Script Repository
VMware Code Central - Scripts/Sample code for Developers and Administrators
VMware Developer Comuunity
Twitter: @lamw

http://engineering.ucsb.edu/~duonglt/vmware/vexpert_silver_icon.jpg

If you find this information useful, please award points for "correct" or "helpful".