xapi: backport proposed patch from master

Signed-off-by: David Scott <dave.scott@citrix.com>