For automation, I use vim-cmd utility to add existing devices as hot add into VMs.
Before running below command there are disks attached to ScsiController 0 with unit id 1,2,3,4,5,6 and when i try to add a next device for Scsi controller 1 with unit id 1 it fails,
Cmd - vim-cmd vmsvc/device.diskaddexisting 3 /vmfs/volumes/esx_ld7/esx_ld7_1527840895.vmdk scsi1 1
Failed: Reconfigure failed
When I started looking for exact issue as per the hostd.log,
2018-06-01T13:22:12.563Z warning hostd[2099399] [Originator@6876 sub=Vmsvc.vm:/vmfs/volumes/5b10f081-1bc2e1d0-c444-98f2b3f236a6/Deploy_VMWin/Deploy_VMWin.vmx opID=vim-cmd-5e-3819 user=root] The specified controller slot is already occupied by Hard Disk 2: (vim.vm.device.VirtualDisk) {
--> key = -1,
--> deviceInfo = (vim.Description) null,
--> backing = (vim.vm.device.VirtualDisk.FlatVer2BackingInfo) {
--> fileName = "[] /vmfs/volumes/esx_ld7/esx_ld7_1527840895.vmdk",
--> datastore = <unset>,
--> backingObjectId = <unset>,
--> diskMode = "persistent",
--> split = <unset>,
--> writeThrough = <unset>,
--> thinProvisioned = <unset>,
--> eagerlyScrub = <unset>,
--> uuid = <unset>,
--> contentId = <unset>,
--> changeId = <unset>,
--> parent = (vim.vm.device.VirtualDisk.FlatVer2BackingInfo) null,
--> deltaDiskFormat = <unset>,
--> digestEnabled = <unset>,
--> deltaGrainSize = <unset>,
--> deltaDiskFormatVariant = <unset>,
--> sharing = <unset>,
--> keyId = (vim.encryption.CryptoKeyId) null
--> },
--> connectable = (vim.vm.device.VirtualDevice.ConnectInfo) null,
--> slotInfo = (vim.vm.device.VirtualDevice.BusSlotInfo) null,
--> controllerKey = 1000,
--> unitNumber = 1,
--> vDiskId = (vim.vslm.ID) null,
--> virtualDiskFormat = <unset>,
--> nativeUnmanagedLinkedClone = <unset>
--> }
2018-06-01T13:22:12.564Z warning hostd[2099399] [Originator@6876 sub=Vmsvc.vm:/vmfs/volumes/5b10f081-1bc2e1d0-c444-98f2b3f236a6/Deploy_VMWin/Deploy_VMWin.vmx opID=vim-cmd-5e-3819 user=root] Method fault exception during reconfigure: N3Vim5Fault17InvalidDeviceSpec9ExceptionE(Fault cause: vim.fault.InvalidDeviceSpec
--> )
--> [context]zKq7AVICAgAAAJz7cgAVaG9zdGQAAEyZNWxpYnZtYWNvcmUuc28AAADAGwBgsBcB/1r9bGlidmltLXR5cGVzLnNvAIGiMRYBgc6GFgGBoLIWAYEutBYBgX6fEgECYotlaG9zdGQAAsoZuwJe6a4Cw+2ugTVDAQECkcLBAonLwQD1LygA0zMoAAsPNgNrgABsaWJwdGhyZWFkLnNvLjAABJ2ZDmxpYmMuc28uNgA=[/context]
2018-06-01T13:22:12.579Z info hostd[2099399] [Originator@6876 sub=Vimsvc.TaskManager opID=vim-cmd-5e-3819 user=root] Task Completed : haTask-3-vim.VirtualMachine.reconfigure-2656923718 Status error
Surprisingly,
When I ran below command it passed and added the disk against SCSI controller 0, not 1
vim-cmd vmsvc/device.diskaddexisting 3 /vmfs/volumes/esx_ld7/esx_ld7_1527840895.vmdk scsi1 8
As per .vmx file entries are,
scsi0:8.deviceType = "scsi-hardDisk"
scsi0:8.fileName = "/vmfs/volumes/5b10f551-104555a6-b83b-98f2b3f236a6/esx_ld7_1527840895.vmdk"
scsi0:8.present = "TRUE"
scsi0:8.redo = ""
Can anyone please guide me here, there seems to be some issue.