VMware Cloud Community
veasyman625
Contributor
Contributor

HP StoreVirtual VSA - automating iSCSI LUN rescan after VSA VM powers up

I recently built a two host vSphere 5.5 production environment for a less than 30 user company. They took advantage of the free 1TB VSA licence HP is giving away.  They needed to consolidate eight very old legacy servers and total data was about 500GB.

Hardware was composed of:

2 x HP Proliant DL360p Gen8 servers with 2 x 200GB SSDs, 4 x 900GB 10k SAS HDDs, SmartCache licences (this is the Smart Array P420i providing fast hardware caching and increased IOPS using the SSDs)

1 x HP Proliant DL320 Gen v2 server with 4 x 1.2TB 10k HDDs (to act as backup and management server hosting in VMware Workstation 'vCenter Server Appliance' and 'StoreVirtual Failover Manager')

2 x HP Networking 2920 switch with stacking kit, 2 x 10GbE modules

Firstly HP StoreVirtual VSA works great!!!  It is two VSA storage systems and one failover manager (FOM) providing high availability and automatic failover.

The biggest challenge I had was making the whole environment recover automatically with all VMs powering on if power cycling or power cut, for example long power cut at the weekend and UPS shuts down hosts, power return and UPS wakes up hosts.

You see the problem is ESXi carries out the iSCSI LUN discovery before the VSA VM powers up, which means the LUNs containing the datastores with the VM files are not available and the production VMs never get powered up without manual intervention involving a storage rescan.

Two things I had to do:


1) There is a script in ESXI called /etc/rc.local.d/local.sh that needs editing (how to edit see link VMware KB: Modifying the rc.local or local.sh file in ESX/ESXi to execute commands while booting).  This is a boot time script, bit like autoexec.bat in MS-DOS.  It took me a whole day of researching and testing to come up with robust working code to add to local.sh, and here it is:

"
  vim-cmd vmsvc/power.on 3
  sleep 120
  esxcfg-swiscsi -e
  esxcfg-swiscsi -s
  vmkfstools -V
  sleep 40
  vim-cmd vmsvc/power.on 4
  vim-cmd vmsvc/power.on 5
  vim-cmd vmsvc/power.on 6

"


Quick explanation, establish VM id using vim-cmd vmsvc/getallvms and to power up use code vim-cmd vmsvc/power.on vm id.  In my case the VSA VM has vmid 3.

  • So VSA VM powers up, ESXi waits 120 seconds (sleep 120) before doing anything else.
  • Enable iSCSI software initiator (esxcfg-swiscsi -e) and scan using it (esxcfg-swiscsi -s)
  • Datastores are detected and loaded by vmkfstools -V
  • ESXi waits for 40 seconds (sleep 40) and then powers on remaining VMs


2)  In ESXi edit "Automatic Startup/Shutdown" settings, set VSA VM to start first automatically (don't worry the local.sh script would have already powered VSA VM on, so this is ignored) and to wait 120 seconds when shutting down with power down option of 'Guest Shutdown'.  Reason is when powering down ESXi the VSA VM will be last to shutdown, so ESXi has sight of the iSCSI LUNs long enough to shutdown all the the other VMs, which are set to power down in my case with zero delay.

This production environment is working well with pretty inexpensive shared storage.

Hope this helps someone!


0 Kudos
2 Replies
tlyczko
Enthusiast
Enthusiast

Happy to find this script.

Is there a way in the first line to have vim-cmd reference the VSA appliance by NAME??

Is it possible to have the next power.on commands in a loop or something similar that says for all vms in this host, start them?? -- without requiring a list??

I ask because VMs get moved from host to host...

Thank you, Tom

0 Kudos
JulianBlue
Contributor
Contributor

The thread is old, but it is important to note that HPE has provided an easy to install solution:

http://vibsdepot.hpe.com/hpe/HPE-StoreVirtual/hpe-iscsi-rescan/

Setting VM Startup/Shutdown order is still needed.

0 Kudos