OSDN Git Service

qemu.py: better control of created files
authorAmador Pahim <apahim@redhat.com>
Mon, 22 Jan 2018 20:50:28 +0000 (21:50 +0100)
committerEduardo Habkost <ehabkost@redhat.com>
Mon, 5 Feb 2018 21:53:55 +0000 (19:53 -0200)
commitaf99fa9fe22ba1c6139d1fbe6a66f3b01d575cab
tree9f1379dc5d42d795d16f0bdc3c6bd726dc188f0e
parent74af2e59d26712aa673832ec03ec6eac53066c03
qemu.py: better control of created files

To launch a VM, we need to create basically two files: the monitor
socket (if it's a UNIX socket) and the qemu log file.

For the qemu log file, we currently just open the path, which will
create the file if it does not exist or overwrite the file if it does
exist.

For the monitor socket, if it already exists, we are currently removing
it, even if it's not created by us.

This patch moves to _pre_launch() the responsibility to create a
temporary directory to host the files so we can remove the whole
directory on _post_shutdown().

Signed-off-by: Amador Pahim <apahim@redhat.com>
Message-Id: <20180122205033.24893-2-apahim@redhat.com>
Reviewed-by: Eduardo Habkost <ehabkost@redhat.com>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
scripts/qemu.py