Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
cc-node
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Analyze
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Mirror
cc-node
Commits
9f575681
Commit
9f575681
authored
12 years ago
by
Anael Beutot
Browse files
Options
Downloads
Patches
Plain Diff
Libvirt error handling.
Only log error in case of error.
parent
2c97e81a
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
ccnode/hypervisor/__init__.py
+21
-1
21 additions, 1 deletion
ccnode/hypervisor/__init__.py
with
21 additions
and
1 deletion
ccnode/hypervisor/__init__.py
+
21
−
1
View file @
9f575681
...
...
@@ -222,6 +222,8 @@ class Hypervisor(object):
self
.
name
=
name
self
.
type
=
u
'
kvm
'
# register libvirt error handler
libvirt
.
registerErrorHandler
(
self
.
vir_error_cb
,
None
)
# libvirt event loop abstraction
self
.
vir_event_loop
=
VirEventLoop
(
self
.
handler
.
main
.
evloop
)
# This tells libvirt what event loop implementation it
...
...
@@ -259,9 +261,27 @@ class Hypervisor(object):
def
stop
(
self
):
self
.
vir_event_loop
.
stop
()
self
.
vir_con
.
close
()
# unregister callback
try
:
self
.
vir_con
.
domainEventDeregister
(
self
.
vir_cb
)
except
libvirt
.
libvirtError
:
# in case the libvirt connection is broken, it will raise the error
pass
ret
=
self
.
vir_con
.
close
()
logger
.
debug
(
'
Libvirt still handling %s ref connections
'
,
ret
)
# TODO delet objects
def
vir_error_cb
(
self
,
ctxt
,
err
):
"""
Libvirt error callback.
See http://libvirt.org/errors.html for more informations.
:param ctxt: arbitrary context data (not needed because context is
givent by self
:param err: libvirt error code
"""
logger
.
error
(
'
Libvirt error %s
'
,
err
)
def
vir_cb
(
self
,
conn
,
dom
,
event
,
detail
,
opaque
):
"""
Callback for libvirt event loop.
"""
logger
.
debug
(
'
Received event %s on domain %s, detail %s
'
,
event
,
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment