[libvirt PATCH v3 2/2] iohelper: refactor copy operation as a separate function