[libvirt] [PATCH v2] storage: Combine some duplicate code