mirror of
https://github.com/retspen/webvirtcloud
synced 2024-11-01 03:54:15 +00:00
Merge branch 'online_resize'
This commit is contained in:
commit
7672cc06f1
3 changed files with 13 additions and 3 deletions
|
@ -416,7 +416,7 @@
|
||||||
{% ifequal status 5 %}
|
{% ifequal status 5 %}
|
||||||
<button type="submit" class="btn btn-lg btn-success pull-right" name="resize">{% trans "Resize" %}</button>
|
<button type="submit" class="btn btn-lg btn-success pull-right" name="resize">{% trans "Resize" %}</button>
|
||||||
{% else %}
|
{% else %}
|
||||||
<button class="btn btn-lg btn-success pull-right disabled">{% trans "Resize" %}</button>
|
<button class="btn btn-lg btn-success pull-right disabled" name="resize">{% trans "Resize" %}</button>
|
||||||
{% endifequal %}
|
{% endifequal %}
|
||||||
</form>
|
</form>
|
||||||
{% else %}
|
{% else %}
|
||||||
|
|
|
@ -271,7 +271,7 @@ def instance(request, compute_id, vname):
|
||||||
networks = conn.get_net_device()
|
networks = conn.get_net_device()
|
||||||
|
|
||||||
vcpu_range = conn.get_max_cpus()
|
vcpu_range = conn.get_max_cpus()
|
||||||
memory_range = [256, 512, 768, 1024, 2048, 4096, 6144, 8192, 16384]
|
memory_range = [256, 512, 768, 1024, 2048, 3072, 4096, 6144, 8192, 16384]
|
||||||
if memory not in memory_range:
|
if memory not in memory_range:
|
||||||
insort(memory_range, memory)
|
insort(memory_range, memory)
|
||||||
if cur_memory not in memory_range:
|
if cur_memory not in memory_range:
|
||||||
|
|
|
@ -1,7 +1,8 @@
|
||||||
import time
|
import time
|
||||||
import os.path
|
import os.path
|
||||||
try:
|
try:
|
||||||
from libvirt import libvirtError, VIR_DOMAIN_XML_SECURE, VIR_MIGRATE_LIVE, VIR_MIGRATE_UNSAFE
|
from libvirt import libvirtError, VIR_DOMAIN_XML_SECURE, VIR_MIGRATE_LIVE, VIR_MIGRATE_UNSAFE, VIR_DOMAIN_RUNNING, \
|
||||||
|
VIR_DOMAIN_AFFECT_LIVE, VIR_DOMAIN_AFFECT_CONFIG
|
||||||
except:
|
except:
|
||||||
from libvirt import libvirtError, VIR_DOMAIN_XML_SECURE, VIR_MIGRATE_LIVE
|
from libvirt import libvirtError, VIR_DOMAIN_XML_SECURE, VIR_MIGRATE_LIVE
|
||||||
from vrtManager import util
|
from vrtManager import util
|
||||||
|
@ -614,8 +615,14 @@ class wvmInstance(wvmConnect):
|
||||||
"""
|
"""
|
||||||
Function change ram and cpu on vds.
|
Function change ram and cpu on vds.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
memory = int(memory) * 1024
|
memory = int(memory) * 1024
|
||||||
cur_memory = int(cur_memory) * 1024
|
cur_memory = int(cur_memory) * 1024
|
||||||
|
# if dom is running change only ram
|
||||||
|
if self.get_status() == VIR_DOMAIN_RUNNING:
|
||||||
|
self.set_memory(cur_memory, VIR_DOMAIN_AFFECT_LIVE)
|
||||||
|
self.set_memory(cur_memory, VIR_DOMAIN_AFFECT_CONFIG)
|
||||||
|
return
|
||||||
|
|
||||||
xml = self._XMLDesc(VIR_DOMAIN_XML_SECURE)
|
xml = self._XMLDesc(VIR_DOMAIN_XML_SECURE)
|
||||||
tree = ElementTree.fromstring(xml)
|
tree = ElementTree.fromstring(xml)
|
||||||
|
@ -906,3 +913,6 @@ class wvmInstance(wvmConnect):
|
||||||
new_xml = ElementTree.tostring(tree)
|
new_xml = ElementTree.tostring(tree)
|
||||||
self._defineXML(new_xml)
|
self._defineXML(new_xml)
|
||||||
|
|
||||||
|
def set_memory(self, size, flags=0):
|
||||||
|
self.instance.setMemoryFlags(size, flags)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue