HFX-1235: Clearwater SP1: fix XD catalog creation error

HFX-1235: pick changes from Creedence (https://github.com/xapi-project/xen-api/pull/1832) to Clearwater-sp1-lcm branch.
Hi - Lots of conflicts of this merge and would you please the author (@djs55, @johnelse) have a detail review for this one?