[libvirt] [PATCH 10/22] remote generator: Refactor duplicate code