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

Merge pull request #409 from catborise/master

script fixes etc
This commit is contained in:
catborise 2021-01-26 09:20:23 +03:00 committed by GitHub
commit 6571ab372f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 42 additions and 27 deletions

View file

@ -22,7 +22,7 @@
How to update <code>gstfsd</code> daemon on hypervisor: How to update <code>gstfsd</code> daemon on hypervisor:
```bash ```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 sudo service supervisor restart
``` ```
@ -86,7 +86,7 @@ sudo service supervisor restart
Setup libvirt and KVM on server Setup libvirt and KVM on server
```bash ```bash
wget -O - https://clck.ru/9V9fH | sudo sh wget -O - https://bit.ly/36baWUu | sudo sh
``` ```
Done!! Done!!

View file

@ -1,5 +1,5 @@
[program:gstfsd] [program:gstfsd]
command=/srv/webvirtcloud/venv/bin/python3 /usr/local/bin/gstfsd command=/usr/bin/python3 /usr/local/bin/gstfsd
directory=/usr/local/bin directory=/usr/local/bin
user=root user=root
autostart=true autostart=true

View file

@ -45,7 +45,7 @@ echowarn() {
# DESCRIPTION: Echo debug information to stdout. # DESCRIPTION: Echo debug information to stdout.
#------------------------------------------------------------------------------- #-------------------------------------------------------------------------------
echodebug() { echodebug() {
if [ "$_ECHO_DEBUG" -eq "$BS_TRUE" ]; then if [ $_ECHO_DEBUG -eq $BS_TRUE ]; then
printf "${BC} * DEBUG${EC}: %s\n" "$@"; printf "${BC} * DEBUG${EC}: %s\n" "$@";
fi fi
} }
@ -342,7 +342,7 @@ __check_end_of_life_versions() {
;; ;;
centos) 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 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 "End of life distributions are not supported."
echoerror "Please consider upgrading to the next stable. See:" echoerror "Please consider upgrading to the next stable. See:"
@ -374,13 +374,18 @@ __check_end_of_life_versions
# CentOS Install Functions # CentOS Install Functions
# #
install_centos() { install_centos() {
if [ "$DISTRO_MAJOR_VERSION" -ge 6 ]; then yum -y install epel-release || return 1
yum -y install qemu-kvm libvirt bridge-utils python-libguestfs libguestfs-tools supervisor cyrus-sasl-md5 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 fi
return 0 return 0
} }
install_centos_post() { install_centos_post() {
if [ "$DISTRO_MAJOR_VERSION" -lt 8 ]; then
if [ -f /etc/sysconfig/libvirtd ]; then if [ -f /etc/sysconfig/libvirtd ]; then
sed -i 's/#LIBVIRTD_ARGS/LIBVIRTD_ARGS/g' /etc/sysconfig/libvirtd sed -i 's/#LIBVIRTD_ARGS/LIBVIRTD_ARGS/g' /etc/sysconfig/libvirtd
else else
@ -395,6 +400,7 @@ install_centos_post() {
echoerror "/etc/libvirt/libvirtd.conf not found. Exiting..." echoerror "/etc/libvirt/libvirtd.conf not found. Exiting..."
exit 1 exit 1
fi fi
fi
if [ -f /etc/libvirt/qemu.conf ]; then if [ -f /etc/libvirt/qemu.conf ]; then
sed -i 's/#[ ]*vnc_listen.*/vnc_listen = "0.0.0.0"/g' /etc/libvirt/qemu.conf sed -i 's/#[ ]*vnc_listen.*/vnc_listen = "0.0.0.0"/g' /etc/libvirt/qemu.conf
sed -i 's/#[ ]*spice_listen.*/spice_listen = "0.0.0.0"/g' /etc/libvirt/qemu.conf sed -i 's/#[ ]*spice_listen.*/spice_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 stop > /dev/null 2>&1
service libvirt-guests start service libvirt-guests start
fi fi
if [ "$DISTRO_MAJOR_VERSION" -lt 8 ]; then
if [ -f /usr/lib/systemd/system/libvirtd.service ]; then if [ -f /usr/lib/systemd/system/libvirtd.service ]; then
systemctl stop libvirtd.service > /dev/null 2>&1 systemctl stop libvirtd.service > /dev/null 2>&1
systemctl start libvirtd.service systemctl start libvirtd.service
fi 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 if [ -f /usr/lib/systemd/system/libvirt-guests.service ]; then
systemctl stop libvirt-guests.service > /dev/null 2>&1 systemctl stop libvirt-guests.service > /dev/null 2>&1
systemctl start libvirt-guests.service systemctl start libvirt-guests.service
fi fi
if [ -f /etc/init.d/supervisord ]; then if [ -f /etc/init.d/supervisord ]; then
service supervisord stop > /dev/null 2>&1 service supervisord stop > /dev/null 2>&1
service supervisord start 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 apt install -y qemu-kvm libvirt-bin bridge-utils virt-manager sasl2-bin python3-guestfs supervisor || return 1
fi fi
return 0 return 0
} }

View file

@ -769,7 +769,7 @@ def revert_snapshot(request, pk):
msg = _("Successful revert snapshot: ") msg = _("Successful revert snapshot: ")
msg += snap_name msg += snap_name
messages.success(request, msg) 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) addlogmsg(request.user.username, instance.name, msg)
return redirect(request.META.get("HTTP_REFERER") + "#managesnapshot") return redirect(request.META.get("HTTP_REFERER") + "#managesnapshot")
@ -887,7 +887,7 @@ def set_video_model(request, pk):
instance = get_instance(request.user, pk) instance = get_instance(request.user, pk)
video_model = request.POST.get("video_model", "vga") video_model = request.POST.get("video_model", "vga")
instance.proxy.set_video_model(video_model) 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) addlogmsg(request.user.username, instance.name, msg)
return redirect(request.META.get("HTTP_REFERER") + "#options") return redirect(request.META.get("HTTP_REFERER") + "#options")

View file

@ -455,7 +455,7 @@ case $distro in
log "yum -y install wget epel-release" log "yum -y install wget epel-release"
echo "* Installing OS requirements." 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 install_packages
set_hosts set_hosts