diff --git a/app/__init__.py b/app/__init__.py index ac8fef11..7118b750 100644 --- a/app/__init__.py +++ b/app/__init__.py @@ -396,6 +396,8 @@ def managevm(op=None, infid=None, vmid=None): form_data = request.form.to_dict() cpu = int(form_data['cpu']) memory = int(form_data['memory']) + gpu = int(form_data.get('gpu', 0)) + disk_size = int(form_data.get('disk_size', 0)) vminforesp = im.get_vm_info(infid, vmid, auth_data, "text/plain") if vminforesp.ok: @@ -407,6 +409,15 @@ def managevm(op=None, infid=None, vmid=None): vminfo.systems[0].delValue("memory.size") vminfo.systems[0].addFeature(Feature("memory.size", ">=", memory, "GB"), conflict="other", missing="other") + if gpu > 0: + vminfo.systems[0].delValue("gpu.count") + vminfo.systems[0].addFeature(Feature("gpu.count", ">=", gpu), + conflict="other", missing="other") + if disk_size > 0: + vminfo.systems[0].delValue("disks.free_size") + vminfo.systems[0].delValue("disks.0.free_size") + vminfo.systems[0].addFeature(Feature("disks.free_size", ">=", disk_size, "GB"), + conflict="other", missing="other") response = im.resize_vm(infid, vmid, str(vminfo), auth_data) else: raise Exception("Error getting VM info: %s" % vminforesp.text) diff --git a/app/templates/vminfo.html b/app/templates/vminfo.html index 4b759d9c..860f8fd8 100644 --- a/app/templates/vminfo.html +++ b/app/templates/vminfo.html @@ -108,6 +108,8 @@

VM ID {{ vmid }}:

HW Features: + {% set disk_size="0.0 GB" %} + {% set gpu="0" %} {% if 'instance_type' in vminfo %} {% if vminfo['instance_type'] %} {{ vminfo['instance_type'] }}
@@ -124,14 +126,14 @@

VM ID {{ vmid }}:

{% endif %} {% if 'disks.free_size' in vminfo %} , {{ vminfo['disks.free_size'] }} of HD - {% set _dummy=vminfo.pop('disks.free_size') %} + {% set disk_size=vminfo.pop('disks.free_size') %} {% elif 'disk.0.free_size' in vminfo %} , {{ vminfo['disk.0.free_size'] }} of HD - {% set _dummy=vminfo.pop('disk.0.free_size') %} + {% set disk_size=vminfo.pop('disk.0.free_size') %} {% endif %} {% if 'gpu.count' in vminfo and vminfo['gpu.count'] > 0 %} , {{ vminfo['gpu.count'] }} GPUs - {% set _dummy=vminfo.pop('gpu.count') %} + {% set gpu=vminfo.pop('gpu.count') %} {% if 'gpu.vendor' in vminfo or 'gpu.model' in vminfo %} ( {% if 'gpu.model' in vminfo %} @@ -334,6 +336,16 @@ +
+
+ GPU Number: +
+
+ {% set disk_size_parts = disk_size.split() %} + Disk Size (GB): +
+
+