mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-11-29 08:25:10 +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:
1 parent
80dceb12f4
commit
d144dce428
1 file changed
+1
@@ -1392,6 +1392,7 @@ class VM(Machine):
|
||||
|
||||
with tempfile.NamedTemporaryFile() as file_handle:
|
||||
file_handle.write(domain_xml.encode())
|
||||
file_handle.flush()
|
||||
logger.info('Running `virsh define %s`', file_handle.name)
|
||||
self._virsh(['define', file_handle.name],
|
||||
stdout=subprocess.DEVNULL)
|
||||
|
||||
Reference in new issue
Block a user