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
51b12acb
authored
Jul 22, 2013
by
Guba Sándor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refactoring vm to domain fixing vm_delete
parent
7f7756b3
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
12 deletions
+19
-12
vmdriver.py
+19
-12
No files found.
vmdriver.py
View file @
51b12acb
...
@@ -56,6 +56,13 @@ class VMDriver:
...
@@ -56,6 +56,13 @@ class VMDriver:
logging
.
info
(
"Virtual machine
%
s is created from xml"
,
vm
.
name
)
logging
.
info
(
"Virtual machine
%
s is created from xml"
,
vm
.
name
)
@req_connection
@req_connection
def
vm_delete
(
self
,
vm
):
'''Destroy the running called 'name' virtual machine.
'''
domain
=
self
.
lookupByName
(
vm
.
name
)
domain
.
destroy
()
@req_connection
def
list_domains
(
self
):
def
list_domains
(
self
):
return
self
.
connection
.
listDefinedDomains
()
return
self
.
connection
.
listDefinedDomains
()
...
@@ -73,9 +80,9 @@ class VMDriver:
...
@@ -73,9 +80,9 @@ class VMDriver:
'''Undefine an already defined virtual machine.
'''Undefine an already defined virtual machine.
If it's running it becomes transient (lsot on reboot)
If it's running it becomes transient (lsot on reboot)
'''
'''
vm
=
self
.
lookupByName
(
name
)
domain
=
self
.
lookupByName
(
name
)
try
:
try
:
vm
.
undefine
()
domain
.
undefine
()
except
:
except
:
logging
.
error
(
'Can not get VM with name
%
s'
,
name
)
logging
.
error
(
'Can not get VM with name
%
s'
,
name
)
...
@@ -83,31 +90,31 @@ class VMDriver:
...
@@ -83,31 +90,31 @@ class VMDriver:
def
vm_start
(
self
,
name
):
def
vm_start
(
self
,
name
):
'''Start an already defined virtual machine.
'''Start an already defined virtual machine.
'''
'''
vm
=
self
.
lookupByName
(
name
)
domain
=
self
.
lookupByName
(
name
)
vm
.
create
()
domain
.
create
()
@req_connection
@req_connection
def
vm_save
(
self
,
name
,
path
):
def
vm_save
(
self
,
name
,
path
):
'''Stop virtual machine and save its memory to path.
'''Stop virtual machine and save its memory to path.
'''
'''
vm
=
self
.
lookupByName
(
name
)
domain
=
self
.
lookupByName
(
name
)
vm
.
save
(
path
)
domain
.
save
(
path
)
def
vm_resume
(
self
,
name
):
def
vm_resume
(
self
,
name
):
'''Resume stopped virtual machines.
'''Resume stopped virtual machines.
'''
'''
vm
=
self
.
lookupByName
(
name
)
domain
=
self
.
lookupByName
(
name
)
vm
.
resume
()
domain
.
resume
()
def
vm_reset
(
self
,
name
):
def
vm_reset
(
self
,
name
):
'''Reset (power reset) virtual machine.
'''Reset (power reset) virtual machine.
'''
'''
vm
=
self
.
lookupByName
(
name
)
domain
=
self
.
lookupByName
(
name
)
vm
.
reset
()
domain
.
reset
()
def
vm_reboot
(
self
,
name
):
def
vm_reboot
(
self
,
name
):
'''Reboot (with guest acpi support) virtual machine.
'''Reboot (with guest acpi support) virtual machine.
'''
'''
vm
=
self
.
lookupByName
(
name
)
domain
=
self
.
lookupByName
(
name
)
vm
.
reboot
()
domain
.
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