core: handle errors with xenstore access during VM shutdown

When netvm and firewallvm is shut down, netvm handling code will
try to revoke firewallvm access to external IP. But if netvm shutdown
happens in the meantime, xenstore will throw ENOENT error.
This commit is contained in:
Marek Marczykowski-Górecki 2014-03-13 18:32:13 +01:00
parent 840dc38730
commit 9768b38ffc

View File

@ -22,6 +22,7 @@
# #
import sys import sys
import os.path import os.path
import xen.lowlevel.xs
from qubes.qubes import QubesVm,register_qubes_vm_class,xs,dry_run from qubes.qubes import QubesVm,register_qubes_vm_class,xs,dry_run
from qubes.qubes import defaults,system_path,vm_files from qubes.qubes import defaults,system_path,vm_files
@ -120,8 +121,12 @@ class QubesNetVm(QubesVm):
for xid in self.__external_ip_allowed_xids: for xid in self.__external_ip_allowed_xids:
perms.append({ 'dom': xid, 'read': True }) perms.append({ 'dom': xid, 'read': True })
try:
xs.set_permissions('', '/local/domain/{0}/qubes-netvm-external-ip'.format(xid), xs.set_permissions('', '/local/domain/{0}/qubes-netvm-external-ip'.format(xid),
perms) perms)
except xen.lowlevel.xs.Error as e:
print >>sys.stderr, "WARNING: failed to update external IP " \
"permissions: %s" % (str(e))
def start(self, **kwargs): def start(self, **kwargs):
if dry_run: if dry_run: