Commit e5339ccb by Guba Sándor

fixing disconnect when LIBVIRT_KEEPALIVE is defined

parent b103d9bc
#!/usr/bin/env python
import libvirt import libvirt
import logging import logging
import os import os
...@@ -69,12 +67,15 @@ def disconnect(): ...@@ -69,12 +67,15 @@ def disconnect():
'''Disconnect from the active libvirt daemon connection. '''Disconnect from the active libvirt daemon connection.
''' '''
global connection global connection
if os.getenv('LIBVIRT_KEEPALIVE') is None:
if connection is None: if connection is None:
logging.debug('There is no available libvirt conection.') logging.debug('There is no available libvirt conection.')
else: else:
connection.close() connection.close()
logging.debug('Connection closed to libvirt.') logging.debug('Connection closed to libvirt.')
connection = None connection = None
else:
logging.debug('Keepalive connection should not close.')
@celery.task @celery.task
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment