I had been involved so heavily in storage Vmotion that I decided to write about it. Nice source is here
First of all storage vmotion is
- Takes an ESX snapshot
- Then file copies the closed VDMK (which is the large majority of the VM) to the target datastore
- Then "reparents" the open (and small) VDMK to the target (synchronizing)
- Then "deletes" the snapshot (in effect merging the large VDMK with the small reparented VMDK)
Myth and deepdive:
- In a cluster if you have 5 host and have 10 luns. If you want to svmotion to 11th lun, the 11th lun should be visible to all the host in the cluster. It does not work on individual host
- You can do 1 svmotion per ESX host and maximum of 32 per cluster (Pheew)
- You can have 4 svmotion per lun . Which means you have many source lun but at a time only 4 svmotion will done at any target lun
- Storage vmotion can happen be only between on datacenter and cannot happen between two different datacenter (phewee).
- Storage VMotion cannot be used on a virtual machine with NPIV enabled
Batch Storage Vmotion
I had to do batch svmotoion and I decided to follow this guy nice article
Place postie.exe (Freeware), AutoSVmotion.vbs (Contents at then ) in the Remote CLI (Download and install it from VMWare site) bin directory (default location is "C:\Program Files\VMWare\VMWare VI Remote CLI\Bin"). Also create a batch file in this directory, this will be used to call AutoSVMotion.vbs. In the batch file put all the VM's that you require migrating in the below format:
cscript.exe AutoSVmotion.vbs %VC% %Username% %Password% %Datacentre% %SourceDatastore% %VMXFilePath% %DestDatastore% %SMTPServ% %ToEmailAddress% %FromEmailAddress%
Example of the batch file:
cscript.exe AutoSVmotion.vbs VC01 Admin P@ssw0rd London OLDLUN1 VM1/VM1.vmx NewLUN1 SMTP01 virtuallysi@example.com vikash.roy@test.com
cscript.exe AutoSVmotion.vbs VC01 Admin P@ssw0rd London OLDLUN1 VM2/VM2.vmx NewLUN1 SMTP01 virtuallysi@example.com vikash.roy@test.com
Example of the email output:
From: vikash.roy@test.com
Date: 13 September 2009 08:45:43 GMT+01:00
To: virtuallysi@example.com
Subject: SVMotion Progress Report
Successfully migrated VM1/VM1.vmx
Contents of AutoSVmotion.vbs
Dim WshShell, oArgs, sVCServer, sUsername, sPassword, sDatacenter, sSourceStore, sVMXLocation,_
sDestStore, sSMTPServer, sEmailAddress, sSVMotioncmd, iRetVal, sEMailText, sEmailCmd
On Error Resume Next
Set WshShell = WScript.CreateObject("WScript.Shell")
Set oArgs = WScript.Arguments
sVCServer = oArgs(0)
sUsername = oArgs(1)
sPassword = oArgs(2)
sDatacenter = oArgs(3)
sSourceStore = oArgs(4)
sVMXLocation = oArgs(5)
sDestStore = oArgs(6)
sSMTPServer = oArgs(7)
sToEmailAddress = oArgs(8)
sFromEmailAddress = oArgs(9)
sSVMotioncmd = "cmd.exe /c svmotion.pl --url=https://" & sVCServer & "/sdk --username=" & sUsername & _
" --password=" & sPassword & " --datacenter=" & sDatacenter & " --vm=" & Chr(34) & "[" & sSourceStore & "] " & sVMXLocation &_
":" & sDestStore & Chr(34)
WScript.Echo sSVMotioncmd
iRetVal = WshShell.Run(sSVMotioncmd, 1, True)
If iRetVal = 0 Then
sEMailText = "Successfully migrated " & sVMXLocation
sEmailCmd = "cmd.exe /c postie.exe -host:" & sSMTPServer & " -to:" & sToEmailAddress & " -from:" & sFromEmailAddress & " -s:" & Chr(34) & "SVMotion Progress Report" & Chr(34) & " -msg:" & Chr(34) & sEMailText & Chr(34)
Else
sEMailText = "SVmotion failed for " & sVMXLocation & " with error number " & iRetVal
sEmailCmd = "cmd.exe /c postie.exe -host:" & sSMTPServer & " -to:" & sToEmailAddress & " -from:" & sFromEmailAddress & " -s:" & Chr(34) & "SVMotion Progress Report" & Chr(34) & " -msg:" & Chr(34) & sEMailText & Chr(34)
End If
WshShell.Run sEmailCmd, 1, True
2 comments:
Roy thanks for the article. I need to vmotion a file server that was partition incorrectly to a new SAN (after it we will correct the partitions). The problem is that the vmfs LUN is full. I can turn off the server while I a moving storage, will that require to create a snap too?
I am assuming that you are using new version of ESX ? Even with older version 4.0 SVM does not require snapshot . You don't need to shut down the VM's if you have licensed it. It can be hot migration.
HTH
Post a Comment