Commit e5339ccb by Guba Sándor

fixing disconnect when LIBVIRT_KEEPALIVE is defined

parent b103d9bc
#!/usr/bin/env python
import libvirt
import logging
import os
......@@ -69,12 +67,15 @@ def disconnect():
'''Disconnect from the active libvirt daemon connection.
'''
global connection
if os.getenv('LIBVIRT_KEEPALIVE') is None:
if connection is None:
logging.debug('There is no available libvirt conection.')
else:
connection.close()
logging.debug('Connection closed to libvirt.')
connection = None
else:
logging.debug('Keepalive connection should not close.')
@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