Assuming that we have created a Xen VM template at DC1 and we want to transfer and import it at DC2.
First take a snapshot from VM and then export it to a file. Choose a local or network drive in DC1 to store the template file.
Transfering the template file from DC1 To DC2
Install a ftp server on the server in DC1 that contains the template file. Here we will use FileZilla.
- Install a ftp client on the server in DC2 that you want to transfer the template file.
- In ftp client click on “Edit” in the menu then Settings–> Connection
- Change the “Timeout” to 600 sec. and change the “Maximum number of retries” to 20 and “Delay between failed login attempts to 120 sec.
The reason for this step is that the transfer takes a long time and the probability of interruption of internet connection between data centers during this time is high.
By changing the settings the transfer automatically restarts after the interrupt without manual intervention.
- Make sure that the ftp client and server support resuming the transfer from the point that transfer gets interrupted.
Importing the large template to Xen server
- If the import takes more than 24 hr the transfer cannot be done using the GUI menu in XenCenter because XenServer aborts the process exactly after 24 hr. If you start the process from GUI menu the log will show “preparing to import” all the time.
- Import has to be done using command line using the Xen console in XenCenter.
- If the template is on a network drive first we have to mount it on XenServer.
# mkdir /storage
# mount -t cifs //xxx..xx.xx.xx/g$/< Folder containing the template file> -o username=administrator, password=xxxxxxxx /storage
# xe vm-import filename=/Storage/<Template File>.xva
Check the XenCenter log and make sure that it shows “importing” rather than “preparing to import”
After finishing the import the template will be added to the menu of the XenServer. Click on it and find the UUID under “General” tab
Then use the following commands to convert the template to VM
# xe template-param-set is-a-template=false uuid=6be11915-c3bd-4d5f-b3ae-262600ea8d1d
# xe-toolstack-restart