xenapi: Extract plugin installation functions

This change extracts the plugin installation functions, and covers the
extracted functions with tests.

Change-Id: I1d78d9e8cc4d52ee2df83d07e4c74dda4805f21a