CP-6697

Upstream a bunch of changes requested by CloudStack (CAR-129)