From 47331ba08f290b39cc420d2cd6e30708cd29e43f Mon Sep 17 00:00:00 2001 From: catborise Date: Mon, 25 Jan 2021 16:36:24 +0300 Subject: [PATCH 1/2] fix python string variables for snapshot and video model --- instances/views.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/instances/views.py b/instances/views.py index 5bccd37..6d4b33a 100644 --- a/instances/views.py +++ b/instances/views.py @@ -769,7 +769,7 @@ def revert_snapshot(request, pk): msg = _("Successful revert snapshot: ") msg += snap_name messages.success(request, msg) - msg = _("Revert snapshot: %(snap)") % {"snap": snap_name} + msg = _("Revert snapshot: %(snap)s") % {"snap": snap_name} addlogmsg(request.user.username, instance.name, msg) return redirect(request.META.get("HTTP_REFERER") + "#managesnapshot") @@ -887,7 +887,7 @@ def set_video_model(request, pk): instance = get_instance(request.user, pk) video_model = request.POST.get("video_model", "vga") instance.proxy.set_video_model(video_model) - msg = _("Set Video Model: %(model)") % {"model": video_model} + msg = _("Set Video Model: %(model)s") % {"model": video_model} addlogmsg(request.user.username, instance.name, msg) return redirect(request.META.get("HTTP_REFERER") + "#options") From 59af676f68c9dc4a59dd337ff68d4196091a3862 Mon Sep 17 00:00:00 2001 From: catborise Date: Mon, 25 Jan 2021 16:53:09 +0300 Subject: [PATCH 2/2] fix centos 8 bootstrap script to handle new libvirt start mechanism --- README.md | 4 +-- conf/supervisor/gstfsd.conf | 2 +- dev/libvirt-bootstrap.sh | 57 +++++++++++++++++++++++-------------- webvirtcloud.sh | 2 +- 4 files changed, 40 insertions(+), 25 deletions(-) diff --git a/README.md b/README.md index 637fef2..54f826f 100644 --- a/README.md +++ b/README.md @@ -22,7 +22,7 @@ How to update gstfsd daemon on hypervisor: ```bash -wget -O - https://clck.ru/9VMRH | sudo tee -a /usr/local/bin/gstfsd +wget -O - https://bit.ly/2NAaWXG | sudo tee -a /usr/local/bin/gstfsd sudo service supervisor restart ``` @@ -86,7 +86,7 @@ sudo service supervisor restart Setup libvirt and KVM on server ```bash -wget -O - https://clck.ru/9V9fH | sudo sh +wget -O - https://bit.ly/36baWUu | sudo sh ``` Done!! diff --git a/conf/supervisor/gstfsd.conf b/conf/supervisor/gstfsd.conf index 094f41c..71592aa 100644 --- a/conf/supervisor/gstfsd.conf +++ b/conf/supervisor/gstfsd.conf @@ -1,5 +1,5 @@ [program:gstfsd] -command=/srv/webvirtcloud/venv/bin/python3 /usr/local/bin/gstfsd +command=/usr/bin/python3 /usr/local/bin/gstfsd directory=/usr/local/bin user=root autostart=true diff --git a/dev/libvirt-bootstrap.sh b/dev/libvirt-bootstrap.sh index 67ef6e2..e1e1442 100644 --- a/dev/libvirt-bootstrap.sh +++ b/dev/libvirt-bootstrap.sh @@ -45,7 +45,7 @@ echowarn() { # DESCRIPTION: Echo debug information to stdout. #------------------------------------------------------------------------------- echodebug() { - if [ "$_ECHO_DEBUG" -eq "$BS_TRUE" ]; then + if [ $_ECHO_DEBUG -eq $BS_TRUE ]; then printf "${BC} * DEBUG${EC}: %s\n" "$@"; fi } @@ -342,7 +342,7 @@ __check_end_of_life_versions() { ;; centos) - # CentOS versions lower than 5 are no longer supported + # CentOS versions lower than 6 are no longer supported if { [ "$DISTRO_MAJOR_VERSION" -eq 6 ] && [ "$DISTRO_MINOR_VERSION" -lt 3 ]; } || [ "$DISTRO_MAJOR_VERSION" -lt 5 ]; then echoerror "End of life distributions are not supported." echoerror "Please consider upgrading to the next stable. See:" @@ -374,26 +374,32 @@ __check_end_of_life_versions # CentOS Install Functions # install_centos() { - if [ "$DISTRO_MAJOR_VERSION" -ge 6 ]; then - yum -y install qemu-kvm libvirt bridge-utils python-libguestfs libguestfs-tools supervisor cyrus-sasl-md5 epel-release || return 1 + yum -y install epel-release || return 1 + + if [ "$DISTRO_MAJOR_VERSION" -lt 8 ]; then + yum -y install qemu-kvm libvirt bridge-utils python-libguestfs libguestfs-tools supervisor cyrus-sasl-md5 || return 1 + else + yum -y install qemu-kvm libvirt python3-libguestfs libguestfs-tools cyrus-sasl-md5 supervisor || return 1 fi return 0 } install_centos_post() { - if [ -f /etc/sysconfig/libvirtd ]; then - sed -i 's/#LIBVIRTD_ARGS/LIBVIRTD_ARGS/g' /etc/sysconfig/libvirtd - else - echoerror "/etc/sysconfig/libvirtd not found. Exiting..." - exit 1 - fi - if [ -f /etc/libvirt/libvirtd.conf ]; then - sed -i 's/#listen_tls/listen_tls/g' /etc/libvirt/libvirtd.conf - sed -i 's/#listen_tcp/listen_tcp/g' /etc/libvirt/libvirtd.conf - sed -i 's/#auth_tcp/auth_tcp/g' /etc/libvirt/libvirtd.conf - else - echoerror "/etc/libvirt/libvirtd.conf not found. Exiting..." - exit 1 + if [ "$DISTRO_MAJOR_VERSION" -lt 8 ]; then + if [ -f /etc/sysconfig/libvirtd ]; then + sed -i 's/#LIBVIRTD_ARGS/LIBVIRTD_ARGS/g' /etc/sysconfig/libvirtd + else + echoerror "/etc/sysconfig/libvirtd not found. Exiting..." + exit 1 + fi + if [ -f /etc/libvirt/libvirtd.conf ]; then + sed -i 's/#listen_tls/listen_tls/g' /etc/libvirt/libvirtd.conf + sed -i 's/#listen_tcp/listen_tcp/g' /etc/libvirt/libvirtd.conf + sed -i 's/#auth_tcp/auth_tcp/g' /etc/libvirt/libvirtd.conf + else + echoerror "/etc/libvirt/libvirtd.conf not found. Exiting..." + exit 1 + fi fi if [ -f /etc/libvirt/qemu.conf ]; then sed -i 's/#[ ]*vnc_listen.*/vnc_listen = "0.0.0.0"/g' /etc/libvirt/qemu.conf @@ -440,14 +446,24 @@ daemons_running_centos() { service libvirt-guests stop > /dev/null 2>&1 service libvirt-guests start fi - if [ -f /usr/lib/systemd/system/libvirtd.service ]; then - systemctl stop libvirtd.service > /dev/null 2>&1 - systemctl start libvirtd.service + + if [ "$DISTRO_MAJOR_VERSION" -lt 8 ]; then + if [ -f /usr/lib/systemd/system/libvirtd.service ]; then + systemctl stop libvirtd.service > /dev/null 2>&1 + systemctl start libvirtd.service + fi + else + if [ -f /usr/lib/systemd/system/libvirtd-tcp.socket ]; then + systemctl stop libvirtd-tcp.socket > /dev/null 2>&1 + systemctl start libvirtd-tcp.socket + fi fi + if [ -f /usr/lib/systemd/system/libvirt-guests.service ]; then systemctl stop libvirt-guests.service > /dev/null 2>&1 systemctl start libvirt-guests.service fi + if [ -f /etc/init.d/supervisord ]; then service supervisord stop > /dev/null 2>&1 service supervisord start @@ -599,7 +615,6 @@ install_ubuntu() { apt install -y qemu-kvm libvirt-bin bridge-utils virt-manager sasl2-bin python3-guestfs supervisor || return 1 fi - return 0 } diff --git a/webvirtcloud.sh b/webvirtcloud.sh index 04d415e..86b69ee 100644 --- a/webvirtcloud.sh +++ b/webvirtcloud.sh @@ -455,7 +455,7 @@ case $distro in log "yum -y install wget epel-release" echo "* Installing OS requirements." - PACKAGES="git python3-virtualenv python3-devel libvirt-devel glibc gcc nginx supervisor python3-lxml python3-libguestfs iproute-tc cyrus-sasl-md5 python3-libguestfs" + PACKAGES="git python3-virtualenv python3-devel libvirt-devel glibc gcc nginx supervisor python3-lxml python3-libguestfs iproute-tc cyrus-sasl-md5" install_packages set_hosts