QubesVm: ignore errors during debug VM config file creation

Currently <vm-dir>/<vm-name>.conf file is used only for debugging
purposes - the real one is passed directly to libvirt, without storing
on disk for it.
In some cases (e.g. qvm-clone) QubesVM.create_config_file() can be
called before VM directory exists and in this case it would fail.
Because it isn't critical fail in any means (the config file will be
recreated on next occasion) just ignore this error.

Final version most likely will have this part of code removed
completely.
This commit is contained in:
Marek Marczykowski 2013-06-07 05:31:31 +02:00 committed by Marek Marczykowski-Górecki
parent f159f3e168
commit 457737b6cc

View File

@ -1114,10 +1114,15 @@ class QubesVm(object):
# FIXME: This is only for debugging purposes
old_umask = os.umask(002)
conf_appvm = open(file_path, "w")
conf_appvm.write(domain_config)
conf_appvm.close()
os.umask(old_umask)
try:
conf_appvm = open(file_path, "w")
conf_appvm.write(domain_config)
conf_appvm.close()
except:
# Ignore errors
pass
finally:
os.umask(old_umask)
return domain_config