2017-03-15 12:02:55 +00:00
|
|
|
{% extends "admin/base_site.html" %}
|
|
|
|
{% block content %}
|
2017-04-10 19:14:55 +00:00
|
|
|
|
2017-04-18 08:04:29 +00:00
|
|
|
<form action="{% url 'admin:createvm' %}" method="post">
|
2017-05-07 00:01:39 +00:00
|
|
|
{% csrf_token %}
|
|
|
|
{{ form }}
|
|
|
|
<input type="submit" name="create_vm" value="Create VM" />
|
2017-04-18 08:04:29 +00:00
|
|
|
</form>
|
2017-03-15 12:02:55 +00:00
|
|
|
{% if vms %}
|
|
|
|
<section>
|
2017-03-16 19:12:27 +00:00
|
|
|
<table class="table table-striped">
|
|
|
|
<thead>
|
|
|
|
<tr>
|
|
|
|
<th>ID</th>
|
|
|
|
<th>Name</th>
|
|
|
|
<th>Memory</th>
|
|
|
|
<th>Status</th>
|
|
|
|
<th>User Name</th>
|
2017-04-10 19:14:55 +00:00
|
|
|
<th>Actions</th>
|
2017-03-16 19:12:27 +00:00
|
|
|
</tr>
|
|
|
|
</thead>
|
|
|
|
<tbody>
|
2017-03-15 12:02:55 +00:00
|
|
|
{% for vm in vms %}
|
2017-03-16 19:12:27 +00:00
|
|
|
<tr>
|
|
|
|
<td>{{vm.id}}</td>
|
|
|
|
<td>{{vm.name}}</td>
|
|
|
|
<td>{{vm.template.memory}}</td>
|
|
|
|
<td>{{vm.str_state}}</td>
|
|
|
|
<td>{{vm.uname}}</td>
|
2017-04-10 19:14:55 +00:00
|
|
|
<td>
|
|
|
|
{% if vm.str_state == 'ACTIVE' %}
|
|
|
|
<a href="{% url 'admin:stopvm' vm.id %}">Stop VM</a>
|
|
|
|
{% elif vm.str_state == 'STOPPED' %}
|
|
|
|
<a href="{% url 'admin:startvm' vm.id %}">Start VM</a>
|
|
|
|
{% endif %}
|
|
|
|
<a href="{% url 'admin:deletevm' vm.id %}">Delete VM</a>
|
|
|
|
|
|
|
|
|
|
|
|
</td>
|
2017-03-16 19:12:27 +00:00
|
|
|
</tr>
|
2017-03-15 12:02:55 +00:00
|
|
|
{% endfor %}
|
2017-03-16 19:12:27 +00:00
|
|
|
</tbody>
|
|
|
|
</table>
|
2017-03-15 12:02:55 +00:00
|
|
|
</section>
|
2017-04-23 17:16:59 +00:00
|
|
|
{% else %}
|
|
|
|
<h4>You do not have any VM.</h4>
|
2017-03-15 12:02:55 +00:00
|
|
|
{% endif %}
|
|
|
|
{% endblock %}
|