mirror of
https://github.com/retspen/webvirtcloud
synced 2024-12-24 23:25:24 +00:00
add offline migration option
This commit is contained in:
parent
48371ff92d
commit
20d0e5a09d
3 changed files with 12 additions and 8 deletions
|
@ -844,6 +844,12 @@
|
||||||
<input type="checkbox" name="xml_delete" value="true" id="xml_delete" checked>
|
<input type="checkbox" name="xml_delete" value="true" id="xml_delete" checked>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="col-sm-3 control-label">{% trans "Offline migration" %}</label>
|
||||||
|
<div class="col-sm-6">
|
||||||
|
<input type="checkbox" name="offline_migrate" value="true" id="offline_migrate">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
{% if computes_count != 1 %}
|
{% if computes_count != 1 %}
|
||||||
<button type="submit" class="btn btn-lg btn-success pull-right" name="migrate" onclick="showPleaseWaitDialog();">{% trans "Migrate" %}</button>
|
<button type="submit" class="btn btn-lg btn-success pull-right" name="migrate" onclick="showPleaseWaitDialog();">{% trans "Migrate" %}</button>
|
||||||
{% else %}
|
{% else %}
|
||||||
|
|
|
@ -561,13 +561,13 @@ def instance(request, compute_id, vname):
|
||||||
live = request.POST.get('live_migrate', False)
|
live = request.POST.get('live_migrate', False)
|
||||||
unsafe = request.POST.get('unsafe_migrate', False)
|
unsafe = request.POST.get('unsafe_migrate', False)
|
||||||
xml_del = request.POST.get('xml_delete', False)
|
xml_del = request.POST.get('xml_delete', False)
|
||||||
|
offline = request.POST.get('offline_migrate', False)
|
||||||
new_compute = Compute.objects.get(id=compute_id)
|
new_compute = Compute.objects.get(id=compute_id)
|
||||||
conn_migrate = wvmInstances(new_compute.hostname,
|
conn_migrate = wvmInstances(new_compute.hostname,
|
||||||
new_compute.login,
|
new_compute.login,
|
||||||
new_compute.password,
|
new_compute.password,
|
||||||
new_compute.type)
|
new_compute.type)
|
||||||
conn_migrate.moveto(conn, vname, live, unsafe, xml_del)
|
conn_migrate.moveto(conn, vname, live, unsafe, xml_del, offline)
|
||||||
conn_migrate.define_move(vname)
|
|
||||||
instance.compute = new_compute
|
instance.compute = new_compute
|
||||||
instance.save()
|
instance.save()
|
||||||
conn_migrate.close()
|
conn_migrate.close()
|
||||||
|
|
|
@ -67,20 +67,18 @@ class wvmInstances(wvmConnect):
|
||||||
dom = self.get_instance(name)
|
dom = self.get_instance(name)
|
||||||
dom.resume()
|
dom.resume()
|
||||||
|
|
||||||
def moveto(self, conn, name, live, unsafe, undefine):
|
def moveto(self, conn, name, live, unsafe, undefine, offline):
|
||||||
flags = 0
|
flags = 0
|
||||||
if live and conn.get_status() == 1:
|
if live and conn.get_status() == 1:
|
||||||
flags |= VIR_MIGRATE_LIVE
|
flags |= VIR_MIGRATE_LIVE
|
||||||
if unsafe and conn.get_status() == 1:
|
if unsafe and conn.get_status() == 1:
|
||||||
flags |= VIR_MIGRATE_UNSAFE
|
flags |= VIR_MIGRATE_UNSAFE
|
||||||
dom = conn.get_instance(name)
|
dom = conn.get_instance(name)
|
||||||
dom.migrate(self.wvm, flags, name, None, 0)
|
xml = dom.XMLDesc(VIR_DOMAIN_XML_SECURE)
|
||||||
|
if not offline:
|
||||||
|
dom.migrate(self.wvm, flags, None, None, 0)
|
||||||
if undefine:
|
if undefine:
|
||||||
dom.undefine()
|
dom.undefine()
|
||||||
|
|
||||||
def define_move(self, name):
|
|
||||||
dom = self.get_instance(name)
|
|
||||||
xml = dom.XMLDesc(VIR_DOMAIN_XML_SECURE)
|
|
||||||
self.wvm.defineXML(xml)
|
self.wvm.defineXML(xml)
|
||||||
|
|
||||||
def graphics_type(self, name):
|
def graphics_type(self, name):
|
||||||
|
|
Loading…
Reference in a new issue