Automation

 View Only
  • 1.  Rescan VMHBA & restart mgmt-vmware service cmdlet?

    Posted Mar 24, 2008 07:06 PM

    One of the tasks that take a long time for me to complete is adding new storage LUNS to my ESX hosts. Due to the way MSCS locks LUNs, I need to do it manually across all my hosts. On the first host, I need to manually rescan the vmhba, run fdisk create the partition, utilize vmkfstools to make the disk, and then restart mgmt-vmware service. Then on the rest of my hosts, I need to rescan each of their vmhba (esxcfg-rescan vmhba1), rescan with vmkfstools the same vmhba, and restart the mgmt-vmware service. Even with cut-and-paste this is a long task across multiple servers.

    Any chance of building cmdlets to help on any of these tasks?



  • 2.  RE: Rescan VMHBA & restart mgmt-vmware service cmdlet?

    Posted Mar 24, 2008 08:53 PM

    One of the tasks that take a long time for me to complete is adding new storage LUNS to my ESX hosts. Due to the way MSCS locks LUNs, I need to do it manually across all my hosts. On the first host, I need to manually rescan the vmhba, run fdisk create the partition, utilize vmkfstools to make the disk, and then restart mgmt-vmware service. Then on the rest of my hosts, I need to rescan each of their vmhba (esxcfg-rescan vmhba1), rescan with vmkfstools the same vmhba, and restart the mgmt-vmware service. Even with cut-and-paste this is a long task across multiple servers.

    Any chance of building cmdlets to help on any of these tasks?

    For our first release we plan to have cmdlets that provide what you can do through vmkfstools. Cmdlets to rescan the vmhba is scheduled for our second release. It is possible to do these remotely today (we use these in the RCLI).

    The thing I'm less sure about is fdisk and restarting hostd remotely. I don't think it's possible to do either of those remotely today, and I don't know if we currently have plans to make it possible. I'll do some checking locally to find out when/if we can have that.



  • 3.  RE: Rescan VMHBA & restart mgmt-vmware service cmdlet?

    Posted Mar 24, 2008 09:37 PM

    Thanks for your help.



  • 4.  RE: Rescan VMHBA & restart mgmt-vmware service cmdlet?

    Posted Mar 25, 2008 12:29 AM

    Now I have never done a couple of the things you are talking about so maybe I'm getting it wrong but if you want to run commands against the ESX hosts remotely there is no reason you can't script that using plink.exe and put that right inside a powershell script. I have a couple of examples of this on my blog, one of them specific to VMware: http://halr9000.com/index.php?s=plink

    Hal Rottenberg

    Co-Host, PowerScripting Podcast (http://powerscripting.net)



  • 5.  RE: Rescan VMHBA & restart mgmt-vmware service cmdlet?
    Best Answer

    Posted Mar 25, 2008 05:50 PM

    One of the tasks that take a long time for me to complete is adding new storage LUNS to my ESX hosts. Due to the way MSCS locks LUNs, I need to do it manually across all my hosts. On the first host, I need to manually rescan the vmhba, run fdisk create the partition, utilize vmkfstools to make the disk, and then restart mgmt-vmware service. Then on the rest of my hosts, I need to rescan each of their vmhba (esxcfg-rescan vmhba1), rescan with vmkfstools the same vmhba, and restart the mgmt-vmware service. Even with cut-and-paste this is a long task across multiple servers.

    Any chance of building cmdlets to help on any of these tasks?

    I think you can address the latter part of your problem using the get-vmhoststorage -RescanAllHBA. So basically you could manually create the storage on the first host, then from VC you could run get-vmhost | get-vmhoststorage -RescanAllHBA. I'm told that if you rescan the HBAs remotely through web services (as opposed to on the COS) you don't need to restart hostd. If you could let me know if that works I would greatly appreciate it, otherwise I can investigate other avenues.

    As for the other part of your problem, it is possible to partition remotely, but it seems to be pretty tricky at the moment. Unless you're feeling very adventurous you might want to wait until we have cmdlets. We're trying to see where this lands but it will be either our 1.0 GA release or our followon release.



  • 6.  RE: Rescan VMHBA & restart mgmt-vmware service cmdlet?

    Posted Mar 26, 2008 07:31 PM

    That did solve my problem -- although one of my hosts whose storage was on vmhba2 rather than vmhba1 didn't reflect the new storage. I ran this script:

    get-cluster "cluster" | get-vmhost | Get-VMHostStorage -RescanAllHBA

    get-cluster "cluster" | get-vmhost | Get-VMHostStorage -RescanAllHBA

    get-cluster "cluster" | get-vmhost | Get-VMHostStorage -refresh

    Note: I limited the install per cluster group due to LUN exposure, but needless to say, this has been one of least painful scripting procedures that I have done. At least in comparison to my trying out Viperl toolkit. All the storage was exposed and usable in VC. Thanks for the help.