2018-10-19 13:11:22 +00:00
|
|
|
{% load i18n %}
|
2023-08-09 06:20:18 +00:00
|
|
|
{% load bootstrap_icons %}
|
2018-10-19 13:14:33 +00:00
|
|
|
{% if request.user.is_superuser %}
|
2021-07-07 11:12:38 +00:00
|
|
|
<a href="#addvol" type="button" class="btn btn-success float-end" data-bs-toggle="modal" title="{% trans "Add Volume" %}">
|
2023-08-09 06:20:18 +00:00
|
|
|
<span aria-hidden="true">{% bs_icon 'plus'%} </span>
|
2019-07-31 08:03:48 +00:00
|
|
|
</a>
|
2018-10-19 13:11:22 +00:00
|
|
|
|
2019-07-31 08:03:48 +00:00
|
|
|
<!-- Modal pool -->
|
|
|
|
<div class="modal fade" id="addvol" tabindex="-1" role="dialog" aria-labelledby="addInstanceVolumeLabel" aria-hidden="true">
|
|
|
|
<div class="modal-dialog">
|
|
|
|
<div class="modal-content">
|
|
|
|
<div class="modal-header">
|
2020-05-19 16:53:54 +00:00
|
|
|
<h5 class="modal-title">{% trans "Add Instance Volume" %}</h5>
|
2021-07-07 11:12:38 +00:00
|
|
|
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
|
2019-07-31 08:03:48 +00:00
|
|
|
</div>
|
2020-05-19 16:53:54 +00:00
|
|
|
|
2020-05-26 13:18:38 +00:00
|
|
|
<ul class="nav nav-tabs" aria-label="Disk attach type">
|
2021-07-07 11:12:38 +00:00
|
|
|
<li class="nav-item" role="presentation">
|
|
|
|
<button class="nav-link active" aria-controls="NewDisk" data-bs-toggle="tab" data-bs-target="#NewDisk" type="button" role="tab" aria-selected="true">
|
|
|
|
{% trans 'New Disk' %}
|
|
|
|
</button>
|
2020-05-19 16:53:54 +00:00
|
|
|
</li>
|
2021-07-07 11:12:38 +00:00
|
|
|
<li class="nav-item" role="presentation">
|
|
|
|
<button class="nav-link" aria-controls="ExistingDisk" data-bs-toggle="tab" data-bs-target="#ExistingDisk" type="button" role="tab" aria-selected="true">
|
|
|
|
{% trans 'Existing Disk' %}
|
|
|
|
</button>
|
2020-05-19 16:53:54 +00:00
|
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
<div class="tab-content">
|
|
|
|
<div class="tab-pane active" id="NewDisk">
|
2020-07-13 09:33:09 +00:00
|
|
|
<form action="{% url 'instances:add_new_vol' instance.id %}" method="post" role="form" aria-label="Add new volume to disk form">{% csrf_token %}
|
2020-05-19 16:53:54 +00:00
|
|
|
<div class="modal-body">
|
2021-07-07 11:12:38 +00:00
|
|
|
<p class="fw-bold">{% trans "Volume parameters" %}</p>
|
|
|
|
<div class="row">
|
2020-05-19 16:53:54 +00:00
|
|
|
<label class="col-sm-3 col-form-label">{% trans "Storage" %}</label>
|
|
|
|
<div class="col-sm-6">
|
2021-07-07 11:12:38 +00:00
|
|
|
<select name="storage" class="form-select image-format">
|
2019-09-10 13:05:23 +00:00
|
|
|
{% for storage in storages_host %}
|
2019-07-31 08:03:48 +00:00
|
|
|
<option value="{{ storage }}">{{ storage }}</option>
|
|
|
|
{% endfor %}
|
|
|
|
</select>
|
|
|
|
</div>
|
|
|
|
</div>
|
2021-07-07 11:12:38 +00:00
|
|
|
<div class="row">
|
2020-05-19 16:53:54 +00:00
|
|
|
<label class="col-sm-3 col-form-label">{% trans "Name" %}</label>
|
|
|
|
<div class="col-sm-6">
|
2019-07-31 08:03:48 +00:00
|
|
|
<input type="text" class="form-control" name="name" placeholder="{% trans "Name" %}" required pattern="[a-zA-Z0-9\.\-_]+">
|
2018-10-24 09:04:05 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
2021-07-07 11:12:38 +00:00
|
|
|
<div class="row">
|
2020-05-19 16:53:54 +00:00
|
|
|
<label class="col-sm-3 col-form-label">{% trans "Format" %}</label>
|
|
|
|
<div class="col-sm-6">
|
2021-07-07 11:12:38 +00:00
|
|
|
<select name="format" class="form-select image-format">
|
2020-07-13 09:33:09 +00:00
|
|
|
{% for format in instance.formats %}
|
2019-07-31 08:03:48 +00:00
|
|
|
<option value="{{ format }}" {% if format == default_format %}selected{% endif %}>{% trans format %}</option>
|
|
|
|
{% endfor %}
|
2018-10-24 09:04:05 +00:00
|
|
|
</select>
|
|
|
|
</div>
|
|
|
|
</div>
|
2021-07-07 11:12:38 +00:00
|
|
|
<div class="row">
|
2020-05-19 16:53:54 +00:00
|
|
|
<label class="col-sm-3 col-form-label">{% trans "Size" %}</label>
|
|
|
|
<div class="col-sm-6">
|
2019-07-31 08:03:48 +00:00
|
|
|
<input type="text" class="form-control" name="size" value="10" maxlength="5" required pattern="[0-9]+">
|
|
|
|
</div>
|
2020-05-19 16:53:54 +00:00
|
|
|
<label class="col-sm-1 col-form-label">{% trans "GB" %}</label>
|
2019-07-31 08:03:48 +00:00
|
|
|
</div>
|
2021-07-07 11:12:38 +00:00
|
|
|
<div class="row">
|
2020-05-19 16:53:54 +00:00
|
|
|
<label class="col-sm-3 col-form-label">{% trans "Bus" %}</label>
|
|
|
|
<div class="col-sm-6">
|
2021-07-07 11:12:38 +00:00
|
|
|
<select name="bus" class="form-select image-format">
|
2019-12-09 10:41:31 +00:00
|
|
|
{% for bus in bus_host %}
|
2018-10-24 09:04:05 +00:00
|
|
|
<option value="{{ bus }}" {% if bus == default_bus %}selected{% endif %}>{% trans bus %}</option>
|
|
|
|
{% endfor %}
|
|
|
|
</select>
|
|
|
|
</div>
|
|
|
|
</div>
|
2021-07-07 11:12:38 +00:00
|
|
|
<div class="row">
|
2020-05-19 16:53:54 +00:00
|
|
|
<label class="col-sm-3 col-form-label">{% trans "Cache" %}</label>
|
|
|
|
<div class="col-sm-6">
|
2021-07-07 11:12:38 +00:00
|
|
|
<select name="cache" class="form-select image-format">
|
2020-07-13 09:33:09 +00:00
|
|
|
{% for mode, name in instance.cache_modes %}
|
2018-10-24 09:04:05 +00:00
|
|
|
<option value="{{ mode }}" {% if mode == default_cache %}selected{% endif %}>{% trans name %}</option>
|
|
|
|
{% endfor %}
|
|
|
|
</select>
|
|
|
|
</div>
|
|
|
|
</div>
|
2021-07-07 11:12:38 +00:00
|
|
|
<div class="row meta-prealloc">
|
2020-05-19 16:53:54 +00:00
|
|
|
<label class="col-sm-3 col-form-label">{% trans "Metadata" %}</label>
|
|
|
|
<div class="col-sm-6">
|
2019-07-31 08:03:48 +00:00
|
|
|
<input type="checkbox" name="meta_prealloc" value="true">
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div class="modal-footer">
|
2021-07-07 11:12:38 +00:00
|
|
|
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">{% trans "Close" %}</button>
|
2020-01-08 08:25:55 +00:00
|
|
|
<button type="submit" class="btn btn-success" name="add_new_vol">{% trans "Add Volume" %}</button>
|
2019-07-31 08:03:48 +00:00
|
|
|
</div>
|
2020-05-19 16:53:54 +00:00
|
|
|
</form>
|
2018-10-24 09:04:05 +00:00
|
|
|
</div>
|
2020-05-19 16:53:54 +00:00
|
|
|
</div> <!-- /.modal-body -->
|
|
|
|
<div class="tab-pane" id="ExistingDisk">
|
2020-07-13 09:33:09 +00:00
|
|
|
<form action="{% url 'instances:add_existing_vol' instance.id %}" method="post" role="form" aria-label="Add existing volume to instance form">{% csrf_token %}
|
2019-07-31 08:03:48 +00:00
|
|
|
<div class="modal-body">
|
2021-07-07 11:12:38 +00:00
|
|
|
<p class="fw-bold">{% trans "Volume parameters" %}</p>
|
|
|
|
<div class="row">
|
2020-05-19 16:53:54 +00:00
|
|
|
<label class="col-sm-3 col-form-label">{% trans "Storage" %}</label>
|
|
|
|
<div class="col-sm-6">
|
2019-07-31 08:03:48 +00:00
|
|
|
<div class="dropdown">
|
2021-07-07 11:12:38 +00:00
|
|
|
<button id="select_storage" class="btn btn-secondary dropdown-toggle form-control" type="button" data-bs-toggle="dropdown">{% trans 'Select Pool' %}...</button>
|
2020-05-21 22:13:39 +00:00
|
|
|
<div class="dropdown-menu">
|
|
|
|
{% for storage in storages_host %}
|
2020-07-13 09:33:09 +00:00
|
|
|
<a class="dropdown-item" href="#" onclick="get_volumes({{ instance.compute.id }}, '{{ storage }}')">{{ storage }}</a>
|
2020-05-21 22:13:39 +00:00
|
|
|
{% endfor %}
|
|
|
|
</div>
|
|
|
|
<input id="selected_storage" name="selected_storage" hidden/>
|
2019-07-31 08:03:48 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
2021-07-07 11:12:38 +00:00
|
|
|
<div class="row">
|
2020-05-19 16:53:54 +00:00
|
|
|
<label class="col-sm-3 col-form-label" >{% trans "Volume" %}</label>
|
|
|
|
<div class="col-sm-6">
|
2021-07-07 11:12:38 +00:00
|
|
|
<select id="vols" name="vols" class="form-select" disabled>
|
2019-07-31 08:03:48 +00:00
|
|
|
<option value="" selected>{% trans 'None' %}</option>
|
|
|
|
<!-- populate with javascript -->
|
|
|
|
</select>
|
|
|
|
</div>
|
|
|
|
</div>
|
2021-07-07 11:12:38 +00:00
|
|
|
<div class="row">
|
2020-05-19 16:53:54 +00:00
|
|
|
<label class="col-sm-3 col-form-label">{% trans "Bus" %}</label>
|
|
|
|
<div class="col-sm-6">
|
2021-07-07 11:12:38 +00:00
|
|
|
<select name="bus" class="form-select image-format">
|
2019-10-28 07:45:27 +00:00
|
|
|
{% for bus in bus_host %}
|
2019-07-31 08:03:48 +00:00
|
|
|
<option value="{{ bus }}" {% if bus == default_bus %}selected{% endif %}>{% trans bus %}</option>
|
|
|
|
{% endfor %}
|
|
|
|
</select>
|
|
|
|
</div>
|
|
|
|
</div>
|
2021-07-07 11:12:38 +00:00
|
|
|
<div class="row">
|
2020-05-19 16:53:54 +00:00
|
|
|
<label class="col-sm-3 col-form-label">{% trans "Cache" %}</label>
|
|
|
|
<div class="col-sm-6">
|
2021-07-07 11:12:38 +00:00
|
|
|
<select name="cache" class="form-select image-format">
|
2020-07-13 09:33:09 +00:00
|
|
|
{% for mode, name in instance.cache_modes %}
|
2019-07-31 08:03:48 +00:00
|
|
|
<option value="{{ mode }}" {% if mode == default_cache %}selected{% endif %}>{% trans name %}</option>
|
|
|
|
{% endfor %}
|
|
|
|
</select>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div class="modal-footer">
|
2021-07-07 11:12:38 +00:00
|
|
|
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">{% trans "Close" %}</button>
|
2020-07-13 09:33:09 +00:00
|
|
|
<button type="submit" class="btn btn-success">{% trans "Add Volume" %}</button>
|
2019-07-31 08:03:48 +00:00
|
|
|
</div>
|
|
|
|
</form>
|
2018-10-19 13:11:22 +00:00
|
|
|
</div>
|
2020-05-19 16:53:54 +00:00
|
|
|
</div>
|
|
|
|
|
2019-07-31 08:03:48 +00:00
|
|
|
</div> <!-- /.modal-content -->
|
|
|
|
</div> <!-- /.modal-dialog -->
|
|
|
|
</div> <!-- /.modal -->
|
2018-10-19 13:11:22 +00:00
|
|
|
{% endif %}
|