Xenapi: set hostname when performing a network reset

The hostname is removed from the metadata on Xen to address an
issue where windows instances get renamed on reboot. This
becomes a problem when a network reset is called for instances
using the agent communication mechanism. In that case the
agent will incorrectly rename the host. Thus the
hostname needs to be set prior and cleared after a network reset.

The setting of the metadata params also need to be atomic so
locking was added that matches to the locking provided by
other data (network metadata).

Fixes bug 1236877

Change-Id: I473870994c826f85a7c6ec1448171c4e4ee40ff0
Merge "Xenapi: set hostname when performing a network reset"