Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
CIRCLE
/
cloud
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
94
Merge Requests
10
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
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
feea94cc
authored
Nov 21, 2013
by
Guba Sándor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
vm: Adding migrate to model
parent
920e8c09
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
28 additions
and
2 deletions
+28
-2
circle/vm/models.py
+28
-2
No files found.
circle/vm/models.py
View file @
feea94cc
...
@@ -820,11 +820,37 @@ class Instance(AclBase, VirtualMachineDescModel, TimeStampedModel):
...
@@ -820,11 +820,37 @@ class Instance(AclBase, VirtualMachineDescModel, TimeStampedModel):
queue
=
queue_name
)
.
get
()
queue
=
queue_name
)
.
get
()
def
reboot_async
(
self
,
user
=
None
):
def
reboot_async
(
self
,
user
=
None
):
"""Execute reboot asynchronously.
"""Execute reboot asynchronously. """
"""
return
local_tasks
.
reboot
.
apply_async
(
args
=
[
self
,
user
],
return
local_tasks
.
reboot
.
apply_async
(
args
=
[
self
,
user
],
queue
=
"localhost.man"
)
queue
=
"localhost.man"
)
def
migrate_async
(
self
,
to_node
,
user
=
None
):
"""Execute migrate asynchronously. """
return
local_tasks
.
migrate
.
apply_async
(
args
=
[
self
,
to_node
,
user
],
queue
=
"localhost.man"
)
def
migrate
(
self
,
to_node
,
user
=
None
,
task_uuid
=
None
):
"""Live migrate running vm to another node. """
with
instance_activity
(
code_suffix
=
'migrate'
,
instance
=
self
,
task_uuid
=
task_uuid
,
user
=
user
)
as
act
:
# Destroy networks
with
act
.
sub_activity
(
'destroying_net'
):
for
net
in
self
.
interface_set
.
all
():
net
.
destroy
()
with
act
.
sub_activity
(
'migrate_vm'
):
queue_name
=
self
.
get_remote_queue_name
(
'vm'
)
vm_tasks
.
migrate
.
apply_async
(
args
=
[
self
.
vm_name
,
to_node
.
host
.
hostname
],
queue
=
queue_name
)
.
get
()
# Refresh node information
self
.
node
=
to_node
self
.
save
()
# Estabilish network connection (vmdriver)
with
act
.
sub_activity
(
'deploying_net'
):
for
net
in
self
.
interface_set
.
all
():
net
.
deploy
()
def
save_as_template
(
self
,
name
,
**
kwargs
):
def
save_as_template
(
self
,
name
,
**
kwargs
):
# prepare parameters
# prepare parameters
kwargs
.
setdefault
(
'name'
,
name
)
kwargs
.
setdefault
(
'name'
,
name
)
...
...
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