Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Gelencsér Szabolcs
/
vmdriver
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Wiki
Members
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
3a347f2c
authored
Sep 25, 2013
by
Guba Sándor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixing wrapper and add logging
parent
2543f1aa
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
5 deletions
+3
-5
vmdriver.py
+3
-5
No files found.
vmdriver.py
View file @
3a347f2c
...
@@ -49,8 +49,9 @@ def req_connection(original_function, *args, **kw):
...
@@ -49,8 +49,9 @@ def req_connection(original_function, *args, **kw):
@decorator
@decorator
def
wrap_libvirtError
(
original_function
,
*
args
,
**
kw
):
def
wrap_libvirtError
(
original_function
,
*
args
,
**
kw
):
try
:
try
:
original_function
(
*
args
,
**
kw
)
return
original_function
(
*
args
,
**
kw
)
except
libvirt
.
libvirtError
as
e
:
except
libvirt
.
libvirtError
as
e
:
logging
.
error
(
e
.
get_error_message
())
new_e
=
Exception
(
e
.
get_error_message
())
new_e
=
Exception
(
e
.
get_error_message
())
new_e
.
libvirtError
=
True
new_e
.
libvirtError
=
True
raise
new_e
raise
new_e
...
@@ -120,7 +121,7 @@ def create(vm_desc):
...
@@ -120,7 +121,7 @@ def create(vm_desc):
if
vm
.
vm_type
==
"test"
:
if
vm
.
vm_type
==
"test"
:
connection
.
createXML
(
connection
.
createXML
(
vm
.
dump_xml
(),
libvirt
.
VIR_DOMAIN_NONE
)
vm
.
dump_xml
(),
libvirt
.
VIR_DOMAIN_NONE
)
domain
=
connection
.
lookupByName
(
vm
.
name
)
domain
=
lookupByName
(
vm
.
name
)
domain
.
suspend
()
domain
.
suspend
()
# Real driver create
# Real driver create
else
:
else
:
...
@@ -169,10 +170,7 @@ def list_domains():
...
@@ -169,10 +170,7 @@ def list_domains():
def
lookupByName
(
name
):
def
lookupByName
(
name
):
'''Return with the requested Domain
'''Return with the requested Domain
'''
'''
try
:
return
connection
.
lookupByName
(
name
)
return
connection
.
lookupByName
(
name
)
except
libvirt
.
libvirtError
as
e
:
logging
.
error
(
e
.
get_error_message
())
@celery.task
@celery.task
...
...
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