mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-09-19 04:59:01 +00:00
container: Fix failure with defining a new VM
- We write to a file and immediately this file is consumed by the virsh command. If the file is not flushed, the virsh command will see an empty file. Tests: - Without the change, virsh fails with an error message that the definition file is empty. With the change, the failure goes away. Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org> Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
This commit is contained in:
parent
80dceb12f4
commit
d144dce428
@ -1392,6 +1392,7 @@ class VM(Machine):
|
|||||||
|
|
||||||
with tempfile.NamedTemporaryFile() as file_handle:
|
with tempfile.NamedTemporaryFile() as file_handle:
|
||||||
file_handle.write(domain_xml.encode())
|
file_handle.write(domain_xml.encode())
|
||||||
|
file_handle.flush()
|
||||||
logger.info('Running `virsh define %s`', file_handle.name)
|
logger.info('Running `virsh define %s`', file_handle.name)
|
||||||
self._virsh(['define', file_handle.name],
|
self._virsh(['define', file_handle.name],
|
||||||
stdout=subprocess.DEVNULL)
|
stdout=subprocess.DEVNULL)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user