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
185a9cc9
authored
Aug 12, 2013
by
tarokkk
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
clearing code
parent
dc0e3230
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
3 deletions
+3
-3
vmdriver.py
+3
-3
No files found.
vmdriver.py
View file @
185a9cc9
...
@@ -17,6 +17,7 @@ state_dict = {0: 'NOSTATE',
...
@@ -17,6 +17,7 @@ state_dict = {0: 'NOSTATE',
7
:
'PMSUSPENDED'
7
:
'PMSUSPENDED'
}
}
@decorator.decorator
@decorator.decorator
def
req_connection
(
original_function
):
def
req_connection
(
original_function
):
'''Connection checking decorator for libvirt.
'''Connection checking decorator for libvirt.
...
@@ -38,7 +39,6 @@ def req_connection(original_function):
...
@@ -38,7 +39,6 @@ def req_connection(original_function):
function with active connection"
)
function with active connection"
)
return_value
=
original_function
(
*
args
,
**
kwargs
)
return_value
=
original_function
(
*
args
,
**
kwargs
)
return
return_value
return
return_value
new_function
.
__dict__
.
update
(
original_function
.
__dict__
)
return
new_function
return
new_function
...
@@ -211,7 +211,7 @@ def domain_info(name):
...
@@ -211,7 +211,7 @@ def domain_info(name):
def
send_key
(
name
,
key_code
):
def
send_key
(
name
,
key_code
):
''' Sending linux key_code to the name vm
''' Sending linux key_code to the name vm
key_code can be optained from linux_keys.py
key_code can be optained from linux_keys.py
e.x: linuxkeys.KEY_RIGHT
_
CTRL
e.x: linuxkeys.KEY_RIGHTCTRL
'''
'''
domain
=
lookupByName
(
name
)
domain
=
lookupByName
(
name
)
domain
.
sendKey
(
libvirt
.
VIR_KEYCODE_SET_LINUX
,
100
,
[
key_code
],
1
,
0
)
domain
.
sendKey
(
libvirt
.
VIR_KEYCODE_SET_LINUX
,
100
,
[
key_code
],
1
,
0
)
...
@@ -241,7 +241,7 @@ def screenshot(name, path):
...
@@ -241,7 +241,7 @@ def screenshot(name, path):
domain
.
screenshot
(
stream
,
0
,
0
)
domain
.
screenshot
(
stream
,
0
,
0
)
# Get file to save data (TODO: send on AMQP?)
# Get file to save data (TODO: send on AMQP?)
try
:
try
:
fd
=
os
.
open
(
path
+
name
+
"-screenshot.ppm"
,
fd
=
os
.
open
(
path
+
"/"
+
name
+
"-screenshot.ppm"
,
os
.
O_WRONLY
|
os
.
O_TRUNC
|
os
.
O_CREAT
,
0
o644
)
os
.
O_WRONLY
|
os
.
O_TRUNC
|
os
.
O_CREAT
,
0
o644
)
# Save data with handler
# Save data with handler
stream
.
recvAll
(
_stream_handler
,
fd
)
stream
.
recvAll
(
_stream_handler
,
fd
)
...
...
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