[Kimchi-devel] [PATCH V3] [Kimchi] Handle Libvirt host ENOSPC event

Aline Manera alinefm at linux.vnet.ibm.com
Mon May 23 21:17:26 UTC 2016


Hi Lucio,

Some test cases are failing with this patch. Could you fix it and resend?

Thanks,
Aline Manera

---------------------
[alinefm at alinefm-TP440 kimchi]$ sudo cat  /tmp/tmp.QLQ6K1z9cG
*** Running feature tests ***
*** Feature tests completed ***
KCHVM0056E: KCHVM0056E
libvirt:  error : invalid argument: event callback already tracked
Traceback (most recent call last):
   File "/usr/lib64/python2.7/runpy.py", line 162, in _run_module_as_main
     "__main__", fname, loader, pkg_name)
   File "/usr/lib64/python2.7/runpy.py", line 72, in _run_code
     exec code in run_globals
   File "/usr/lib64/python2.7/unittest/__main__.py", line 12, in <module>
     main(module=None)
   File "/usr/lib64/python2.7/unittest/main.py", line 94, in __init__
     self.parseArgs(argv)
   File "/usr/lib64/python2.7/unittest/main.py", line 149, in parseArgs
     self.createTests()
   File "/usr/lib64/python2.7/unittest/main.py", line 158, in createTests
     self.module)
   File "/usr/lib64/python2.7/unittest/loader.py", line 130, in 
loadTestsFromNames
     suites = [self.loadTestsFromName(name, module) for name in names]
   File "/usr/lib64/python2.7/unittest/loader.py", line 91, in 
loadTestsFromName
     module = __import__('.'.join(parts_copy))
   File "test_livemigration.py", line 91, in <module>
     class LiveMigrationTests(unittest.TestCase):
   File "test_livemigration.py", line 273, in LiveMigrationTests
     @unittest.skipUnless(check_if_vm_migration_test_possible(),
   File "test_livemigration.py", line 76, in 
check_if_vm_migration_test_possible
     inst = model.Model(objstore_loc='/tmp/kimchi-store-test')
   File "/home/alinefm/wok/src/wok/plugins/kimchi/model/model.py", line 
54, in __init__
     self.events.handleEnospc(self.conn)
   File 
"/home/alinefm/wok/src/wok/plugins/kimchi/model/libvirtevents.py", line 
83, in handleEnospc
     libvirt.VIR_DOMAIN_EVENT_ID_IO_ERROR_REASON
   File 
"/home/alinefm/wok/src/wok/plugins/kimchi/model/libvirtconnection.py", 
line 67, in wrapper
     ret = f(*args, **kwargs)
   File "/usr/lib64/python2.7/site-packages/libvirt.py", line 4919, in 
domainEventRegisterAny
     raise libvirtError ('virConnectDomainEventRegisterAny() failed', 
conn=self)
libvirt.libvirtError: invalid argument: event callback already tracked
.*** Running feature tests ***
libvirt: Domain Config error : this function is not supported by the 
connection driver: virDomainAttachDeviceFlags
*** Feature tests completed ***
cpu_info topology not supported.
libvirt: Node Device Driver error : this function is not supported by 
the connection driver: virConnectListAllNodeDevices
libvirt: Node Device Driver error : this function is not supported by 
the connection driver: virConnectListAllNodeDevices
libvirt: Node Device Driver error : this function is not supported by 
the connection driver: virConnectListAllNodeDevices
..libvirt:  error : invalid argument: event callback already tracked
Ecpu_info topology not supported.
libvirt: Node Device Driver error : this function is not supported by 
the connection driver: virConnectListAllNodeDevices
libvirt: Node Device Driver error : this function is not supported by 
the connection driver: virConnectListAllNodeDevices
libvirt: Node Device Driver error : this function is not supported by 
the connection driver: virConnectListAllNodeDevices
.cpu_info topology not supported.
libvirt: Node Device Driver error : this function is not supported by 
the connection driver: virConnectListAllNodeDevices
libvirt: Node Device Driver error : this function is not supported by 
the connection driver: virConnectListAllNodeDevices
libvirt: Node Device Driver error : this function is not supported by 
the connection driver: virConnectListAllNodeDevices
.libvirt:  error : invalid argument: event callback already tracked
Eslibvirt:  error : invalid argument: event callback already tracked
Elibvirt:  error : invalid argument: event callback already tracked
Elibvirt:  error : invalid argument: event callback already tracked
Ecpu_info topology not supported.
libvirt: Node Device Driver error : this function is not supported by 
the connection driver: virConnectListAllNodeDevices
libvirt: Node Device Driver error : this function is not supported by 
the connection driver: virConnectListAllNodeDevices
libvirt: Node Device Driver error : this function is not supported by 
the connection driver: virConnectListAllNodeDevices
cpu_info topology not supported.
cpu_info topology not supported.
WOKOBJST0001E: WOKOBJST0001E
.libvirt:  error : invalid argument: event callback already tracked
Ecpu_info topology not supported.
libvirt: Node Device Driver error : this function is not supported by 
the connection driver: virConnectListAllNodeDevices
libvirt: Node Device Driver error : this function is not supported by 
the connection driver: virConnectListAllNodeDevices
libvirt: Node Device Driver error : this function is not supported by 
the connection driver: virConnectListAllNodeDevices
WOKOBJST0001E: WOKOBJST0001E
libvirt: Domain Config error : this function is not supported by the 
connection driver: virDomainMemoryStats
WOKOBJST0001E: WOKOBJST0001E
libvirt: Domain Config error : this function is not supported by the 
connection driver: virDomainMemoryStats
KCHVM0033E: KCHVM0033E
WOKOBJST0001E: WOKOBJST0001E
WOKOBJST0001E: WOKOBJST0001E
WOKOBJST0001E: WOKOBJST0001E
WOKOBJST0001E: WOKOBJST0001E
WOKOBJST0001E: WOKOBJST0001E
WOKOBJST0001E: WOKOBJST0001E
WOKOBJST0001E: WOKOBJST0001E
WOKOBJST0001E: WOKOBJST0001E
WOKOBJST0001E: WOKOBJST0001E
WOKOBJST0001E: WOKOBJST0001E
.libvirt:  error : invalid argument: event callback already tracked
Elibvirt:  error : invalid argument: event callback already tracked
Elibvirt:  error : invalid argument: event callback already tracked
Elibvirt:  error : invalid argument: event callback already tracked
Ecpu_info topology not supported.
libvirt: Node Device Driver error : this function is not supported by 
the connection driver: virConnectListAllNodeDevices
libvirt: Node Device Driver error : this function is not supported by 
the connection driver: virConnectListAllNodeDevices
libvirt: Node Device Driver error : this function is not supported by 
the connection driver: virConnectListAllNodeDevices
WOKOBJST0001E: WOKOBJST0001E
libvirt: Domain Config error : this function is not supported by the 
connection driver: virDomainMemoryStats
libvirt: Test Driver error : Domain not found
KCHVM0002E: KCHVM0002E
.libvirt:  error : invalid argument: event callback already tracked
Elibvirt:  error : invalid argument: event callback already tracked
Elibvirt:  error : invalid argument: event callback already tracked
Elibvirt:  error : invalid argument: event callback already tracked
Elibvirt:  error : invalid argument: event callback already tracked
Elibvirt:  error : invalid argument: event callback already tracked
E
======================================================================
ERROR: test_delete_running_vm (test_model.ModelTests)
----------------------------------------------------------------------
Traceback (most recent call last):
   File "test_model.py", line 1198, in test_delete_running_vm
     inst = model.Model(objstore_loc=self.tmp_store)
   File "/home/alinefm/wok/src/wok/plugins/kimchi/model/model.py", line 
54, in __init__
     self.events.handleEnospc(self.conn)
   File 
"/home/alinefm/wok/src/wok/plugins/kimchi/model/libvirtevents.py", line 
83, in handleEnospc
     libvirt.VIR_DOMAIN_EVENT_ID_IO_ERROR_REASON
   File 
"/home/alinefm/wok/src/wok/plugins/kimchi/model/libvirtconnection.py", 
line 67, in wrapper
     ret = f(*args, **kwargs)
   File "/usr/lib64/python2.7/site-packages/libvirt.py", line 4919, in 
domainEventRegisterAny
     raise libvirtError ('virConnectDomainEventRegisterAny() failed', 
conn=self)
libvirtError: invalid argument: event callback already tracked

======================================================================
ERROR: test_image_based_template (test_model.ModelTests)
----------------------------------------------------------------------
Traceback (most recent call last):
   File "test_model.py", line 266, in test_image_based_template
     inst = model.Model(objstore_loc=self.tmp_store)
   File "/home/alinefm/wok/src/wok/plugins/kimchi/model/model.py", line 
54, in __init__
     self.events.handleEnospc(self.conn)
   File 
"/home/alinefm/wok/src/wok/plugins/kimchi/model/libvirtevents.py", line 
83, in handleEnospc
     libvirt.VIR_DOMAIN_EVENT_ID_IO_ERROR_REASON
   File 
"/home/alinefm/wok/src/wok/plugins/kimchi/model/libvirtconnection.py", 
line 67, in wrapper
     ret = f(*args, **kwargs)
   File "/usr/lib64/python2.7/site-packages/libvirt.py", line 4919, in 
domainEventRegisterAny
     raise libvirtError ('virConnectDomainEventRegisterAny() failed', 
conn=self)
libvirtError: invalid argument: event callback already tracked

======================================================================
ERROR: test_template_creates_user_defined_vol_format_instead_default 
(test_model.ModelTests)
----------------------------------------------------------------------
Traceback (most recent call last):
   File "test_model.py", line 753, in 
test_template_creates_user_defined_vol_format_instead_default
     inst = model.Model(objstore_loc=self.tmp_store)
   File "/home/alinefm/wok/src/wok/plugins/kimchi/model/model.py", line 
54, in __init__
     self.events.handleEnospc(self.conn)
   File 
"/home/alinefm/wok/src/wok/plugins/kimchi/model/libvirtevents.py", line 
83, in handleEnospc
     libvirt.VIR_DOMAIN_EVENT_ID_IO_ERROR_REASON
   File 
"/home/alinefm/wok/src/wok/plugins/kimchi/model/libvirtconnection.py", 
line 67, in wrapper
     ret = f(*args, **kwargs)
   File "/usr/lib64/python2.7/site-packages/libvirt.py", line 4919, in 
domainEventRegisterAny
     raise libvirtError ('virConnectDomainEventRegisterAny() failed', 
conn=self)
libvirtError: invalid argument: event callback already tracked

======================================================================
ERROR: test_template_get_default_vol_format_from_conf 
(test_model.ModelTests)
----------------------------------------------------------------------
Traceback (most recent call last):
   File "test_model.py", line 728, in 
test_template_get_default_vol_format_from_conf
     inst = model.Model(objstore_loc=self.tmp_store)
   File "/home/alinefm/wok/src/wok/plugins/kimchi/model/model.py", line 
54, in __init__
     self.events.handleEnospc(self.conn)
   File 
"/home/alinefm/wok/src/wok/plugins/kimchi/model/libvirtevents.py", line 
83, in handleEnospc
     libvirt.VIR_DOMAIN_EVENT_ID_IO_ERROR_REASON
   File 
"/home/alinefm/wok/src/wok/plugins/kimchi/model/libvirtconnection.py", 
line 67, in wrapper
     ret = f(*args, **kwargs)
   File "/usr/lib64/python2.7/site-packages/libvirt.py", line 4919, in 
domainEventRegisterAny
     raise libvirtError ('virConnectDomainEventRegisterAny() failed', 
conn=self)
libvirtError: invalid argument: event callback already tracked

======================================================================
ERROR: test_template_uses_qcow2_format_if_no_user_or_default_defined 
(test_model.ModelTests)
----------------------------------------------------------------------
Traceback (most recent call last):
   File "test_model.py", line 782, in 
test_template_uses_qcow2_format_if_no_user_or_default_defined
     inst = model.Model(objstore_loc=self.tmp_store)
   File "/home/alinefm/wok/src/wok/plugins/kimchi/model/model.py", line 
54, in __init__
     self.events.handleEnospc(self.conn)
   File 
"/home/alinefm/wok/src/wok/plugins/kimchi/model/libvirtevents.py", line 
83, in handleEnospc
     libvirt.VIR_DOMAIN_EVENT_ID_IO_ERROR_REASON
   File 
"/home/alinefm/wok/src/wok/plugins/kimchi/model/libvirtconnection.py", 
line 67, in wrapper
     ret = f(*args, **kwargs)
   File "/usr/lib64/python2.7/site-packages/libvirt.py", line 4919, in 
domainEventRegisterAny
     raise libvirtError ('virConnectDomainEventRegisterAny() failed', 
conn=self)
libvirtError: invalid argument: event callback already tracked

======================================================================
ERROR: test_vm_cdrom (test_model.ModelTests)
----------------------------------------------------------------------
Traceback (most recent call last):
   File "test_model.py", line 581, in test_vm_cdrom
     inst = model.Model(objstore_loc=self.tmp_store)
   File "/home/alinefm/wok/src/wok/plugins/kimchi/model/model.py", line 
54, in __init__
     self.events.handleEnospc(self.conn)
   File 
"/home/alinefm/wok/src/wok/plugins/kimchi/model/libvirtevents.py", line 
83, in handleEnospc
     libvirt.VIR_DOMAIN_EVENT_ID_IO_ERROR_REASON
   File 
"/home/alinefm/wok/src/wok/plugins/kimchi/model/libvirtconnection.py", 
line 67, in wrapper
     ret = f(*args, **kwargs)
   File "/usr/lib64/python2.7/site-packages/libvirt.py", line 4919, in 
domainEventRegisterAny
     raise libvirtError ('virConnectDomainEventRegisterAny() failed', 
conn=self)
libvirtError: invalid argument: event callback already tracked

======================================================================
ERROR: test_vm_disk (test_model.ModelTests)
----------------------------------------------------------------------
Traceback (most recent call last):
   File "test_model.py", line 485, in test_vm_disk
     inst = model.Model(objstore_loc=self.tmp_store)
   File "/home/alinefm/wok/src/wok/plugins/kimchi/model/model.py", line 
54, in __init__
     self.events.handleEnospc(self.conn)
   File 
"/home/alinefm/wok/src/wok/plugins/kimchi/model/libvirtevents.py", line 
83, in handleEnospc
     libvirt.VIR_DOMAIN_EVENT_ID_IO_ERROR_REASON
   File 
"/home/alinefm/wok/src/wok/plugins/kimchi/model/libvirtconnection.py", 
line 67, in wrapper
     ret = f(*args, **kwargs)
   File "/usr/lib64/python2.7/site-packages/libvirt.py", line 4919, in 
domainEventRegisterAny
     raise libvirtError ('virConnectDomainEventRegisterAny() failed', 
conn=self)
libvirtError: invalid argument: event callback already tracked

======================================================================
ERROR: test_vm_edit (test_model.ModelTests)
----------------------------------------------------------------------
Traceback (most recent call last):
   File "test_model.py", line 955, in test_vm_edit
     objstore_loc=self.tmp_store)
   File "/home/alinefm/wok/src/wok/plugins/kimchi/model/model.py", line 
54, in __init__
     self.events.handleEnospc(self.conn)
   File 
"/home/alinefm/wok/src/wok/plugins/kimchi/model/libvirtevents.py", line 
83, in handleEnospc
     libvirt.VIR_DOMAIN_EVENT_ID_IO_ERROR_REASON
   File 
"/home/alinefm/wok/src/wok/plugins/kimchi/model/libvirtconnection.py", 
line 67, in wrapper
     ret = f(*args, **kwargs)
   File "/usr/lib64/python2.7/site-packages/libvirt.py", line 4919, in 
domainEventRegisterAny
     raise libvirtError ('virConnectDomainEventRegisterAny() failed', 
conn=self)
libvirtError: invalid argument: event callback already tracked

======================================================================
ERROR: test_vm_graphics (test_model.ModelTests)
----------------------------------------------------------------------
Traceback (most recent call last):
   File "test_model.py", line 313, in test_vm_graphics
     inst = model.Model(objstore_loc=self.tmp_store)
   File "/home/alinefm/wok/src/wok/plugins/kimchi/model/model.py", line 
54, in __init__
     self.events.handleEnospc(self.conn)
   File 
"/home/alinefm/wok/src/wok/plugins/kimchi/model/libvirtevents.py", line 
83, in handleEnospc
     libvirt.VIR_DOMAIN_EVENT_ID_IO_ERROR_REASON
   File 
"/home/alinefm/wok/src/wok/plugins/kimchi/model/libvirtconnection.py", 
line 67, in wrapper
     ret = f(*args, **kwargs)
   File "/usr/lib64/python2.7/site-packages/libvirt.py", line 4919, in 
domainEventRegisterAny
     raise libvirtError ('virConnectDomainEventRegisterAny() failed', 
conn=self)
libvirtError: invalid argument: event callback already tracked

======================================================================
ERROR: test_vm_ifaces (test_model.ModelTests)
----------------------------------------------------------------------
Traceback (most recent call last):
   File "test_model.py", line 365, in test_vm_ifaces
     inst = model.Model(objstore_loc=self.tmp_store)
   File "/home/alinefm/wok/src/wok/plugins/kimchi/model/model.py", line 
54, in __init__
     self.events.handleEnospc(self.conn)
   File 
"/home/alinefm/wok/src/wok/plugins/kimchi/model/libvirtevents.py", line 
83, in handleEnospc
     libvirt.VIR_DOMAIN_EVENT_ID_IO_ERROR_REASON
   File 
"/home/alinefm/wok/src/wok/plugins/kimchi/model/libvirtconnection.py", 
line 67, in wrapper
     ret = f(*args, **kwargs)
   File "/usr/lib64/python2.7/site-packages/libvirt.py", line 4919, in 
domainEventRegisterAny
     raise libvirtError ('virConnectDomainEventRegisterAny() failed', 
conn=self)
libvirtError: invalid argument: event callback already tracked

======================================================================
ERROR: test_vm_lifecycle (test_model.ModelTests)
----------------------------------------------------------------------
Traceback (most recent call last):
   File "test_model.py", line 142, in test_vm_lifecycle
     inst = model.Model(objstore_loc=self.tmp_store)
   File "/home/alinefm/wok/src/wok/plugins/kimchi/model/model.py", line 
54, in __init__
     self.events.handleEnospc(self.conn)
   File 
"/home/alinefm/wok/src/wok/plugins/kimchi/model/libvirtevents.py", line 
83, in handleEnospc
     libvirt.VIR_DOMAIN_EVENT_ID_IO_ERROR_REASON
   File 
"/home/alinefm/wok/src/wok/plugins/kimchi/model/libvirtconnection.py", 
line 67, in wrapper
     ret = f(*args, **kwargs)
   File "/usr/lib64/python2.7/site-packages/libvirt.py", line 4919, in 
domainEventRegisterAny
     raise libvirtError ('virConnectDomainEventRegisterAny() failed', 
conn=self)
libvirtError: invalid argument: event callback already tracked

======================================================================
ERROR: test_vm_list_sorted (test_model.ModelTests)
----------------------------------------------------------------------
Traceback (most recent call last):
   File "test_model.py", line 1225, in test_vm_list_sorted
     inst = model.Model(objstore_loc=self.tmp_store)
   File "/home/alinefm/wok/src/wok/plugins/kimchi/model/model.py", line 
54, in __init__
     self.events.handleEnospc(self.conn)
   File 
"/home/alinefm/wok/src/wok/plugins/kimchi/model/libvirtevents.py", line 
83, in handleEnospc
     libvirt.VIR_DOMAIN_EVENT_ID_IO_ERROR_REASON
   File 
"/home/alinefm/wok/src/wok/plugins/kimchi/model/libvirtconnection.py", 
line 67, in wrapper
     ret = f(*args, **kwargs)
   File "/usr/lib64/python2.7/site-packages/libvirt.py", line 4919, in 
domainEventRegisterAny
     raise libvirtError ('virConnectDomainEventRegisterAny() failed', 
conn=self)
libvirtError: invalid argument: event callback already tracked

======================================================================
ERROR: test_vm_memory_hotplug (test_model.ModelTests)
----------------------------------------------------------------------
Traceback (most recent call last):
   File "test_model.py", line 807, in test_vm_memory_hotplug
     inst = model.Model(None, objstore_loc=self.tmp_store)
   File "/home/alinefm/wok/src/wok/plugins/kimchi/model/model.py", line 
54, in __init__
     self.events.handleEnospc(self.conn)
   File 
"/home/alinefm/wok/src/wok/plugins/kimchi/model/libvirtevents.py", line 
83, in handleEnospc
     libvirt.VIR_DOMAIN_EVENT_ID_IO_ERROR_REASON
   File 
"/home/alinefm/wok/src/wok/plugins/kimchi/model/libvirtconnection.py", 
line 67, in wrapper
     ret = f(*args, **kwargs)
   File "/usr/lib64/python2.7/site-packages/libvirt.py", line 4919, in 
domainEventRegisterAny
     raise libvirtError ('virConnectDomainEventRegisterAny() failed', 
conn=self)
libvirtError: invalid argument: event callback already tracked

======================================================================
ERROR: test_vm_netboot (test_model.ModelTests)
----------------------------------------------------------------------
Traceback (most recent call last):
   File "test_model.py", line 436, in test_vm_netboot
     inst = model.Model(objstore_loc=self.tmp_store)
   File "/home/alinefm/wok/src/wok/plugins/kimchi/model/model.py", line 
54, in __init__
     self.events.handleEnospc(self.conn)
   File 
"/home/alinefm/wok/src/wok/plugins/kimchi/model/libvirtevents.py", line 
83, in handleEnospc
     libvirt.VIR_DOMAIN_EVENT_ID_IO_ERROR_REASON
   File 
"/home/alinefm/wok/src/wok/plugins/kimchi/model/libvirtconnection.py", 
line 67, in wrapper
     ret = f(*args, **kwargs)
   File "/usr/lib64/python2.7/site-packages/libvirt.py", line 4919, in 
domainEventRegisterAny
     raise libvirtError ('virConnectDomainEventRegisterAny() failed', 
conn=self)
libvirtError: invalid argument: event callback already tracked

======================================================================
ERROR: test_vm_serial (test_model.ModelTests)
----------------------------------------------------------------------
Traceback (most recent call last):
   File "test_model.py", line 344, in test_vm_serial
     inst = model.Model(objstore_loc=self.tmp_store)
   File "/home/alinefm/wok/src/wok/plugins/kimchi/model/model.py", line 
54, in __init__
     self.events.handleEnospc(self.conn)
   File 
"/home/alinefm/wok/src/wok/plugins/kimchi/model/libvirtevents.py", line 
83, in handleEnospc
     libvirt.VIR_DOMAIN_EVENT_ID_IO_ERROR_REASON
   File 
"/home/alinefm/wok/src/wok/plugins/kimchi/model/libvirtconnection.py", 
line 67, in wrapper
     ret = f(*args, **kwargs)
   File "/usr/lib64/python2.7/site-packages/libvirt.py", line 4919, in 
domainEventRegisterAny
     raise libvirtError ('virConnectDomainEventRegisterAny() failed', 
conn=self)
libvirtError: invalid argument: event callback already tracked

======================================================================
ERROR: test_vm_storage_provisioning (test_model.ModelTests)
----------------------------------------------------------------------
Traceback (most recent call last):
   File "test_model.py", line 671, in test_vm_storage_provisioning
     inst = model.Model(objstore_loc=self.tmp_store)
   File "/home/alinefm/wok/src/wok/plugins/kimchi/model/model.py", line 
54, in __init__
     self.events.handleEnospc(self.conn)
   File 
"/home/alinefm/wok/src/wok/plugins/kimchi/model/libvirtevents.py", line 
83, in handleEnospc
     libvirt.VIR_DOMAIN_EVENT_ID_IO_ERROR_REASON
   File 
"/home/alinefm/wok/src/wok/plugins/kimchi/model/libvirtconnection.py", 
line 67, in wrapper
     ret = f(*args, **kwargs)
   File "/usr/lib64/python2.7/site-packages/libvirt.py", line 4919, in 
domainEventRegisterAny
     raise libvirtError ('virConnectDomainEventRegisterAny() failed', 
conn=self)
libvirtError: invalid argument: event callback already tracked

----------------------------------------------------------------------
Ran 25 tests in 15.769s

FAILED (errors=16, skipped=1)



On 05/23/2016 05:46 PM, Lucio Correia wrote:
> When storage pool is out of space and guest requires more,
> guest is paused and nothing is told to the user. This patch
> uses Libvirt Event handling and Asynchronous Notifications
> mechanism to tell web users about what happened.
>
> Signed-off-by: Lucio Correia <luciojhc at linux.vnet.ibm.com>
> ---
>   i18n.py                |  1 +
>   model/libvirtevents.py | 25 +++++++++++++++++++++++++
>   model/model.py         |  3 +++
>   3 files changed, 29 insertions(+)
>
> Changes in v3: rebased with master
>
> diff --git a/i18n.py b/i18n.py
> index 3a5a9d1..2d8390f 100644
> --- a/i18n.py
> +++ b/i18n.py
> @@ -335,6 +335,7 @@ messages = {
>       "KCHEVENT0001E": _("Failed to register the default event implementation."),
>       "KCHEVENT0002E": _("Failed to register timeout event."),
>       "KCHEVENT0003E": _("Failed to Run the default event implementation."),
> +    "KCHEVENT0004W": _("I/O error on guest '%(vm)s': storage pool out of space for %(devAlias)s (%(srcPath)s)."),
>
>       # These messages (ending with L) are for user log purposes
>       "KCHNET0001L": _("Created %(connection)s virtual network '%(name)s'"),
> diff --git a/model/libvirtevents.py b/model/libvirtevents.py
> index ab5c17d..00e9433 100644
> --- a/model/libvirtevents.py
> +++ b/model/libvirtevents.py
> @@ -22,6 +22,9 @@ import libvirt
>   import time
>
>   from wok.exception import OperationFailed
> +from wok.message import WokMessage
> +from wok.model.notifications import add_notification
> +from wok.utils import wok_log
>
>
>   class LibvirtEvents(object):
> @@ -57,3 +60,25 @@ class LibvirtEvents(object):
>       # Event loop handler used to limit length of waiting for any other event.
>       def _kimchi_EventTimeout(self, timer, opaque):
>           time.sleep(1)
> +
> +    def event_enospc_cb(self, conn, dom, path, dev, action, reason, args):
> +        if reason == "enospc":
> +            info = {
> +                "vm": dom.name(),
> +                "srcPath": path,
> +                "devAlias": dev,
> +            }
> +            add_notification("KCHEVENT0004W", info, '/plugins/kimchi')
> +            msg = WokMessage("KCHEVENT0004W", info, '/plugins/kimchi')
> +            wok_log.warning(msg.get_text())
> +
> +    def handleEnospc(self, conn):
> +        """
> +        Register Libvirt IO_ERROR_REASON event to handle host ENOSPC
> +        """
> +        conn.get().domainEventRegisterAny(
> +            None,
> +            libvirt.VIR_DOMAIN_EVENT_ID_IO_ERROR_REASON,
> +            self.event_enospc_cb,
> +            libvirt.VIR_DOMAIN_EVENT_ID_IO_ERROR_REASON
> +        )
> diff --git a/model/model.py b/model/model.py
> index ed474d2..327d5a7 100644
> --- a/model/model.py
> +++ b/model/model.py
> @@ -50,6 +50,9 @@ class Model(BaseModel):
>                    'eventsloop': self.events}
>           models = []
>
> +        # Register for Libvirt's host ENOSPC event and notify UI if it happens
> +        self.events.handleEnospc(self.conn)
> +
>           # Import task model from Wok
>           instances = get_instances('wok.model.tasks')
>           for instance in instances:




More information about the Kimchi-devel mailing list