ITDevLtd / MCVirt

MCVirt - Command line virtual machine management utility
http://mcvirt.itdev.co.uk
GNU General Public License v2.0
24 stars 7 forks source link

Decrease logging on errors #421

Open MatthewJohn opened 5 years ago

MatthewJohn commented 5 years ago

When an exception is thwon, too much logging is performed.

e.g. when a VM fails to created:

2019-02-07 19:45:19,749 mcvirtd      /usr/lib/python2.7/dist-packages/mcvirt/virtual_machine/virtual_machine.py 1622: register_on_node ERROR    Libvirt error whilst registering test-vm:
invalid argument: could not find capabilities for arch=x86_64 domaintype=kvm 
2019-02-07 19:45:19,750 mcvirtd      /usr/lib/python2.7/dist-packages/mcvirt/rpc/lock.py 86: lock_log_and_call ERROR    An internal MCVirt exception occurred in lock
2019-02-07 19:45:19,750 mcvirtd      /usr/lib/python2.7/dist-packages/mcvirt/rpc/lock.py 87: lock_log_and_call ERROR    Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/mcvirt/rpc/lock.py", line 84, in lock_log_and_call
    response = callback(*args, **kwargs)
  File "/usr/lib/python2.7/dist-packages/mcvirt/virtual_machine/virtual_machine.py", line 1625, in register_on_node
    raise LibvirtException('Error: An error occurred whilst registering VM')
LibvirtException: Error: An error occurred whilst registering VM

2019-02-07 19:45:19,897 mcvirtd      /usr/lib/python2.7/dist-packages/mcvirt/rpc/expose_method.py 327: run ERROR    Expose failure: {'mcvirt1': {'args': [], 'return_val': None, 'complete': False, 'kwargs': {}}}
2019-02-07 19:45:19,898 mcvirtd      /usr/lib/python2.7/dist-packages/mcvirt/rpc/expose_method.py 328: run ERROR    Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/mcvirt/rpc/expose_method.py", line 288, in run
    self._call_function_local()
  File "/usr/lib/python2.7/dist-packages/mcvirt/rpc/expose_method.py", line 366, in _call_function_local
    self.object_type)
  File "/usr/lib/python2.7/dist-packages/mcvirt/rpc/lock.py", line 84, in lock_log_and_call
    response = callback(*args, **kwargs)
  File "/usr/lib/python2.7/dist-packages/mcvirt/virtual_machine/virtual_machine.py", line 1625, in register_on_node
    raise LibvirtException('Error: An error occurred whilst registering VM')
LibvirtException: Error: An error occurred whilst registering VM

2019-02-07 19:45:19,898 mcvirtd      /usr/lib/python2.7/dist-packages/mcvirt/rpc/lock.py 86: lock_log_and_call ERROR    An internal MCVirt exception occurred in lock
2019-02-07 19:45:19,898 mcvirtd      /usr/lib/python2.7/dist-packages/mcvirt/rpc/lock.py 87: lock_log_and_call ERROR    Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/mcvirt/rpc/lock.py", line 84, in lock_log_and_call
    response = callback(*args, **kwargs)
  File "/usr/lib/python2.7/dist-packages/mcvirt/virtual_machine/virtual_machine.py", line 1560, in _register
    self.register_on_node(nodes=[node])
  File "/usr/lib/python2.7/dist-packages/mcvirt/rpc/expose_method.py", line 559, in inner
    return_val = function.run()
  File "/usr/lib/python2.7/dist-packages/mcvirt/rpc/expose_method.py", line 288, in run
    self._call_function_local()
  File "/usr/lib/python2.7/dist-packages/mcvirt/rpc/expose_method.py", line 366, in _call_function_local
    self.object_type)
  File "/usr/lib/python2.7/dist-packages/mcvirt/rpc/lock.py", line 84, in lock_log_and_call
    response = callback(*args, **kwargs)
  File "/usr/lib/python2.7/dist-packages/mcvirt/virtual_machine/virtual_machine.py", line 1625, in register_on_node
    raise LibvirtException('Error: An error occurred whilst registering VM')
LibvirtException: Error: An error occurred whilst registering VM

2019-02-07 19:45:19,898 mcvirtd      /usr/lib/python2.7/dist-packages/mcvirt/rpc/expose_method.py 327: run ERROR    Expose failure: {'mcvirt1': {'args': [], 'return_val': None, 'complete': False, 'kwargs': {'set_node': True}}}
2019-02-07 19:45:19,898 mcvirtd      /usr/lib/python2.7/dist-packages/mcvirt/rpc/expose_method.py 328: run ERROR    Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/mcvirt/rpc/expose_method.py", line 288, in run
    self._call_function_local()
  File "/usr/lib/python2.7/dist-packages/mcvirt/rpc/expose_method.py", line 366, in _call_function_local
    self.object_type)
  File "/usr/lib/python2.7/dist-packages/mcvirt/rpc/lock.py", line 84, in lock_log_and_call
    response = callback(*args, **kwargs)
  File "/usr/lib/python2.7/dist-packages/mcvirt/virtual_machine/virtual_machine.py", line 1560, in _register
    self.register_on_node(nodes=[node])
  File "/usr/lib/python2.7/dist-packages/mcvirt/rpc/expose_method.py", line 559, in inner
    return_val = function.run()
  File "/usr/lib/python2.7/dist-packages/mcvirt/rpc/expose_method.py", line 288, in run
    self._call_function_local()
  File "/usr/lib/python2.7/dist-packages/mcvirt/rpc/expose_method.py", line 366, in _call_function_local
    self.object_type)
  File "/usr/lib/python2.7/dist-packages/mcvirt/rpc/lock.py", line 84, in lock_log_and_call
    response = callback(*args, **kwargs)
  File "/usr/lib/python2.7/dist-packages/mcvirt/virtual_machine/virtual_machine.py", line 1625, in register_on_node
    raise LibvirtException('Error: An error occurred whilst registering VM')
LibvirtException: Error: An error occurred whilst registering VM

2019-02-07 19:45:19,898 mcvirtd      /usr/lib/python2.7/dist-packages/mcvirt/rpc/lock.py 86: lock_log_and_call ERROR    An internal MCVirt exception occurred in lock
2019-02-07 19:45:19,898 mcvirtd      /usr/lib/python2.7/dist-packages/mcvirt/rpc/lock.py 87: lock_log_and_call ERROR    Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/mcvirt/rpc/lock.py", line 84, in lock_log_and_call
    response = callback(*args, **kwargs)
  File "/usr/lib/python2.7/dist-packages/mcvirt/virtual_machine/factory.py", line 327, in create
    return self._create(*args, **kwargs)
  File "/usr/lib/python2.7/dist-packages/mcvirt/virtual_machine/factory.py", line 469, in _create
    vm_object._register(set_node=self._is_cluster_master)
  File "/usr/lib/python2.7/dist-packages/mcvirt/rpc/expose_method.py", line 559, in inner
    return_val = function.run()
  File "/usr/lib/python2.7/dist-packages/mcvirt/rpc/expose_method.py", line 288, in run
    self._call_function_local()
  File "/usr/lib/python2.7/dist-packages/mcvirt/rpc/expose_method.py", line 366, in _call_function_local
    self.object_type)
  File "/usr/lib/python2.7/dist-packages/mcvirt/rpc/lock.py", line 84, in lock_log_and_call
    response = callback(*args, **kwargs)
  File "/usr/lib/python2.7/dist-packages/mcvirt/virtual_machine/virtual_machine.py", line 1560, in _register
    self.register_on_node(nodes=[node])
  File "/usr/lib/python2.7/dist-packages/mcvirt/rpc/expose_method.py", line 559, in inner
    return_val = function.run()
  File "/usr/lib/python2.7/dist-packages/mcvirt/rpc/expose_method.py", line 288, in run
    self._call_function_local()
  File "/usr/lib/python2.7/dist-packages/mcvirt/rpc/expose_method.py", line 366, in _call_function_local
    self.object_type)
  File "/usr/lib/python2.7/dist-packages/mcvirt/rpc/lock.py", line 84, in lock_log_and_call
    response = callback(*args, **kwargs)
  File "/usr/lib/python2.7/dist-packages/mcvirt/virtual_machine/virtual_machine.py", line 1625, in register_on_node
    raise LibvirtException('Error: An error occurred whilst registering VM')
LibvirtException: Error: An error occurred whilst registering VM

2019-02-07 19:45:19,898 mcvirtd      /usr/lib/python2.7/dist-packages/mcvirt/logger.py 230: finish_error ERROR    Command failed (MCVirt Exception): 2019-02-07 19:45:19.898971, mjc, virtual machine, test-vm, create, Error: An error occurred whilst registering VM
2019-02-07 19:45:19,905 mcvirtd      /usr/lib/python2.7/dist-packages/mcvirt/rpc/expose_method.py 327: run ERROR    Expose failure: {'mcvirt1': {'args': [], 'return_val': None, 'complete': False, 'kwargs': {u'modification_flags': [], u'name': u'test-vm', u'graphics_driver': None, u'network_interfaces': [u'main'], u'storage_type': u'Drbd', u'cpu_cores': 1, u'hard_drives': [u'512'], u'available_nodes': [u'mcvirt2', u'mcvirt1'], u'storage_backend': None, u'hard_drive_driver': None, u'memory_allocation': u'512'}}}
2019-02-07 19:45:19,905 mcvirtd      /usr/lib/python2.7/dist-packages/mcvirt/rpc/expose_method.py 328: run ERROR    Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/mcvirt/rpc/expose_method.py", line 288, in run
    self._call_function_local()
  File "/usr/lib/python2.7/dist-packages/mcvirt/rpc/expose_method.py", line 366, in _call_function_local
    self.object_type)
  File "/usr/lib/python2.7/dist-packages/mcvirt/rpc/lock.py", line 84, in lock_log_and_call
    response = callback(*args, **kwargs)
  File "/usr/lib/python2.7/dist-packages/mcvirt/virtual_machine/factory.py", line 327, in create
    return self._create(*args, **kwargs)
  File "/usr/lib/python2.7/dist-packages/mcvirt/virtual_machine/factory.py", line 469, in _create
    vm_object._register(set_node=self._is_cluster_master)
  File "/usr/lib/python2.7/dist-packages/mcvirt/rpc/expose_method.py", line 559, in inner
    return_val = function.run()
  File "/usr/lib/python2.7/dist-packages/mcvirt/rpc/expose_method.py", line 288, in run
    self._call_function_local()
  File "/usr/lib/python2.7/dist-packages/mcvirt/rpc/expose_method.py", line 366, in _call_function_local
    self.object_type)
  File "/usr/lib/python2.7/dist-packages/mcvirt/rpc/lock.py", line 84, in lock_log_and_call
    response = callback(*args, **kwargs)
  File "/usr/lib/python2.7/dist-packages/mcvirt/virtual_machine/virtual_machine.py", line 1560, in _register
    self.register_on_node(nodes=[node])
  File "/usr/lib/python2.7/dist-packages/mcvirt/rpc/expose_method.py", line 559, in inner
    return_val = function.run()
  File "/usr/lib/python2.7/dist-packages/mcvirt/rpc/expose_method.py", line 288, in run
    self._call_function_local()
  File "/usr/lib/python2.7/dist-packages/mcvirt/rpc/expose_method.py", line 366, in _call_function_local
    self.object_type)
  File "/usr/lib/python2.7/dist-packages/mcvirt/rpc/lock.py", line 84, in lock_log_and_call
    response = callback(*args, **kwargs)
  File "/usr/lib/python2.7/dist-packages/mcvirt/virtual_machine/virtual_machine.py", line 1625, in register_on_node
    raise LibvirtException('Error: An error occurred whilst registering VM')
LibvirtException: Error: An error occurred whilst registering VM
MatthewJohn commented 5 years ago

https://github.com/ITDevLtd/MCVirt/blob/master/source/mcvirt-daemon/usr/lib/python2.7/dist-packages/mcvirt/rpc/lock.py#L83 This appears to print for each function in the stack that uses the expose method, when an exception is thrown