This pattern's beginning to appear a lot, so time for a scope on Host::Managed I think to automate it.  For example, in app/models/host/managed.rb:

    scope :for_vm, lambda { |cr,uuid| where(:compute_resource_id => cr.id, :uuid => uuid) }

Then you can use:

    Host.for_vm(@compute_resource, vm.identity)