cloudfoundry/bosh — pull request #580 by singerdmx (2014-05-14 19:11:06+00:00)
Title: Enable SRM on vsphere by replacing the workflow of reading settings from cdrom with reading from attached independent disk

We run three steps to create the vmdk file as follows. Then use the created vmdk file to upload and attach to VM as independent disk.
(1) Convert a file with content, such as environment settings, to an iso file
Tool: genisoimage (ref: http://linux.die.net/man/1/genisoimage)
Command: `genisoimage -o #{iso_file_path} #{original_file_path}`

(2) Convert the iso file to one vmdk file
Tool: qemu-img (To install, run `sudo apt-get install qemu`)
Command: `qemu-img convert -O vmdk #{iso_file} #{env.vmdk}`

(3) Convert the vmdk file to esx type vmdk files (one descriptor file, i.e. env.vmdk and one content file, i.e. env-flat.vmdk)
Tools: vmware-vdiskmanager (VMware Virtual Disk Manager, ref: http://www.vmware.com/pdf/VirtualDiskManager.pdf)
Command: `vmware-vdiskmanager -r #{original_vmdk_file} -t 4 #{new_vmdk_file}`
Note:
You need to install qemu and vdiskmanager and make sure vdiskmanager is in your system path
Instruction on how to install vdiskmanager:
Download vdiskmanager.tar from link https://github.com/vchs/bosh/blob/wip_remove_iso_f1/stemcell_builder/stages/system_vdiskmanager/assets/vdiskmanager.tar
Then run the following commands:
tar -xvf vdiskmanager.tar
module_dir=`ls -d /lib/modules/3.*-virtual | tail -1`
install_dir="${module_dir}/vdiskmanager"
perl vmware-vix-disklib-distrib/vmware-install.pl "$install_dir"