I'm scripting some VM operations using commands on ESX 3.0.1 console.
One of the steps is to rescan iSCSI software HBA, register VM and start VM.
Step 1 - Rescan iSCSI HBA:
\[root@esx7 root]# /usr/sbin/esxcfg-rescan vmhba40
Doing iSCSI discovery. This can take a few seconds ...
Rescanning vmhba40...done.
On scsi5, removing:.
On scsi5, adding: 0:0.
That worked fine, can see the vmfs:
\[root@esx7 root]# ls -al /vmfs/volumes/VMware.Demo.AD0/
total 574528
drwxrwxrwt 1 root root 1120 Feb 13 17:20 .
drwxrwxrwx 1 root root 512 Mar 7 15:30 ..
-r----
1 root root 229376 Feb 13 17:18 .fbb.sf
-r----
1 root root 64946176 Feb 13 17:18 .fdc.sf
-r----
1 root root 255655936 Feb 13 17:18 .pbc.sf
-r----
1 root root 260366336 Feb 13 17:18 .sbc.sf
-r----
1 root root 4194304 Feb 13 17:18 .vh.sf
drwxr-xr-x 1 root root 2940 Mar 7 15:29 VMware.Demo.ad0
Step 2 - Register VM:
\[root@esx7 root]# vmware-cmd -s register /vmfs/volumes/VMware.Demo.AD0/VMware.Demo.ad0/VMware.Demo.ad0.vmx
register(/vmfs/volumes/VMware.Demo.AD0/VMware.Demo.ad0/VMware.Demo.ad0.vmx) = 1
That worked fine too:
\[root@esx7 root]# vmware-cmd -l
/vmfs/volumes/45d25552-8aa9c523-bf7d-00093d1167c8/VMware.Demo.ad0/VMware.Demo.ad0.vmx
Step 3 - Start VM:
\[root@esx7 root]# vmware-cmd /vmfs/volumes/VMware.Demo.AD0/VMware.Demo.ad0/VMware.Demo.ad0.vmx start
VMControl error -999: Unknown error: SoapError: ServerFaultCode(1987) : (Attempt to power on a virtual machine with the .vmx file not stored on a NAS or VMFS version 3 datastore. The virtual machine files must be relocated or VMFS upgraded.)
Obviously, this step fails for some strange reason.
I tried to use LUN UUID instead of alias, but the result is the same:
\[root@esx7 root]# vmware-cmd /vmfs/volumes/45d25552-8aa9c523-bf7d-00093d1167c8/VMware.Demo.ad0/VMware.Demo.ad0.vmx start VMControl error -999: Unknown error: SoapError: ServerFaultCode(1987) : (Attempt to power on a virtual machine with the .vmx file not stored on a NAS or VMFS version 3 datastore. The virtual machine files must be relocated or VMFS upgraded.)
Any ideas what I'm missing?
Thaks a lot,
Dmitry
Forgot to mention that after doing rescan on vmhba40 using VI client GUI I can successfully start the VM, so it's not the VMFS issue.
Dmitry
Did you ever work out what was causing this, I have run into the exact same problem, but I'm struggling to work out the reason.
Cheers
Chris
Try running /etc/init.d/vmware-mgmt restart at the end of your script just before issueing vmware-cmd calls.
Thanks, adding a restart of the mgmt-vmware does appear to correct this when stepping through the process manually. Cheers