Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
CIRCLE
/
vmdriver
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
2
Merge Requests
0
Wiki
Members
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
A prog2-höz tartozó friss repo anyagok itt elérhetőek:
https://git.iit.bme.hu/
Commit
db4e2565
authored
Sep 18, 2013
by
Guba Sándor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
adding suspend option and emulating PAUSE_ON_START flag
parent
5411583a
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
2 deletions
+20
-2
vmdriver.py
+20
-2
No files found.
vmdriver.py
View file @
db4e2565
...
@@ -101,8 +101,17 @@ def create(vm_desc):
...
@@ -101,8 +101,17 @@ def create(vm_desc):
'''
'''
vm
=
VMInstance
.
deserialize
(
vm_desc
)
vm
=
VMInstance
.
deserialize
(
vm_desc
)
# Setting proper hypervisor
# Setting proper hypervisor
vm
.
vm_type
=
os
.
getenv
(
HYPERVISOR_TYPE
,
"test"
)
vm
.
vm_type
=
os
.
getenv
(
"HYPERVISOR_TYPE"
,
"test"
)
connection
.
createXML
(
vm
.
dump_xml
(),
libvirt
.
VIR_DOMAIN_NONE
)
#, libvirt.VIR_DOMAIN_START_PAUSED)
# Emulating DOMAIN_START_PAUSED FLAG behaviour on test driver
if
vm
.
vm_type
==
"test"
:
connection
.
createXML
(
vm
.
dump_xml
(),
libvirt
.
VIR_DOMAIN_NONE
)
domain
=
connection
.
lookupByName
(
vm
.
name
)
domain
.
suspend
()
else
:
connection
.
createXML
(
vm
.
dump_xml
(),
libvirt
.
VIR_DOMAIN_START_PAUSED
)
logging
.
info
(
"Virtual machine
%
s is created from xml"
,
vm
.
name
)
logging
.
info
(
"Virtual machine
%
s is created from xml"
,
vm
.
name
)
...
@@ -160,6 +169,15 @@ def start(name):
...
@@ -160,6 +169,15 @@ def start(name):
@celery.task
@celery.task
@req_connection
@req_connection
def
suspend
(
name
):
'''Stop virtual machine and save its memory to path.
'''
domain
=
lookupByName
(
name
)
domain
.
suspend
()
@celery.task
@req_connection
def
save
(
name
,
path
):
def
save
(
name
,
path
):
'''Stop virtual machine and save its memory to path.
'''Stop virtual machine and save its memory to path.
'''
'''
...
...
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