[PATCH v2] qemu: Rewrite code to the pattern