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
fc278800
authored
Jul 17, 2013
by
tarokkk
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
adding libvirt functions to vmdriver API
parent
066e15d5
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
46 additions
and
1 deletions
+46
-1
vmdriver.py
+46
-1
No files found.
vmdriver.py
View file @
fc278800
...
@@ -61,8 +61,53 @@ class VMDriver:
...
@@ -61,8 +61,53 @@ class VMDriver:
@req_connection
@req_connection
def
lookupByName
(
self
,
name
):
def
lookupByName
(
self
,
name
):
'''Return with the requested Domain
'''
try
:
try
:
self
.
connection
.
lookupByName
(
name
)
return
self
.
connection
.
lookupByName
(
name
)
except
libvirt
.
libvirtError
as
e
:
except
libvirt
.
libvirtError
as
e
:
logging
.
error
(
e
.
get_error_message
())
logging
.
error
(
e
.
get_error_message
())
@req_connection
def
vm_undefine
(
self
,
name
):
'''Undefine an already defined virtual machine.
If it's running it becomes transient (lsot on reboot)
'''
vm
=
self
.
lookupByName
(
name
)
try
:
vm
.
undefine
()
except
:
logging
.
error
(
'Can not get VM with name
%
s'
,
name
)
@req_connection
def
vm_start
(
self
,
name
):
'''Start an already defined virtual machine.
'''
vm
=
self
.
lookupByName
(
name
)
vm
.
create
()
@req_connection
def
vm_save
(
self
,
name
,
path
):
'''Stop virtual machine and save its memory to path.
'''
vm
=
self
.
lookupByName
(
name
)
vm
.
save
(
path
)
def
vm_resume
(
self
,
name
):
'''Resume stopped virtual machines.
'''
vm
=
self
.
lookupByName
(
name
)
vm
.
resume
()
def
vm_reset
(
self
,
name
):
'''Reset (power reset) virtual machine.
'''
vm
=
self
.
lookupByName
(
name
)
vm
.
reset
()
def
vm_reboot
(
self
,
name
):
'''Reboot (with guest acpi support) virtual machine.
'''
vm
=
self
.
lookupByName
(
name
)
vm
.
reboot
()
#virDomainResume
#virDomainResume
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