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
8e738dd5
authored
Oct 30, 2013
by
Guba Sándor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
vmdriver: made shutdown blocking until finished
parent
aae6fcec
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
6 deletions
+22
-6
vmdriver.py
+22
-6
No files found.
vmdriver.py
View file @
8e738dd5
...
@@ -7,7 +7,7 @@ import socket
...
@@ -7,7 +7,7 @@ import socket
import
json
import
json
from
decorator
import
decorator
from
decorator
import
decorator
from
psutil
import
NUM_CPUS
,
virtual_memory
,
virtmem_usage
,
cpu_percent
from
psutil
import
NUM_CPUS
,
virtual_memory
,
cpu_percent
from
vm
import
VMInstance
from
vm
import
VMInstance
...
@@ -190,12 +190,28 @@ def create(vm_desc):
...
@@ -190,12 +190,28 @@ def create(vm_desc):
@celery.task
@celery.task
@req_connection
@req_connection
@wrap_libvirtError
def
shutdown
(
name
):
def
shutdown
(
name
):
""" Shutdown virtual machine (need ACPI support). """
""" Shutdown virtual machine (need ACPI support).
Return When domain is missing.
domain
=
lookupByName
(
name
)
"""
domain
.
shutdown
()
from
time
import
sleep
try
:
domain
=
lookupByName
(
name
)
domain
.
shutdown
()
while
True
:
try
:
Connection
.
get
()
.
lookupByName
(
name
)
except
Exception
as
e
:
if
e
.
get_error_code
()
==
libvirt
.
VIR_ERR_NO_DOMAIN
:
return
else
:
raise
else
:
sleep
(
5
)
except
Exception
as
e
:
new_e
=
Exception
(
e
.
get_error_message
())
new_e
.
libvirtError
=
True
raise
new_e
@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