mirror of
https://github.com/retspen/webvirtcloud
synced 2024-12-24 15:15:22 +00:00
Merge pull request #211 from catborise/master
fix some glitches & update
This commit is contained in:
commit
4b9ae89324
6 changed files with 23 additions and 16 deletions
|
@ -441,7 +441,7 @@
|
|||
<label class="col-sm-3 control-label">{% trans "HDD" %}</label>
|
||||
<input id="images" name="images" type="hidden" value=""/>
|
||||
<div class="col-sm-3">
|
||||
<select id="temp-storage-control" name="temp-storage-control" class="form-control" onchange="get_template_vols({{ compute_id }}, value);">
|
||||
<select id="storage" name="storage" class="form-control" onchange="get_template_vols({{ compute_id }}, value);">
|
||||
{% if storages %}
|
||||
<option value disabled selected>{% trans "Select pool" %}...</option>
|
||||
{% for storage in storages %}
|
||||
|
|
|
@ -125,12 +125,11 @@ def create_instance(request, compute_id):
|
|||
volume['device'] = 'disk'
|
||||
volume['bus'] = 'virtio'
|
||||
volume_list.append(volume)
|
||||
#volumes[path] = conn.get_volume_type(path)
|
||||
except libvirtError as lib_err:
|
||||
error_messages.append(lib_err.message)
|
||||
elif data['template']:
|
||||
templ_path = conn.get_volume_path(data['template'])
|
||||
dest_vol = conn.get_volume_path(data["name"] + ".img")
|
||||
dest_vol = conn.get_volume_path(data["name"] + ".img", data['storage'])
|
||||
if dest_vol:
|
||||
error_msg = _("Image has already exist. Please check volumes or change instance name")
|
||||
error_messages.append(error_msg)
|
||||
|
@ -142,7 +141,6 @@ def create_instance(request, compute_id):
|
|||
volume['device'] = 'disk'
|
||||
volume['bus'] = 'virtio'
|
||||
volume_list.append(volume)
|
||||
#volumes[clone_path] = conn.get_volume_type(clone_path)
|
||||
else:
|
||||
if not data['images']:
|
||||
error_msg = _("First you need to create or select an image")
|
||||
|
@ -158,9 +156,6 @@ def create_instance(request, compute_id):
|
|||
volume['device'] = request.POST.get('device' + str(idx), '')
|
||||
volume['bus'] = request.POST.get('bus' + str(idx), '')
|
||||
volume_list.append(volume)
|
||||
|
||||
#volumes[path] = conn.get_volume_type(path)
|
||||
|
||||
except libvirtError as lib_err:
|
||||
error_messages.append(lib_err.message)
|
||||
if data['cache_mode'] not in conn.get_cache_modes():
|
||||
|
|
|
@ -590,15 +590,23 @@ daemons_running_opensuse() {
|
|||
#
|
||||
install_ubuntu() {
|
||||
apt-get update || return 1
|
||||
apt-get -y install kvm libvirt-bin bridge-utils sasl2-bin python-guestfs supervisor || return 1
|
||||
if [ $DISTRO_MAJOR_VERSION -lt 18 ]; then
|
||||
apt-get -y install kvm libvirt-bin bridge-utils sasl2-bin python-guestfs supervisor || return 1
|
||||
else
|
||||
apt install -y qemu-kvm libvirt-bin bridge-utils virt-manager sasl2-bin python-guestfs supervisor || return 1
|
||||
fi
|
||||
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
install_ubuntu_post() {
|
||||
if [ -f /etc/default/libvirt-bin ]; then
|
||||
sed -i 's/libvirtd_opts="-d"/libvirtd_opts="-d -l"/g' /etc/default/libvirt-bin
|
||||
elif [ -f /etc/default/libvirtd ]; then
|
||||
sed -i 's/libvirtd_opts="-d"/libvirtd_opts="-d -l"/g' /etc/default/libvirtd
|
||||
else
|
||||
echoerror "/etc/default/libvirt-bin not found. Exiting..."
|
||||
echoerror "/etc/default/libvirt-bin or /etc/default/libvirtd not found. Exiting..."
|
||||
exit 1
|
||||
fi
|
||||
if [ -f /etc/libvirt/libvirtd.conf ]; then
|
||||
|
|
|
@ -55,11 +55,11 @@
|
|||
<table class="table table-hover table-striped sortable-theme-bootstrap" data-sortable>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Name</th>
|
||||
<th>Status</th>
|
||||
<th>VCPU</th>
|
||||
<th>Memory</th>
|
||||
<th data-sortable="false" style="width: 165px;">Actions</th>
|
||||
<th>{% trans 'Name' %}</th>
|
||||
<th>{% trans 'Status' %}</th>
|
||||
<th>{% trans 'VCPU' %}</th>
|
||||
<th>{% trans 'Memory' %}</th>
|
||||
<th data-sortable="false" style="width: 165px;">{% trans 'Actions' %}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody class="searchable">
|
||||
|
|
|
@ -221,6 +221,7 @@ def get_volumes(request, compute_id, pool):
|
|||
compute.password,
|
||||
compute.type,
|
||||
pool)
|
||||
conn.refresh()
|
||||
except libvirtError as liberr:
|
||||
pass
|
||||
data['vols'] = sorted(conn.get_volumes())
|
||||
|
|
|
@ -100,8 +100,11 @@ class wvmCreate(wvmConnect):
|
|||
else:
|
||||
return 'raw'
|
||||
|
||||
def get_volume_path(self, volume):
|
||||
storages = self.get_storages(only_actives=True)
|
||||
def get_volume_path(self, volume, pool=None):
|
||||
if not pool:
|
||||
storages = self.get_storages(only_actives=True)
|
||||
else:
|
||||
storages = [pool,]
|
||||
for storage in storages:
|
||||
stg = self.get_storage(storage)
|
||||
if stg.info()[0] != 0:
|
||||
|
|
Loading…
Reference in a new issue