Adding a virtual disk to a VM and reseting your licence configuration

This article started from a need to add a VMDK to a VM for some performance testing. Part of the process was to hot add the disk to a VM and when we found that we couldn't we choose to reset the license for the host back to evaluation mode to accomplish this.
1) created a folder for disk file and then ran the below command to create the VMDK.
vmkfstools -c 255G -d eagerzeroedthick -a lsilogic IOMETER.vmdk
2) If the VM had been powered down, I could have added the below to the VMX file for the VM and then powered it on.
scsi0:1.fileName = "/vmfs/volumes/4a68046d-2159a120-ebac-001a9253e68f/IOMETER/IOMETER.vmdk"
scsi0:1.mode = "persistent"
scsi0:1.ctkEnabled = "FALSE"
scsi0:1.deviceType = "scsi-hardDisk"
scsi0:1.present = "TRUE"
scsi0:1.redo = ""
3) Instead I wanted to hot-add the disk so I ran the below commands. The first run shows the syntax of the command and with the second command I added the VMDK to the VM as device 1 on SCSI controller 0. If I had wanted to remove the virtual disk from the VM I would have used the device.diskremove option as shown below.
vim-cmd vmsvc/device.diskaddexisting
   Insufficient arguments.
   Usage: device.diskaddexisting vmid 'disk file' 'controller number' 'unit number'
   Add an existing disk to this virtual machine.
vim-cmd vmsvc/device.diskaddexisting 272 /vmfs/volumes/datastore1/IOMETER/IOMETER.vmdk 0 1
vim-cmd vmsvc/device.diskremove
   Insufficient arguments.
   Usage: device.diskremove vmid 'controller number' 'unit number' 'delete file'
Remove a disk from this virtual machine.
vim-cmd vmsvc/device.diskremove 272 0 1 n
To get information about the controller and device ID for disks, you can execute the command vim-cmd vmsvc/device.getdevices and you'll get output as shown below.
(vim.vm.device.VirtualDisk) {
 dynamicType = ,
 key = 2001,
 deviceInfo = (vim.Description) {
 dynamicType = ,
 label = "Hard disk 2",
 summary = "267386880 KB",
 },
 backing = (vim.vm.device.VirtualDisk.FlatVer2BackingInfo) {
 dynamicType = ,
 fileName = "[datastore1] IOMETER/IOMETER.vmdk",
 datastore = 'vim.Datastore:4a68046d-2159a120-ebac-001a9253e68f',
 diskMode = "persistent",
 split = false,
 writeThrough = false,
 thinProvisioned = false,
 eagerlyScrub = ,
 uuid = "6000C292-7b91-a7ed-5386-161b52701478",
 contentId = "1c86e62103b24c83b27711726578c835",
 changeId = ,
 parent = (vim.vm.device.VirtualDisk.FlatVer2BackingInfo) null,
 },
 connectable = (vim.vm.device.VirtualDevice.ConnectInfo) null,
 controllerKey = 1000,
 unitNumber = 1,
 capacityInKB = 267386880,
 shares = (vim.SharesInfo) {
 dynamicType = ,
 shares = 1000,
 level = "normal",
 },
 },
4) Now when I checked the VM, the new virtual disk was not present so I checked /var/log/messages and found the below error.
Nov 13 07:54:42 Hostd: [2009-11-13 07:54:42.538 77381B90 info 'vm:/vmfs/volumes/4aea17ed-5267d790-647d-001a9253e63a/DC05/DC05.vmx'] No hot-plug license available.
Nov 13 07:54:42 Hostd: [2009-11-13 07:54:42.538 77381B90 info 'TaskManager'] Task Completed : haTask-272-vim.VirtualMachine.reconfigure-1852796427 Status error
Nov 13 07:54:42 Hostd: [2009-11-13 07:54:42.538 77381B90 warning 'vm:/vmfs/volumes/4aea17ed-5267d790-647d-001a9253e63a/DC05/DC05.vmx'] Reconfigure worker failed to validate device spec
 
5) As shown above I was not able to add the disk as my license was not configured for hot add, so I decided to change the ESXi temporarily back to evaluation mode. Using what I had done in Part 2, I did the following:
a) Edited /etc/vmware/vmware.lic and deleted the license key.
b) Deleted the file /etc/vmware/license.cfg
c) Ran the command services.sh restart
d) I then queried the license information to check the status. The file /etc/vmware/license.cfg was automatically recreated. You'll note that for the 1st attempt of the command I got the "514 Error connecting" error. This was due to the services restart sequence completing, but the hostd service not yet being fully up yet.
After the host was in evaluation mode I reran the command to hot add the disk and it appeared in the VM. I then was able to set my license config back to the proper serial number.
/etc/vmware # vim-cmd vimsvc/license --show
   Failed to connect: 514 Error connecting to hostd-vmdb service instance.
   /etc/vmware # vim-cmd vimsvc/license --show
   [200] Sending request for installed licenses...[200] Complete, result is:
   serial: 00000-00000-00000-00000-00000
   vmodl key: eval
   name: Evaluation Mode
   total: 1
   used:  1
   unit: host
   Properties:
   [ProductName] = VMware ESX Server
   [ProductVersion] = 4.0
   [feature] = vsmp:8 ("Up to 8-way virtual SMP")
   [feature] = esxHost ("vCenter agent for ESX Server")
   [feature] = vstorage ("vStorage APIs")
   [feature] = vmsafe ("VMsafe")
   [feature] = dvfilter ("dvFilter")
   [feature] = das ("VMware HA")
   [feature] = hotplug ("Hot-Pluggable virtual HW")
   [feature] = vmotion ("VMotion")
   [feature] = ft ("VMware FT")
   [feature] = dr ("Data Recovery")
   [feature] = vshield ("vShield Zones")
   [feature] = drs ("VMware DRS")
   [feature] = svmotion ("Storage VMotion")
   [feature] = mpio ("MPIO / Third-Party Multi-Pathing")
   [feature] = dvs ("Distributed Virtual Switch")
   [feature] = hostprofile ("Host profiles")
   [evaluation] = License has not been set, evaluation Period in effect.
   [expirationHours] = 1440
   [expirationMinutes] = 0
   [expirationDate] = 2010-01-12T08:23:37.787274Z
   [system_time] = 2009-11-13T08:23:48.485374Z
[200] End of report.
 

No comments:

Post a Comment

Thank You for your Comments, We will read and response you soon...