Why I Can't Move/Import VM in XenServer.


Ok this is what i found out, the metadata export/import via 'Backup, Restore and Update' menu in xsconsole OR using 'xe vm-export filename=xxx metadata=true vm=' will export all vm's metadata eventhough you've specify the vm in the latter, the former is ok because it is backup & restore tool.

Problem happens when you want to restore the metadata or import to another xenserver. If you follow the method from 'Backup and Restore' in the reference guide, it should be ok if you're using pool because all pools are using shared storage; and if you don't use pool, your xenserver store all the VMs in the shared storage ONLY, means the Local SR is not use at all. This way, you wont face any problem.
But, what if you have a mix of local & shared storage use. 






In my case, my initial VM is in the Local SR, then i want to move the VM to another server. According to the guide, copy the VM to a shared storage, do a backup of metatada via xsconsole or do a vm-export metadata=true, detach the shared storage, attach the shared storage 2nd server, restore metadata using xsconsole or vm-import metadata=true and this is where the invalid uuid comes in. If you look carefully the invalid uuid is the sr-uuid for Local SR of the 1st server.

eg.
$ xe vm-import filename=5.meta metadata=true preserve=true sr-uuid=e7d1242a-08b1-4b4e-457e-d0473ee1f367
The uuid you supplied was invalid.
type: SR
uuid: bf1ee19b-d25d-c7dd-89a5-aa01246f568a

no matter if you're using --force option, it just wont import. But if you really want to import it, you can by omit the metadata=true eventhough we know that we're just want to import the metadata. What will happen is, it will import all VMs from your 1st server.

eg.
$ xe vm-import filename=5cent.meta sr-uuid=e7d1242a-08b1-4b4e-457e-d0473ee1f367 preserve=true --force
The VM could not be imported.
msg: INTERNAL_ERROR: [ Tar.Header.End_of_stream ]

and then you have to do some cleanup by removing unwanted VMs and for the VM that you want, you have to check the storage that is link to the VM, mine i have to delete the current storage then attach the storage that is in the shared storage because it seems the storage id imported is invalid.

So as a conclusion, use one storage type if you want to move your VMs, xenservers in pool probably wont face this. Hope this info helps others.

Comments

Popular Posts