2015-03-02 08:52:07 +00:00
|
|
|
{% extends "base.html" %}
|
|
|
|
{% load i18n %}
|
2015-04-06 07:51:50 +00:00
|
|
|
{% load staticfiles %}
|
2015-03-06 13:46:59 +00:00
|
|
|
{% block title %}{% trans "Create new instance" %}{% endblock %}
|
|
|
|
{% block style %}
|
|
|
|
<link href="{% static "css/bootstrap-multiselect.css" %}" rel="stylesheet">
|
|
|
|
{% endblock %}
|
2015-03-02 08:52:07 +00:00
|
|
|
{% block content %}
|
2018-10-24 13:14:14 +00:00
|
|
|
<!-- Page Heading -->
|
|
|
|
<div class="row">
|
|
|
|
<div class="col-lg-12">
|
|
|
|
<h1 class="page-header">{% trans "New instance on" %} {{ compute.name }}</h1>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<!-- /.row -->
|
|
|
|
{% include 'errors_block.html' %}
|
|
|
|
{% include 'pleasewaitdialog.html' %}
|
2015-03-02 08:52:07 +00:00
|
|
|
|
2018-11-16 13:08:35 +00:00
|
|
|
|
|
|
|
{% if form.errors %}
|
|
|
|
{% for field in form %}
|
|
|
|
{% for error in field.errors %}
|
|
|
|
<div class="alert alert-danger">
|
|
|
|
<strong>{{ error|escape }}</strong>
|
|
|
|
</div>
|
|
|
|
{% endfor %}
|
|
|
|
{% endfor %}
|
|
|
|
{% for error in form.non_field_errors %}
|
|
|
|
<div class="alert alert-danger">
|
|
|
|
<strong>{{ error|escape }}</strong>
|
|
|
|
</div>
|
|
|
|
{% endfor %}
|
|
|
|
{% endif %}
|
|
|
|
|
2018-10-24 13:14:14 +00:00
|
|
|
<div class="row" id="max-width-page">
|
|
|
|
<div class="col-lg-12">
|
|
|
|
<div role="tabpanel">
|
|
|
|
<!-- Nav tabs -->
|
|
|
|
<ul class="nav nav-tabs" role="tablist">
|
|
|
|
<li role="presentation" class="active">
|
|
|
|
<a href="#flavor" aria-controls="flavor" role="tab" data-toggle="tab">
|
|
|
|
{% trans "Flavor" %}
|
|
|
|
</a>
|
|
|
|
</li>
|
|
|
|
<li role="presentation">
|
|
|
|
<a href="#addCustom" aria-controls="addCustom" role="tab" data-toggle="tab">
|
2015-03-10 09:15:36 +00:00
|
|
|
{% trans "Custom" %}
|
|
|
|
</a>
|
2018-10-24 13:14:14 +00:00
|
|
|
</li>
|
|
|
|
<li role="presentation">
|
|
|
|
<a href="#addFromTemp" aria-controls="addFromTemp" role="tab" data-toggle="tab">
|
2015-03-10 09:15:36 +00:00
|
|
|
{% trans "Template" %}
|
|
|
|
</a>
|
2018-10-24 13:14:14 +00:00
|
|
|
</li>
|
|
|
|
<li role="presentation">
|
|
|
|
<a href="#addFromXML" aria-controls="addFromXML" role="tab" data-toggle="tab">
|
2015-03-10 09:15:36 +00:00
|
|
|
{% trans "XML" %}
|
|
|
|
</a>
|
2018-10-24 13:14:14 +00:00
|
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
<!-- Tab panes -->
|
|
|
|
<div class="tab-content">
|
|
|
|
<div role="tabpanel" class="tab-pane tab-pane-bordered active" id="flavor">
|
|
|
|
{% if not flavors %}
|
|
|
|
<div class="col-lg-12">
|
|
|
|
<div class="alert alert-warning alert-dismissable">
|
|
|
|
<button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
|
|
|
|
<i class="fa fa-exclamation-triangle"></i> <strong>{% trans "Warning:" %}</strong> {% trans "Hypervisor doesn't have any Flavors" %}
|
2015-03-10 09:15:36 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
2018-10-24 13:14:14 +00:00
|
|
|
{% else %}
|
|
|
|
{% include 'create_flav_block.html' %}
|
|
|
|
<h3 class="page-header">{% trans "Create from flavor" %}</h3>
|
|
|
|
<div class="table-responsive">
|
|
|
|
<table class="table table-bordered table-hover">
|
|
|
|
<thead>
|
|
|
|
<tr>
|
|
|
|
<th>#</th>
|
|
|
|
<th>{% trans "Name" %}</th>
|
|
|
|
<th>{% trans "VCPU's" %}</th>
|
|
|
|
<th>{% trans "RAM" %}</th>
|
|
|
|
<th>{% trans "HDD" %}</th>
|
|
|
|
<th colspan="2">{% trans "Action" %}</th>
|
|
|
|
</tr>
|
|
|
|
</thead>
|
|
|
|
<tbody>
|
|
|
|
{% for flavor in flavors %}
|
|
|
|
<tr>
|
|
|
|
<td>{{ forloop.counter }}</td>
|
|
|
|
<td>{{ flavor.label }}</td>
|
|
|
|
<td>{{ flavor.vcpu }}</td>
|
|
|
|
<td>{{ flavor.memory }} {% trans "MB" %}</td>
|
|
|
|
<td>{{ flavor.disk }} {% trans "GB" %}</td>
|
|
|
|
<td style="width:5px;">
|
|
|
|
<div class="modal fade" id="addVMflavor{{ forloop.counter }}" tabindex="-1" role="dialog" aria-labelledby="addVMFlavorLabel" aria-hidden="true">
|
|
|
|
<div class="modal-dialog">
|
|
|
|
<div class="modal-content">
|
|
|
|
<div class="modal-header">
|
|
|
|
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
|
|
|
|
<h4 class="modal-title">{% trans "Create Virtual Machine" %} ({{ flavor.label }})</h4>
|
|
|
|
</div>
|
|
|
|
<div class="modal-body">
|
|
|
|
<form class="form-horizontal" method="post" role="form">{% csrf_token %}
|
|
|
|
<div class="form-group">
|
|
|
|
<label class="col-sm-3 control-label">{% trans "Name" %}</label>
|
|
|
|
<div class="col-sm-6">
|
|
|
|
<input type="text" class="form-control" name="name"
|
|
|
|
placeholder="{% trans "Name" %}" maxlength="14" required
|
|
|
|
pattern="[a-zA-Z0-9\.\-_]+">
|
|
|
|
<input type="hidden" name="vcpu" value="{{ flavor.vcpu }}">
|
|
|
|
<input type="hidden" name="memory" value="{{ flavor.memory }}">
|
|
|
|
<input type="hidden" name="hdd_size" value="{{ flavor.disk }}">
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div class="form-group">
|
|
|
|
<label class="col-sm-3 control-label">{% trans "Storage" %}</label>
|
|
|
|
|
|
|
|
<div class="col-sm-6">
|
|
|
|
<input type="hidden" name="cache_mode" value="default">
|
|
|
|
<select name="storage" class="form-control">
|
|
|
|
{% if storages %}
|
|
|
|
{% for storage in storages %}
|
|
|
|
<option value="{{ storage }}">{{ storage }}</option>
|
|
|
|
{% endfor %}
|
|
|
|
{% else %}
|
|
|
|
<option value="">{% trans "None" %}</option>
|
|
|
|
{% endif %}
|
|
|
|
</select>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div class="form-group">
|
|
|
|
<label class="col-sm-3 control-label">{% trans "HDD cache mode" %}</label>
|
|
|
|
<div class="col-sm-6">
|
|
|
|
<select id="cache_mode" name="cache_mode" class="form-control">
|
|
|
|
{% for mode, name in cache_modes %}
|
|
|
|
<option value="{{ mode }}" {% ifequal mode default_cache %}selected {% endifequal %}>
|
|
|
|
{% trans name %}</option>
|
|
|
|
{% endfor %}
|
|
|
|
</select>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div class="form-group">
|
|
|
|
<label class="col-sm-3 control-label">{% trans "Network" %}</label>
|
|
|
|
<div class="col-sm-6">
|
|
|
|
<select name="networks" class="form-control">
|
|
|
|
{% for network in networks %}
|
|
|
|
<option value="{{ network }}">{{ network }}</option>
|
|
|
|
{% endfor %}
|
|
|
|
</select>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div class="form-group">
|
|
|
|
<label class="col-sm-3 control-label">{% trans "NWFilter" %}</label>
|
|
|
|
<div class="col-sm-6">
|
|
|
|
<select name="nwfilter" class="form-control">
|
|
|
|
<option value="">{% trans "None" %}</option>
|
|
|
|
{% for nwfilter in nwfilters %}
|
|
|
|
<option value="{{ nwfilter }}">{{ nwfilter }}</option>
|
|
|
|
{% endfor %}
|
|
|
|
</select>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div class="form-group">
|
|
|
|
<label class="col-sm-3 control-label">{% trans "MAC" %}</label>
|
|
|
|
<div class="col-sm-6">
|
|
|
|
<input type="text" class="form-control" name="mac" maxlength="17" value="{{ mac_auto }}" required pattern="[a-zA-Z0-9:]+">
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div class="form-group">
|
|
|
|
<label class="col-sm-3 control-label">{% trans "Video" %}</label>
|
|
|
|
<div class="col-sm-6">
|
|
|
|
<select name="video" class="form-control">
|
|
|
|
{% if not videos %}
|
|
|
|
<option value="vga">vga</option>
|
|
|
|
<option value="cirrus">cirrus</option>
|
|
|
|
{% endif %}
|
|
|
|
{% for video in videos %}
|
|
|
|
<option value="{{ video }}">{{ video }}</option>
|
|
|
|
{% endfor %}
|
|
|
|
</select>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div class="form-group">
|
|
|
|
<label class="col-sm-3 control-label">{% trans "Console Password" %}</label>
|
|
|
|
<div class="col-sm-6">
|
|
|
|
<input type="password" class="form-control" name="console_pass" placeholder="{% trans "Console Password" %}" maxlength="14">
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div class="form-group">
|
|
|
|
<label class="col-sm-3 control-label">{% trans "Console Access" %}</label>
|
|
|
|
<div class="col-sm-6">
|
|
|
|
<select name="listener_addr" class="form-control">
|
|
|
|
{% for addr, label in listener_addr %}
|
|
|
|
<option value="{{ addr }}" {% if addr == "0.0.0.0" %} selected {% endif %}>{{ label }}</option>
|
|
|
|
{% endfor %}
|
|
|
|
</select>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div class="form-group">
|
|
|
|
<label class="col-sm-3 control-label">{% trans "Host-Model" %}</label>
|
|
|
|
<div class="col-sm-6">
|
|
|
|
<input type="checkbox" name="host_model" value="true" checked>
|
|
|
|
</div>
|
|
|
|
<label class="col-lg-1 control-label">{% trans "CPU" %}</label>
|
|
|
|
</div>
|
2018-11-26 12:40:02 +00:00
|
|
|
<div class="form-group">
|
|
|
|
<label class="col-sm-3 control-label">{% trans "Guest Agent" %}</label>
|
|
|
|
<div class="col-sm-6">
|
|
|
|
<input type="checkbox" name="qemu_ga" value="true" checked>
|
|
|
|
</div>
|
|
|
|
</div>
|
2018-10-24 13:14:14 +00:00
|
|
|
<div class="form-group">
|
|
|
|
<label class="col-sm-3 control-label">{% trans "VirtIO" %}</label>
|
|
|
|
<div class="col-sm-6">
|
|
|
|
<input type="checkbox" name="virtio" value="true" checked>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div class="modal-footer">
|
|
|
|
<button type="button" class="btn btn-default" data-dismiss="modal">{% trans "Close" %}</button>
|
|
|
|
{% if storages %}
|
|
|
|
<button type="submit" class="btn btn-primary" name="create">{% trans "Create" %}</button>
|
|
|
|
{% else %}
|
|
|
|
<button class="btn btn-primary disabled">{% trans "Create" %}</button>
|
|
|
|
{% endif %}
|
|
|
|
</div>
|
|
|
|
</form>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<a data-toggle="modal" href="#addVMflavor{{ forloop.counter }}" class="btn btn-sm btn-default">
|
|
|
|
<span class="glyphicon glyphicon-plus"></span>
|
|
|
|
</a>
|
|
|
|
</td>
|
|
|
|
<td style="width:5px;">
|
|
|
|
<form class="form-horizontal" action="" method="post" role="form">{% csrf_token %}
|
|
|
|
<input type="hidden" name="flavor" value="{{ flavor.id }}">
|
|
|
|
<button type="submit" class="btn btn-sm btn-default" name="delete_flavor" onclick="return confirm('{% trans "Are you sure?" %}')">
|
|
|
|
<span class="glyphicon glyphicon-trash"></span>
|
|
|
|
</button>
|
|
|
|
</form>
|
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
{% endfor %}
|
|
|
|
</tbody>
|
|
|
|
</table>
|
|
|
|
</div>
|
2018-11-16 13:08:35 +00:00
|
|
|
{% endif %}
|
|
|
|
<div class="clearfix"></div>
|
|
|
|
</div>
|
2018-10-24 13:14:14 +00:00
|
|
|
|
|
|
|
<div role="tabpanel" class="tab-pane tab-pane-bordered" id="addCustom">
|
|
|
|
<div class="well">
|
|
|
|
<form class="form-horizontal" method="post" role="form">{% csrf_token %}
|
|
|
|
<div class="form-group">
|
|
|
|
<label class="col-sm-3 control-label">{% trans "Name" %}</label>
|
2018-11-23 12:20:51 +00:00
|
|
|
<div class="col-sm-7">
|
|
|
|
<input type="text" class="form-control" name="name" placeholder="{% trans "Name" %}" maxlength="20" required pattern="[a-zA-Z0-9\.\-_]+">
|
2018-10-24 13:14:14 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div class="form-group">
|
|
|
|
<label class="col-sm-3 control-label">{% trans "VCPU" %}</label>
|
2018-11-23 12:20:51 +00:00
|
|
|
<div class="col-sm-7">
|
2018-11-16 13:08:35 +00:00
|
|
|
<input type="text" class="form-control" name="vcpu" value="1" maxlength="2" required pattern="[0-9]">
|
2018-10-24 13:14:14 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div class="form-group">
|
|
|
|
<label class="col-sm-3 control-label">{% trans "Host-Model" %}</label>
|
2018-11-23 12:20:51 +00:00
|
|
|
<div class="col-sm-7">
|
2018-10-24 13:14:14 +00:00
|
|
|
<input type="checkbox" name="host_model" value="true" checked>
|
|
|
|
</div>
|
|
|
|
<label class="col-sm-1 control-label">{% trans "CPU" %}</label>
|
|
|
|
</div>
|
|
|
|
<div class="form-group">
|
|
|
|
<label class="col-sm-3 control-label">{% trans "RAM" %}</label>
|
2018-11-23 12:20:51 +00:00
|
|
|
<div class="col-sm-7">
|
2018-10-24 13:14:14 +00:00
|
|
|
<input type="text" class="form-control" name="memory" value="512" maxlength="5" required pattern="[0-9]+">
|
|
|
|
</div>
|
|
|
|
<label class="col-sm-1 control-label">{% trans "MB" %}</label>
|
|
|
|
</div>
|
2018-11-16 13:08:35 +00:00
|
|
|
<div id="disk_list_div" class="form-group" hidden>
|
|
|
|
<label id="added_disks" class="col-sm-3 control-label">{% trans "Added Disks" %}</label>
|
2018-11-23 12:20:51 +00:00
|
|
|
<div class="col-sm-7">
|
2018-11-16 13:08:35 +00:00
|
|
|
<ul id="img-list" class="form-row">
|
|
|
|
<!-- populated from javascript -->
|
|
|
|
</ul>
|
|
|
|
</div>
|
|
|
|
</div>
|
2018-10-24 13:14:14 +00:00
|
|
|
<div class="form-group">
|
|
|
|
<label class="col-sm-3 control-label">{% trans "HDD" %}</label>
|
2018-11-16 13:08:35 +00:00
|
|
|
<input id="images" name="images" type="hidden" value=""/>
|
|
|
|
<div class="col-sm-3">
|
|
|
|
<select id="storage-control" name="storage-control" class="form-control" onchange="get_cust_vols({{ compute_id }}, value);">
|
|
|
|
{% if storages %}
|
|
|
|
<option value disabled selected>{% trans "Select pool..." %}</option>
|
|
|
|
{% for storage in storages %}
|
|
|
|
<option value="{{ storage }}" >{{ storage }}</option>
|
2018-10-24 13:14:14 +00:00
|
|
|
{% endfor %}
|
|
|
|
{% else %}
|
|
|
|
<option value="">{% trans "None" %}</option>
|
|
|
|
{% endif %}
|
|
|
|
</select>
|
|
|
|
</div>
|
2018-11-23 12:20:51 +00:00
|
|
|
<div class="col-sm-4">
|
|
|
|
<select id="image-control" class="form-control" name="image-control" multiple="multiple">
|
2018-11-16 13:08:35 +00:00
|
|
|
<!-- populated from javascript -->
|
|
|
|
</select>
|
|
|
|
</div>
|
2018-10-24 13:14:14 +00:00
|
|
|
</div>
|
2018-11-16 13:08:35 +00:00
|
|
|
|
2018-10-24 13:14:14 +00:00
|
|
|
<div class="form-group meta-prealloc">
|
|
|
|
<label class="col-sm-3 control-label">{% trans "Metadata" %}</label>
|
2018-11-23 12:20:51 +00:00
|
|
|
<div class="col-sm-7">
|
2018-10-24 13:14:14 +00:00
|
|
|
<input type="checkbox" name="meta_prealloc" title="Metadata preallocation" value="true">
|
|
|
|
</div>
|
|
|
|
<label class="col-lg-1 control-label">{% trans "Image" %}</label>
|
|
|
|
</div>
|
|
|
|
<div class="form-group">
|
|
|
|
<label class="col-sm-3 control-label">{% trans "HDD cache mode" %}</label>
|
2018-11-23 12:20:51 +00:00
|
|
|
<div class="col-sm-7">
|
2018-10-24 13:14:14 +00:00
|
|
|
<select id="cache_mode" name="cache_mode" class="form-control">
|
|
|
|
{% for mode, name in cache_modes %}
|
|
|
|
<option value="{{ mode }}" {% ifequal mode default_cache %}selected {% endifequal %}>
|
|
|
|
{% trans name %}</option>
|
|
|
|
{% endfor %}
|
|
|
|
</select>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div class="form-group">
|
|
|
|
<label class="col-sm-3 control-label">{% trans "Network" %}</label>
|
2018-11-23 12:20:51 +00:00
|
|
|
<div class="col-sm-7">
|
2018-10-24 13:14:14 +00:00
|
|
|
<ul id="net-list">
|
|
|
|
<!-- populated from javascript -->
|
|
|
|
</ul>
|
|
|
|
<input id="networks" type="hidden" name="networks" value=""/>
|
|
|
|
<select id="network-control" name="network-control" class="form-control" multiple="multiple">
|
|
|
|
{% for network in networks %}
|
|
|
|
<option value="{{ network }}">{{ network }}</option>
|
|
|
|
{% endfor %}
|
|
|
|
</select>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div class="form-group">
|
|
|
|
<label class="col-sm-3 control-label">{% trans "NWFilter" %}</label>
|
2018-11-23 12:20:51 +00:00
|
|
|
<div class="col-sm-7">
|
2018-10-24 13:14:14 +00:00
|
|
|
<select name="nwfilter" class="form-control">
|
|
|
|
<option value="">{% trans "None" %}</option>
|
|
|
|
{% for nwfilter in nwfilters %}
|
|
|
|
<option value="{{ nwfilter }}">{{ nwfilter }}</option>
|
|
|
|
{% endfor %}
|
|
|
|
</select>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div class="form-group">
|
|
|
|
<label class="col-sm-3 control-label">{% trans "Video" %}</label>
|
2018-11-23 12:20:51 +00:00
|
|
|
<div class="col-sm-7">
|
2018-10-24 13:14:14 +00:00
|
|
|
<select name="video" class="form-control">
|
|
|
|
{% if not videos %}
|
|
|
|
<option value="vga">vga</option>
|
|
|
|
<option value="cirrus">cirrus</option>
|
|
|
|
{% endif %}
|
|
|
|
{% for video in videos %}
|
|
|
|
<option value="{{ video }}">{{ video }}</option>
|
|
|
|
{% endfor %}
|
|
|
|
</select>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div class="form-group">
|
|
|
|
<label class="col-sm-3 control-label">{% trans "Console Password" %}</label>
|
2018-11-23 12:20:51 +00:00
|
|
|
<div class="col-sm-7">
|
2018-10-24 13:14:14 +00:00
|
|
|
<input type="password" class="form-control" name="console_pass" placeholder="{% trans "Console Password" %}" maxlength="14">
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div class="form-group">
|
|
|
|
<label class="col-sm-3 control-label">{% trans "Console Access" %}</label>
|
2018-11-23 12:20:51 +00:00
|
|
|
<div class="col-sm-7">
|
2018-10-24 13:14:14 +00:00
|
|
|
<select name="listener_addr" class="form-control">
|
|
|
|
{% for addr, label in listener_addr %}
|
|
|
|
<option value="{{ addr }}" {% if addr == "0.0.0.0" %} selected {% endif %}>{{ label }}</option>
|
|
|
|
{% endfor %}
|
|
|
|
</select>
|
|
|
|
</div>
|
|
|
|
</div>
|
2018-11-26 12:40:02 +00:00
|
|
|
<div class="form-group">
|
|
|
|
<label class="col-sm-3 control-label">{% trans "Guest Agent" %}</label>
|
|
|
|
<div class="col-sm-6">
|
|
|
|
<input type="checkbox" name="qemu_ga" value="true" checked>
|
|
|
|
</div>
|
|
|
|
</div>
|
2018-10-24 13:14:14 +00:00
|
|
|
<div class="form-group">
|
|
|
|
<label class="col-sm-3 control-label">{% trans "VirtIO" %}</label>
|
2018-11-23 12:20:51 +00:00
|
|
|
<div class="col-sm-7">
|
2018-10-24 13:14:14 +00:00
|
|
|
<input type="checkbox" name="virtio" value="true" checked>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
{% if storages %}
|
2018-11-16 13:08:35 +00:00
|
|
|
<button type="submit" class="btn btn-primary" name="create" formnovalidate onclick="showPleaseWaitDialog()" value="1">
|
2018-10-24 13:14:14 +00:00
|
|
|
{% trans "Create" %}
|
|
|
|
</button>
|
|
|
|
{% else %}
|
|
|
|
<button class="btn btn-primary disabled">
|
|
|
|
{% trans "Create" %}
|
|
|
|
</button>
|
|
|
|
{% endif %}
|
|
|
|
</form>
|
|
|
|
</div>
|
|
|
|
<div class="clearfix"></div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div role="tabpanel" class="tab-pane tab-pane-bordered" id="addFromTemp">
|
|
|
|
<div class="well">
|
|
|
|
<form class="form-horizontal" method="post" role="form">{% csrf_token %}
|
|
|
|
<div class="form-group">
|
|
|
|
<label class="col-sm-3 control-label">{% trans "Name" %}</label>
|
2018-11-23 12:20:51 +00:00
|
|
|
<div class="col-sm-7">
|
|
|
|
<input type="text" class="form-control" name="name" placeholder="{% trans "Name" %}" maxlength="20" required pattern="[a-zA-Z0-9\.\-_]+">
|
2015-03-10 09:15:36 +00:00
|
|
|
</div>
|
2018-10-24 13:14:14 +00:00
|
|
|
</div>
|
|
|
|
<div class="form-group">
|
|
|
|
<label class="col-sm-3 control-label">{% trans "VCPU" %}</label>
|
2018-11-23 12:20:51 +00:00
|
|
|
<div class="col-sm-7">
|
2018-11-16 13:08:35 +00:00
|
|
|
<input type="text" class="form-control" name="vcpu" value="1" maxlength="2" required pattern="[0-9]">
|
2015-03-10 09:15:36 +00:00
|
|
|
</div>
|
2018-10-24 13:14:14 +00:00
|
|
|
</div>
|
|
|
|
<div class="form-group">
|
|
|
|
<label class="col-sm-3 control-label">{% trans "Host-Model" %}</label>
|
2018-11-23 12:20:51 +00:00
|
|
|
<div class="col-sm-7">
|
2018-10-24 13:14:14 +00:00
|
|
|
<input type="checkbox" name="host_model" value="true" checked>
|
2015-03-10 09:15:36 +00:00
|
|
|
</div>
|
2018-10-24 13:14:14 +00:00
|
|
|
<label class="col-sm-1 control-label">{% trans "CPU" %}</label>
|
|
|
|
</div>
|
|
|
|
<div class="form-group">
|
|
|
|
<label class="col-sm-3 control-label">{% trans "RAM" %}</label>
|
2018-11-23 12:20:51 +00:00
|
|
|
<div class="col-sm-7">
|
2018-10-24 13:14:14 +00:00
|
|
|
<input type="text" class="form-control" name="memory" value="512" maxlength="5" required pattern="[0-9]+">
|
2016-04-21 10:14:20 +00:00
|
|
|
</div>
|
2018-10-24 13:14:14 +00:00
|
|
|
<label class="col-sm-1 control-label">{% trans "MB" %}</label>
|
|
|
|
</div>
|
2018-11-16 13:08:35 +00:00
|
|
|
|
2018-10-24 13:14:14 +00:00
|
|
|
<div class="form-group">
|
|
|
|
<label class="col-sm-3 control-label">{% trans "HDD" %}</label>
|
2018-11-16 13:08:35 +00:00
|
|
|
<input id="images" name="images" type="hidden" value=""/>
|
|
|
|
<div class="col-sm-3">
|
2019-01-09 11:16:51 +00:00
|
|
|
<select class="form-control" onchange="get_template_vols({{ compute_id }}, value);">
|
2018-11-16 13:08:35 +00:00
|
|
|
{% if storages %}
|
|
|
|
<option value disabled selected>{% trans "Select pool" %}...</option>
|
|
|
|
{% for storage in storages %}
|
|
|
|
<option value="{{ storage }}" >{{ storage }}</option>
|
2016-04-17 21:41:40 +00:00
|
|
|
{% endfor %}
|
2018-10-24 13:14:14 +00:00
|
|
|
{% else %}
|
|
|
|
<option value="">{% trans "None" %}</option>
|
|
|
|
{% endif %}
|
|
|
|
</select>
|
2016-04-17 21:41:40 +00:00
|
|
|
</div>
|
2018-11-23 12:20:51 +00:00
|
|
|
<div class="col-sm-4">
|
2018-11-16 13:08:35 +00:00
|
|
|
<select id="template" class="form-control" name="template" disabled>
|
|
|
|
<!-- populated from javascript -->
|
|
|
|
</select>
|
|
|
|
</div>
|
2018-10-24 13:14:14 +00:00
|
|
|
</div>
|
2019-01-09 11:16:51 +00:00
|
|
|
<div class="form-group">
|
|
|
|
<label class="col-sm-3 control-label">{% trans "Storage" %}</label>
|
|
|
|
<div class="col-sm-7">
|
|
|
|
<select id="storage" name="storage" class="form-control" disabled>
|
|
|
|
{% if storages %}
|
|
|
|
{% for storage in storages %}
|
|
|
|
<option value="{{ storage }}" >{{ storage }}</option>
|
|
|
|
{% endfor %}
|
|
|
|
{% else %}
|
|
|
|
<option value="">{% trans "None" %}</option>
|
|
|
|
{% endif %}
|
|
|
|
</select>
|
|
|
|
</div>
|
|
|
|
</div>
|
2018-10-24 13:14:14 +00:00
|
|
|
<div class="form-group meta-prealloc">
|
|
|
|
<label class="col-sm-3 control-label">{% trans "Metadata" %}</label>
|
2018-11-23 12:20:51 +00:00
|
|
|
<div class="col-sm-7">
|
2018-10-24 13:14:14 +00:00
|
|
|
<input type="checkbox" name="meta_prealloc" title="Metadata preallocation" value="true">
|
2018-09-24 11:41:13 +00:00
|
|
|
</div>
|
2018-10-24 13:14:14 +00:00
|
|
|
<label class="col-lg-1 control-label">{% trans "Image" %}</label>
|
|
|
|
</div>
|
|
|
|
<div class="form-group">
|
|
|
|
<label class="col-sm-3 control-label">{% trans "HDD cache mode" %}</label>
|
2018-11-23 12:20:51 +00:00
|
|
|
<div class="col-sm-7">
|
2018-10-24 13:14:14 +00:00
|
|
|
<select id="cache_mode" name="cache_mode" class="form-control">
|
|
|
|
{% for mode, name in cache_modes %}
|
|
|
|
<option value="{{ mode }}" {% ifequal mode default_cache %}selected {% endifequal %}>
|
|
|
|
{% trans name %}</option>
|
|
|
|
{% endfor %}
|
|
|
|
</select>
|
2015-03-10 09:15:36 +00:00
|
|
|
</div>
|
2018-10-24 13:14:14 +00:00
|
|
|
</div>
|
|
|
|
<div class="form-group">
|
|
|
|
<label class="col-sm-3 control-label">{% trans "Network" %}</label>
|
2018-11-23 12:20:51 +00:00
|
|
|
<div class="col-sm-7">
|
2018-10-24 13:14:14 +00:00
|
|
|
<select name="networks" class="form-control">
|
|
|
|
{% for network in networks %}
|
|
|
|
<option value="{{ network }}">{{ network }}</option>
|
|
|
|
{% endfor %}
|
|
|
|
</select>
|
2018-09-17 07:55:05 +00:00
|
|
|
</div>
|
2018-10-24 13:14:14 +00:00
|
|
|
</div>
|
|
|
|
<div class="form-group">
|
|
|
|
<label class="col-sm-3 control-label">{% trans "NWFilter" %}</label>
|
2018-11-23 12:20:51 +00:00
|
|
|
<div class="col-sm-7">
|
2018-10-24 13:14:14 +00:00
|
|
|
<select name="nwfilter" class="form-control">
|
|
|
|
<option value="">{% trans "None" %}</option>
|
|
|
|
{% for nwfilter in nwfilters %}
|
|
|
|
<option value="{{ nwfilter }}">{{ nwfilter }}</option>
|
|
|
|
{% endfor %}
|
|
|
|
</select>
|
2018-09-17 07:55:05 +00:00
|
|
|
</div>
|
2018-10-24 13:14:14 +00:00
|
|
|
</div>
|
|
|
|
<div class="form-group">
|
|
|
|
<label class="col-sm-3 control-label">{% trans "Video" %}</label>
|
2018-11-23 12:20:51 +00:00
|
|
|
<div class="col-sm-7">
|
2018-10-24 13:14:14 +00:00
|
|
|
<select name="video" class="form-control">
|
|
|
|
{% if not videos %}
|
|
|
|
<option value="vga">vga</option>
|
|
|
|
<option value="cirrus">cirrus</option>
|
|
|
|
{% endif %}
|
|
|
|
{% for video in videos %}
|
|
|
|
<option value="{{ video }}">{{ video }}</option>
|
|
|
|
{% endfor %}
|
|
|
|
</select>
|
2015-03-10 09:15:36 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
2018-10-24 13:14:14 +00:00
|
|
|
<div class="form-group">
|
|
|
|
<label class="col-sm-3 control-label">{% trans "Console Password" %}</label>
|
2018-11-23 12:20:51 +00:00
|
|
|
<div class="col-sm-7">
|
2018-10-24 13:14:14 +00:00
|
|
|
<input type="password" class="form-control" name="console_pass" placeholder="{% trans "Console Password" %}" maxlength="14">
|
|
|
|
</div>
|
2015-03-10 09:15:36 +00:00
|
|
|
</div>
|
2018-10-24 13:14:14 +00:00
|
|
|
<div class="form-group">
|
|
|
|
<label class="col-sm-3 control-label">{% trans "Console Access" %}</label>
|
2018-11-23 12:20:51 +00:00
|
|
|
<div class="col-sm-7">
|
2018-10-24 13:14:14 +00:00
|
|
|
<select name="listener_addr" class="form-control">
|
|
|
|
{% for addr, label in listener_addr %}
|
|
|
|
<option value="{{ addr }}" {% if addr == "0.0.0.0" %} selected {% endif %}>{{ label }}</option>
|
|
|
|
{% endfor %}
|
|
|
|
</select>
|
|
|
|
</div>
|
2015-03-10 09:15:36 +00:00
|
|
|
</div>
|
2018-11-26 12:40:02 +00:00
|
|
|
<div class="form-group">
|
|
|
|
<label class="col-sm-3 control-label">{% trans "Guest Agent" %}</label>
|
|
|
|
<div class="col-sm-6">
|
|
|
|
<input type="checkbox" name="qemu_ga" value="true" checked>
|
|
|
|
</div>
|
|
|
|
</div>
|
2018-11-23 12:20:51 +00:00
|
|
|
<div class="form-group">
|
|
|
|
<label class="col-sm-3 control-label">{% trans "VirtIO" %}</label>
|
|
|
|
<div class="col-sm-7">
|
|
|
|
<input type="checkbox" name="virtio" value="true" checked>
|
|
|
|
</div>
|
|
|
|
</div>
|
2018-10-24 13:14:14 +00:00
|
|
|
|
|
|
|
{% if storages %}
|
2018-11-16 13:08:35 +00:00
|
|
|
<button type="submit" class="btn btn-primary" name="create" value="1" formnovalidate onclick="showPleaseWaitDialog()">
|
2018-10-24 13:14:14 +00:00
|
|
|
{% trans "Create" %}
|
|
|
|
</button>
|
|
|
|
{% else %}
|
|
|
|
<button class="btn btn-primary disabled">
|
|
|
|
{% trans "Create" %}
|
|
|
|
</button>
|
|
|
|
{% endif %}
|
|
|
|
</form>
|
2015-03-10 09:15:36 +00:00
|
|
|
</div>
|
2018-10-24 13:14:14 +00:00
|
|
|
<div class="clearfix"></div>
|
2015-03-10 09:15:36 +00:00
|
|
|
</div>
|
2015-03-02 08:52:07 +00:00
|
|
|
|
2018-10-24 13:14:14 +00:00
|
|
|
<div role="tabpanel" class="tab-pane tab-pane-bordered" id="addFromXML">
|
|
|
|
<div class="well">
|
|
|
|
<form class="form-horizontal" method="post" role="form">{% csrf_token %}
|
|
|
|
<div class="col-sm-12" id="xmlheight">
|
|
|
|
<input type="hidden" name="dom_xml"/>
|
|
|
|
<textarea id="editor"></textarea>
|
2015-03-06 13:46:59 +00:00
|
|
|
</div>
|
2018-10-24 13:14:14 +00:00
|
|
|
<button type="submit" class="btn btn-primary" name="create_xml" onclick="showPleaseWaitDialog()">
|
|
|
|
{% trans "Create" %}
|
|
|
|
</button>
|
|
|
|
</form>
|
|
|
|
</div>
|
|
|
|
<div class="clearfix"></div>
|
2015-03-06 13:46:59 +00:00
|
|
|
</div>
|
2018-10-24 13:14:14 +00:00
|
|
|
</div>
|
|
|
|
<!-- /Tab panes -->
|
|
|
|
</div>
|
|
|
|
|
2015-03-06 13:46:59 +00:00
|
|
|
{% endblock %}
|
|
|
|
{% block script %}
|
|
|
|
<script src="{% static "js/bootstrap-multiselect.js" %}"></script>
|
|
|
|
<script>
|
|
|
|
function toggleValue(string, updated_value, checked) {
|
|
|
|
var result = '';
|
|
|
|
if (checked) {
|
|
|
|
result = string;
|
|
|
|
if (result != '') result += ',';
|
|
|
|
result += updated_value;
|
|
|
|
} else {
|
|
|
|
$.each(string.split(','), function (index, value) {
|
|
|
|
if (value == updated_value) return;
|
|
|
|
if (result != '') result += ',';
|
|
|
|
result += value;
|
|
|
|
});
|
|
|
|
}
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
|
|
|
$(document).ready(function () {
|
2018-11-16 13:08:35 +00:00
|
|
|
|
|
|
|
$('#image-control').multiselect({
|
|
|
|
disableIfEmpty: true,
|
2018-10-31 14:07:39 +00:00
|
|
|
enableCaseInsensitiveFiltering: true,
|
|
|
|
maxHeight: 400,
|
|
|
|
inheritClass: true,
|
2018-11-23 12:20:51 +00:00
|
|
|
buttonWidth:function (options, select) {
|
|
|
|
return '100%';
|
|
|
|
},
|
2015-03-06 13:46:59 +00:00
|
|
|
buttonText: function (options, select) {
|
2018-11-16 13:08:35 +00:00
|
|
|
return 'Add image...';
|
2015-03-06 13:46:59 +00:00
|
|
|
},
|
|
|
|
buttonTitle: function (options, select) {
|
|
|
|
return '';
|
|
|
|
},
|
|
|
|
onChange: function (element, checked) {
|
|
|
|
var input_value = toggleValue($('#images').val(), element.val(), checked);
|
|
|
|
$('#images').val(input_value);
|
2018-11-16 13:08:35 +00:00
|
|
|
|
2015-03-06 13:46:59 +00:00
|
|
|
var selected_list_html = '';
|
|
|
|
var counter = 0;
|
|
|
|
if (input_value != '') {
|
2018-11-16 13:08:35 +00:00
|
|
|
$('#disk_list_div').show();
|
|
|
|
$.each(input_value.split(','), function (index, value) {
|
2018-11-23 12:20:51 +00:00
|
|
|
var li = '<li>hdd' + counter + ' - ' +
|
|
|
|
'<select name="device' + counter + '" class="image-format" onchange="get_disk_bus_choices({{ compute_id }},' + counter + ', value);">' +
|
|
|
|
'{% for dev in disk_devices %}' +
|
|
|
|
'<option value=' + '"{{ dev }}">' + '{% trans dev %}</option>' +
|
|
|
|
'{% endfor %}' +
|
|
|
|
'</select>' +
|
|
|
|
'<select id="bus' + counter + '" name="bus' + counter + '" class="image-format">' +
|
|
|
|
'{% for bus in disk_buses %}' +
|
|
|
|
'<option value=' + '"{{ bus }}"' +
|
|
|
|
'{% if bus == default_bus %}selected{% endif %}>' +
|
|
|
|
'{% trans bus %}</option>' +
|
|
|
|
'{% endfor %}' +
|
|
|
|
'</select>' +
|
2015-03-06 13:46:59 +00:00
|
|
|
' -> ' + value + ' ' +
|
2018-11-23 12:20:51 +00:00
|
|
|
'<a class="btn-link pull-right" onclick="javascript:$(\'#image-control\').multiselect(\'deselect\', \'' + value + '\', true)"><i class="fa fa-remove"></i></a>' +
|
|
|
|
'</li>';
|
2015-03-06 13:46:59 +00:00
|
|
|
selected_list_html += li;
|
|
|
|
counter++;
|
|
|
|
});
|
2018-11-16 13:08:35 +00:00
|
|
|
}else {
|
|
|
|
$('#disk_list_div').hide();
|
2015-03-06 13:46:59 +00:00
|
|
|
}
|
|
|
|
$('#img-list').html(selected_list_html);
|
2018-11-16 13:08:35 +00:00
|
|
|
|
2015-03-06 13:46:59 +00:00
|
|
|
}
|
|
|
|
});
|
2015-03-02 08:52:07 +00:00
|
|
|
|
2018-11-16 13:08:35 +00:00
|
|
|
|
2015-03-06 13:46:59 +00:00
|
|
|
$('#network-control').multiselect({
|
2018-11-07 12:36:03 +00:00
|
|
|
inheritClass: true,
|
2015-03-06 13:46:59 +00:00
|
|
|
buttonText: function (options, select) {
|
2018-11-07 12:36:03 +00:00
|
|
|
return 'Add network';
|
2015-03-06 13:46:59 +00:00
|
|
|
},
|
|
|
|
buttonTitle: function (options, select) {
|
|
|
|
return '';
|
|
|
|
},
|
2018-11-23 12:20:51 +00:00
|
|
|
buttonWidth:function (options, select) {
|
|
|
|
return '100%';
|
|
|
|
},
|
2015-03-06 13:46:59 +00:00
|
|
|
onChange: function (element, checked) {
|
|
|
|
var input_value = toggleValue($('#networks').val(), element.val(), checked);
|
|
|
|
$('#networks').val(input_value);
|
|
|
|
var selected_list_html = '';
|
|
|
|
var counter = 0;
|
|
|
|
if (input_value != '') {
|
|
|
|
$.each(input_value.split(','), function (index, value) {
|
|
|
|
var li = '<li>eth' + counter +
|
|
|
|
' -> ' + value + ' ' +
|
2018-11-23 12:20:51 +00:00
|
|
|
'<a class="btn-link pull-right" onclick="javascript:$(\'#network-control\').multiselect(\'deselect\', \'' + value + '\', true)"><i class="fa fa-remove"></i></a></a></li>';
|
2015-03-06 13:46:59 +00:00
|
|
|
selected_list_html += li;
|
|
|
|
counter++;
|
|
|
|
});
|
|
|
|
}
|
|
|
|
$('#net-list').html(selected_list_html);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
2018-11-16 13:08:35 +00:00
|
|
|
|
|
|
|
function get_cust_vols(compute_id, pool) {
|
|
|
|
get_vol_url = "/computes/" + compute_id + "/storage/" + pool + "/volumes";
|
|
|
|
$.getJSON(get_vol_url, function (data) {
|
|
|
|
$("#image-control").find('option').remove();
|
|
|
|
$.each(data['vols'], function(i, item) {
|
|
|
|
$("#image-control").append('<option value=' + item +'>' + item + '</option>');
|
|
|
|
});
|
|
|
|
$('#image-control').multiselect('rebuild');
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
function get_template_vols(compute_id, pool) {
|
|
|
|
get_vol_url = "/computes/" + compute_id + "/storage/" + pool + "/volumes";
|
|
|
|
$.getJSON(get_vol_url, function (data) {
|
|
|
|
$("#template").find('option').remove();
|
|
|
|
$.each(data['vols'], function(i, item) {
|
|
|
|
$("#template").append('<option value=' + item +'>' + item + '</option>');
|
|
|
|
});
|
|
|
|
});
|
|
|
|
$("#template").removeAttr("disabled");
|
2019-01-09 11:16:51 +00:00
|
|
|
$("#storage").val(pool).change();
|
|
|
|
$("#storage").removeAttr("disabled");
|
|
|
|
|
2018-11-16 13:08:35 +00:00
|
|
|
}
|
2018-11-23 12:20:51 +00:00
|
|
|
|
2019-06-24 11:26:25 +00:00
|
|
|
function get_disk_bus_choices(compute_id, dev_idx, disk_type){
|
2018-11-23 12:20:51 +00:00
|
|
|
get_diskBus_url = "/computes/" + compute_id + "/disk/" + disk_type + "/buses";
|
|
|
|
|
|
|
|
$.getJSON(get_diskBus_url, function (data) {
|
|
|
|
$("#bus" + dev_idx).find('option').remove();
|
|
|
|
$.each(data['bus'], function(i, item) {
|
|
|
|
$("#bus" + dev_idx).append('<option value=' + item +'>' + item + '</option>');
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
2015-03-06 13:46:59 +00:00
|
|
|
</script>
|
2018-11-16 13:08:35 +00:00
|
|
|
|
2015-04-06 07:51:50 +00:00
|
|
|
<script src="{% static "js/ace.js" %}"></script>
|
2015-03-10 09:15:36 +00:00
|
|
|
<script>
|
|
|
|
var editor = ace.edit("editor");
|
|
|
|
editor.getSession().setMode("ace/mode/xml");
|
2018-09-21 16:07:47 +00:00
|
|
|
|
|
|
|
var input = $('input[name="dom_xml"]');
|
|
|
|
editor.getSession().on("change",function () {
|
|
|
|
input.val(editor.getSession().getValue());
|
|
|
|
})
|
2015-03-10 09:15:36 +00:00
|
|
|
</script>
|
2016-04-21 10:14:20 +00:00
|
|
|
{% endblock %}
|