Hi,
As mentioned by aravind, you need to take backup of vm's stored in internal datastore. Personally, I would recommend to reinstall ESXi 5.1 because of three reasons,
1. In your case you are migrating from VMware Image to HP custom image.
3. There will be some unwanted files from your previous installation, which might eat up system resources (This is true for all vsphere product installation, hence people will prefer fresh installation over upgradation).
3. If you preserve your datastore by just upgrading existing OS, your internal datastore stays at VMFS 3.x version, whereas fresh install will create a VMFS 5.x version.