Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
CIRCLE
/
vmdriver
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
2
Merge Requests
0
Wiki
Members
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
A prog2-höz tartozó friss repo anyagok itt elérhetőek:
https://git.iit.bme.hu/
Commit
9f3a4d19
authored
Aug 16, 2013
by
Guba Sándor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
adding LIBVIRT_KEEPALIVE os environment setting
parent
c2c050a7
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
5 deletions
+10
-5
vmdriver.py
+10
-5
No files found.
vmdriver.py
View file @
9f3a4d19
...
...
@@ -25,6 +25,9 @@ state_dict = {0: 'NOSTATE',
@decorator
def
req_connection
(
original_function
,
*
args
,
**
kw
):
'''Connection checking decorator for libvirt.
If envrionment variable LIBVIRT_KEEPALIVE is set
it will use the connection from the celery worker.
'''
logging
.
debug
(
"Decorator running"
)
global
connection
...
...
@@ -50,12 +53,14 @@ def connect(connection_string='qemu:///system'):
connection_string or the local root.
'''
global
connection
if
connection
is
None
:
connection
=
libvirt
.
open
(
connection_string
)
logging
.
debug
(
"Connection estabilished to libvirt."
)
if
os
.
getenv
(
'LIBVIRT_KEEPALIVE'
)
is
None
:
if
connection
is
None
:
connection
=
libvirt
.
open
(
connection_string
)
logging
.
debug
(
"Connection estabilished to libvirt."
)
else
:
logging
.
debug
(
"There is already an active connection to libvirt."
)
else
:
logging
.
error
(
"There is already an active connection to libvirt."
)
connection
=
lib_connection
@celery.task
def
disconnect
():
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment