From 311f1b793e9c77c5fda44295511619f609cd0d27 Mon Sep 17 00:00:00 2001 From: catborise Date: Tue, 9 Apr 2019 13:46:00 +0300 Subject: [PATCH 1/6] add libguestfs-tools and epel-release for supervisor to centos --- dev/libvirt-bootstrap.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dev/libvirt-bootstrap.sh b/dev/libvirt-bootstrap.sh index e3dd702..948d3d6 100644 --- a/dev/libvirt-bootstrap.sh +++ b/dev/libvirt-bootstrap.sh @@ -375,7 +375,7 @@ __check_end_of_life_versions # install_centos() { if [ $DISTRO_MAJOR_VERSION -ge 6 ]; then - yum -y install qemu-kvm libvirt bridge-utils python-libguestfs supervisor cyrus-sasl-md5 || return 1 + yum -y install qemu-kvm libvirt bridge-utils python-libguestfs libguestfs-tools supervisor cyrus-sasl-md5 epel-release || return 1 fi return 0 } From 52fbe95e305e773d6d7715599bdaea971ee03132 Mon Sep 17 00:00:00 2001 From: "Ing. Jan Krcmar" Date: Tue, 9 Apr 2019 11:19:31 +0200 Subject: [PATCH 2/6] staff users are allowed to change vnc settings of instances --- instances/templates/instance.html | 4 ++-- instances/views.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/instances/templates/instance.html b/instances/templates/instance.html index da2865c..83b9ac8 100644 --- a/instances/templates/instance.html +++ b/instances/templates/instance.html @@ -537,7 +537,7 @@ {% endif %} - {% if request.user.is_superuser or userinstance.is_vnc %} + {% if request.user.is_superuser or request.user.is_staff or userinstance.is_vnc %}
  • {% trans "VNC" %} @@ -963,7 +963,7 @@
    {% endif %} - {% if request.user.is_superuser or userinstance.is_vnc %} + {% if request.user.is_superuser or request.user.is_staff or userinstance.is_vnc %}

    {% trans "To set console's type, shutdown the instance." %}

    {% csrf_token %} diff --git a/instances/views.py b/instances/views.py index ecea01b..67af348 100644 --- a/instances/views.py +++ b/instances/views.py @@ -645,7 +645,7 @@ def instance(request, compute_id, vname): addlogmsg(request.user.username, instance.name, msg) return HttpResponseRedirect(request.get_full_path() + '#xmledit') - if request.user.is_superuser or userinstance.is_vnc: + if request.user.is_superuser or request.user.is_staff or userinstance.is_vnc: if 'set_console_passwd' in request.POST: if request.POST.get('auto_pass', ''): passwd = randomPasswd() From 6bc4e895b6f3fe8d9e4fed464f930ddc4dd9c48c Mon Sep 17 00:00:00 2001 From: catborise Date: Mon, 29 Apr 2019 14:09:17 +0300 Subject: [PATCH 3/6] Add qcow2/qcow extension for vol clone. Make image features additions for only qcow2 images. --- vrtManager/storage.py | 40 ++++++++++++++++++++++++++-------------- 1 file changed, 26 insertions(+), 14 deletions(-) diff --git a/vrtManager/storage.py b/vrtManager/storage.py index 9d6273a..b0d6b52 100644 --- a/vrtManager/storage.py +++ b/vrtManager/storage.py @@ -230,22 +230,31 @@ class wvmStorage(wvmConnect): %s 0644 - - 1.1 - - - - - """ % (name, size, alloc, vol_fmt, owner['uid'], owner['guid']) + """ % (name, size, alloc, vol_fmt, owner['uid'], owner['guid']) + if vol_fmt == 'qcow2': + xml += """ + 1.1 + + + """ + xml += """ + + """ self._createXML(xml, metadata) + return name def clone_volume(self, name, target_file, vol_fmt=None, metadata=False, owner=owner): - storage_type = self.get_type() - if storage_type == 'dir': - target_file += '.img' vol = self.get_volume(name) if not vol_fmt: vol_fmt = self.get_volume_type(name) + + storage_type = self.get_type() + if storage_type == 'dir': + if vol_fmt in ('qcow', 'qcow2'): + target_file += '.' + vol_fmt + else: + target_file += '.img' + xml = """ %s @@ -258,11 +267,14 @@ class wvmStorage(wvmConnect): %s 0644 - + """ % (target_file, vol_fmt, owner['uid'], owner['guid']) + if vol_fmt == 'qcow2': + xml += """ 1.1 - - - """ % (target_file, vol_fmt, owner['uid'],owner['guid']) + """ + xml += """ + """ self._createXMLFrom(xml, vol, metadata) + return target_file From 3a15b49796dddba4f0c318575c6aa8cbd6639310 Mon Sep 17 00:00:00 2001 From: catborise Date: Mon, 29 Apr 2019 14:10:54 +0300 Subject: [PATCH 4/6] Fix image clone/add logs --- storages/views.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/storages/views.py b/storages/views.py index ea14f5f..d128de2 100644 --- a/storages/views.py +++ b/storages/views.py @@ -155,8 +155,8 @@ def storage(request, compute_id, pool): if data['meta_prealloc'] and data['format'] == 'qcow2': meta_prealloc = True try: - conn.create_volume(data['name'], data['size'], data['format'], meta_prealloc) - messages.success(request, _("Image file {} is created successfully".format(data['name']+".img"))) + name = conn.create_volume(data['name'], data['size'], data['format'], meta_prealloc) + messages.success(request, _("Image file {} is created successfully".format(name))) return HttpResponseRedirect(request.get_full_path()) except libvirtError as lib_err: error_messages.append(lib_err) @@ -184,10 +184,10 @@ def storage(request, compute_id, pool): form = CloneImage(request.POST) if form.is_valid(): data = form.cleaned_data - img_name = data['name'] + '.img' + img_name = data['name'] meta_prealloc = 0 if img_name in conn.update_volumes(): - msg = _("Name of volume name already use") + msg = _("Name of volume already in use") error_messages.append(msg) if not error_messages: if data['convert']: @@ -197,8 +197,8 @@ def storage(request, compute_id, pool): else: format = None try: - conn.clone_volume(data['image'], data['name'], format, meta_prealloc) - messages.success(request, _("{} image cloned as {} successfully".format(data['image'], data['name'] + ".img"))) + name = conn.clone_volume(data['image'], data['name'], format, meta_prealloc) + messages.success(request, _("{} image cloned as {} successfully".format(data['image'], name))) return HttpResponseRedirect(request.get_full_path()) except libvirtError as lib_err: error_messages.append(lib_err) From 30e1f0eb2d89fec3d9ef9ccaf80d789acbfe9ff1 Mon Sep 17 00:00:00 2001 From: catborise Date: Mon, 29 Apr 2019 14:11:20 +0300 Subject: [PATCH 5/6] Remove .img extension label --- storages/templates/create_stg_vol_block.html | 1 - storages/templates/storage.html | 1 - 2 files changed, 2 deletions(-) diff --git a/storages/templates/create_stg_vol_block.html b/storages/templates/create_stg_vol_block.html index ac22167..fbb33d9 100644 --- a/storages/templates/create_stg_vol_block.html +++ b/storages/templates/create_stg_vol_block.html @@ -52,7 +52,6 @@
    -
    diff --git a/storages/templates/storage.html b/storages/templates/storage.html index 17ed99c..e806cf3 100644 --- a/storages/templates/storage.html +++ b/storages/templates/storage.html @@ -132,7 +132,6 @@
    -