1
0
Fork 0
mirror of https://github.com/retspen/webvirtcloud synced 2024-12-24 23:25:24 +00:00

Merge pull request #211 from catborise/master

fix some glitches & update
This commit is contained in:
Anatoliy Guskov 2018-12-28 13:50:33 +02:00 committed by GitHub
commit 4b9ae89324
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 23 additions and 16 deletions

View file

@ -441,7 +441,7 @@
<label class="col-sm-3 control-label">{% trans "HDD" %}</label> <label class="col-sm-3 control-label">{% trans "HDD" %}</label>
<input id="images" name="images" type="hidden" value=""/> <input id="images" name="images" type="hidden" value=""/>
<div class="col-sm-3"> <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 %} {% if storages %}
<option value disabled selected>{% trans "Select pool" %}...</option> <option value disabled selected>{% trans "Select pool" %}...</option>
{% for storage in storages %} {% for storage in storages %}

View file

@ -125,12 +125,11 @@ def create_instance(request, compute_id):
volume['device'] = 'disk' volume['device'] = 'disk'
volume['bus'] = 'virtio' volume['bus'] = 'virtio'
volume_list.append(volume) volume_list.append(volume)
#volumes[path] = conn.get_volume_type(path)
except libvirtError as lib_err: except libvirtError as lib_err:
error_messages.append(lib_err.message) error_messages.append(lib_err.message)
elif data['template']: elif data['template']:
templ_path = conn.get_volume_path(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: if dest_vol:
error_msg = _("Image has already exist. Please check volumes or change instance name") error_msg = _("Image has already exist. Please check volumes or change instance name")
error_messages.append(error_msg) error_messages.append(error_msg)
@ -142,7 +141,6 @@ def create_instance(request, compute_id):
volume['device'] = 'disk' volume['device'] = 'disk'
volume['bus'] = 'virtio' volume['bus'] = 'virtio'
volume_list.append(volume) volume_list.append(volume)
#volumes[clone_path] = conn.get_volume_type(clone_path)
else: else:
if not data['images']: if not data['images']:
error_msg = _("First you need to create or select an image") 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['device'] = request.POST.get('device' + str(idx), '')
volume['bus'] = request.POST.get('bus' + str(idx), '') volume['bus'] = request.POST.get('bus' + str(idx), '')
volume_list.append(volume) volume_list.append(volume)
#volumes[path] = conn.get_volume_type(path)
except libvirtError as lib_err: except libvirtError as lib_err:
error_messages.append(lib_err.message) error_messages.append(lib_err.message)
if data['cache_mode'] not in conn.get_cache_modes(): if data['cache_mode'] not in conn.get_cache_modes():

View file

@ -590,15 +590,23 @@ daemons_running_opensuse() {
# #
install_ubuntu() { install_ubuntu() {
apt-get update || return 1 apt-get update || 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 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 return 0
} }
install_ubuntu_post() { install_ubuntu_post() {
if [ -f /etc/default/libvirt-bin ]; then if [ -f /etc/default/libvirt-bin ]; then
sed -i 's/libvirtd_opts="-d"/libvirtd_opts="-d -l"/g' /etc/default/libvirt-bin 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 else
echoerror "/etc/default/libvirt-bin not found. Exiting..." echoerror "/etc/default/libvirt-bin or /etc/default/libvirtd not found. Exiting..."
exit 1 exit 1
fi fi
if [ -f /etc/libvirt/libvirtd.conf ]; then if [ -f /etc/libvirt/libvirtd.conf ]; then

View file

@ -55,11 +55,11 @@
<table class="table table-hover table-striped sortable-theme-bootstrap" data-sortable> <table class="table table-hover table-striped sortable-theme-bootstrap" data-sortable>
<thead> <thead>
<tr> <tr>
<th>Name</th> <th>{% trans 'Name' %}</th>
<th>Status</th> <th>{% trans 'Status' %}</th>
<th>VCPU</th> <th>{% trans 'VCPU' %}</th>
<th>Memory</th> <th>{% trans 'Memory' %}</th>
<th data-sortable="false" style="width: 165px;">Actions</th> <th data-sortable="false" style="width: 165px;">{% trans 'Actions' %}</th>
</tr> </tr>
</thead> </thead>
<tbody class="searchable"> <tbody class="searchable">

View file

@ -221,6 +221,7 @@ def get_volumes(request, compute_id, pool):
compute.password, compute.password,
compute.type, compute.type,
pool) pool)
conn.refresh()
except libvirtError as liberr: except libvirtError as liberr:
pass pass
data['vols'] = sorted(conn.get_volumes()) data['vols'] = sorted(conn.get_volumes())

View file

@ -100,8 +100,11 @@ class wvmCreate(wvmConnect):
else: else:
return 'raw' return 'raw'
def get_volume_path(self, volume): def get_volume_path(self, volume, pool=None):
if not pool:
storages = self.get_storages(only_actives=True) storages = self.get_storages(only_actives=True)
else:
storages = [pool,]
for storage in storages: for storage in storages:
stg = self.get_storage(storage) stg = self.get_storage(storage)
if stg.info()[0] != 0: if stg.info()[0] != 0: