refactor: extract method vm_ref_or_raise
refactor: extract method vm_ref_or_raise

Related to bp xenapi-volume-drivers

Imporve the code by extract method, and testing.

Change-Id: I8caca173266890bd99a360671e7af86759b89201

n0ano/ganttclient