Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
cc-node
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Analyze
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Mirror
cc-node
Commits
51a092ef
Commit
51a092ef
authored
13 years ago
by
Thibault VINCENT
Browse files
Options
Downloads
Patches
Plain Diff
add: new wrapper to migrate libvirt vm
parent
c2243e70
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
ccnode/libvirtwrapper.py
+24
-0
24 additions, 0 deletions
ccnode/libvirtwrapper.py
with
24 additions
and
0 deletions
ccnode/libvirtwrapper.py
+
24
−
0
View file @
51a092ef
...
...
@@ -566,6 +566,30 @@ class LibvirtVm(VM):
raise
VMError
(
'
deletion of VM `%s` failed
'
%
self
.
get_name
())
self
.
_hv_handle
.
_cache_vm_rebuild
()
def
migrate
(
self
,
host
,
port
):
'''
'''
if
self
.
hypervisor
().
get_hv_type
()
==
'
xen
'
:
flags
=
(
libvirt
.
VIR_MIGRATE_LIVE
^
libvirt
.
VIR_MIGRATE_PERSIST_DEST
^
libvirt
.
VIR_MIGRATE_UNDEFINE_SOURCE
)
uri
=
'
xenmigr://%s:%d
'
%
(
host
,
port
)
else
:
flags
=
(
libvirt
.
VIR_MIGRATE_LIVE
^
libvirt
.
VIR_MIGRATE_PERSIST_DEST
^
libvirt
.
VIR_MIGRATE_UNDEFINE_SOURCE
^
libvirt
.
VIR_MIGRATE_PEER2PEER
^
libvirt
.
VIR_MIGRATE_TUNNELLED
)
uri
=
'
qemu+tcp://%s:%d/system
'
%
(
host
,
port
)
try
:
self
.
_domain
.
migrate
(
self
.
_hv_handle
.
_lvcon_handle
,
flags
,
None
,
uri
,
0
)
except
libvirt
.
libvirtError
as
err
:
# FIXME ignore bogus exception properly
if
not
(
'
no domain with matching name
'
in
err
.
message
or
'
Domain not found
'
in
err
.
message
):
raise
err
def
power_on
(
self
):
'''
'''
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment