Skip to content

Commit 59af676

Browse files
committed
fix centos 8 bootstrap script to handle new libvirt start mechanism
1 parent 47331ba commit 59af676

File tree

4 files changed

+40
-25
lines changed

4 files changed

+40
-25
lines changed

README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
How to update <code>gstfsd</code> daemon on hypervisor:
2323

2424
```bash
25-
wget -O - https://clck.ru/9VMRH | sudo tee -a /usr/local/bin/gstfsd
25+
wget -O - https://bit.ly/2NAaWXG | sudo tee -a /usr/local/bin/gstfsd
2626
sudo service supervisor restart
2727
```
2828

@@ -86,7 +86,7 @@ sudo service supervisor restart
8686
Setup libvirt and KVM on server
8787

8888
```bash
89-
wget -O - https://clck.ru/9V9fH | sudo sh
89+
wget -O - https://bit.ly/36baWUu | sudo sh
9090
```
9191

9292
Done!!

conf/supervisor/gstfsd.conf

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[program:gstfsd]
2-
command=/srv/webvirtcloud/venv/bin/python3 /usr/local/bin/gstfsd
2+
command=/usr/bin/python3 /usr/local/bin/gstfsd
33
directory=/usr/local/bin
44
user=root
55
autostart=true

dev/libvirt-bootstrap.sh

+36-21
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ echowarn() {
4545
# DESCRIPTION: Echo debug information to stdout.
4646
#-------------------------------------------------------------------------------
4747
echodebug() {
48-
if [ "$_ECHO_DEBUG" -eq "$BS_TRUE" ]; then
48+
if [ $_ECHO_DEBUG -eq $BS_TRUE ]; then
4949
printf "${BC} * DEBUG${EC}: %s\n" "$@";
5050
fi
5151
}
@@ -342,7 +342,7 @@ __check_end_of_life_versions() {
342342
;;
343343

344344
centos)
345-
# CentOS versions lower than 5 are no longer supported
345+
# CentOS versions lower than 6 are no longer supported
346346
if { [ "$DISTRO_MAJOR_VERSION" -eq 6 ] && [ "$DISTRO_MINOR_VERSION" -lt 3 ]; } || [ "$DISTRO_MAJOR_VERSION" -lt 5 ]; then
347347
echoerror "End of life distributions are not supported."
348348
echoerror "Please consider upgrading to the next stable. See:"
@@ -374,26 +374,32 @@ __check_end_of_life_versions
374374
# CentOS Install Functions
375375
#
376376
install_centos() {
377-
if [ "$DISTRO_MAJOR_VERSION" -ge 6 ]; then
378-
yum -y install qemu-kvm libvirt bridge-utils python-libguestfs libguestfs-tools supervisor cyrus-sasl-md5 epel-release || return 1
377+
yum -y install epel-release || return 1
378+
379+
if [ "$DISTRO_MAJOR_VERSION" -lt 8 ]; then
380+
yum -y install qemu-kvm libvirt bridge-utils python-libguestfs libguestfs-tools supervisor cyrus-sasl-md5 || return 1
381+
else
382+
yum -y install qemu-kvm libvirt python3-libguestfs libguestfs-tools cyrus-sasl-md5 supervisor || return 1
379383
fi
380384
return 0
381385
}
382386

383387
install_centos_post() {
384-
if [ -f /etc/sysconfig/libvirtd ]; then
385-
sed -i 's/#LIBVIRTD_ARGS/LIBVIRTD_ARGS/g' /etc/sysconfig/libvirtd
386-
else
387-
echoerror "/etc/sysconfig/libvirtd not found. Exiting..."
388-
exit 1
389-
fi
390-
if [ -f /etc/libvirt/libvirtd.conf ]; then
391-
sed -i 's/#listen_tls/listen_tls/g' /etc/libvirt/libvirtd.conf
392-
sed -i 's/#listen_tcp/listen_tcp/g' /etc/libvirt/libvirtd.conf
393-
sed -i 's/#auth_tcp/auth_tcp/g' /etc/libvirt/libvirtd.conf
394-
else
395-
echoerror "/etc/libvirt/libvirtd.conf not found. Exiting..."
396-
exit 1
388+
if [ "$DISTRO_MAJOR_VERSION" -lt 8 ]; then
389+
if [ -f /etc/sysconfig/libvirtd ]; then
390+
sed -i 's/#LIBVIRTD_ARGS/LIBVIRTD_ARGS/g' /etc/sysconfig/libvirtd
391+
else
392+
echoerror "/etc/sysconfig/libvirtd not found. Exiting..."
393+
exit 1
394+
fi
395+
if [ -f /etc/libvirt/libvirtd.conf ]; then
396+
sed -i 's/#listen_tls/listen_tls/g' /etc/libvirt/libvirtd.conf
397+
sed -i 's/#listen_tcp/listen_tcp/g' /etc/libvirt/libvirtd.conf
398+
sed -i 's/#auth_tcp/auth_tcp/g' /etc/libvirt/libvirtd.conf
399+
else
400+
echoerror "/etc/libvirt/libvirtd.conf not found. Exiting..."
401+
exit 1
402+
fi
397403
fi
398404
if [ -f /etc/libvirt/qemu.conf ]; then
399405
sed -i 's/#[ ]*vnc_listen.*/vnc_listen = "0.0.0.0"/g' /etc/libvirt/qemu.conf
@@ -440,14 +446,24 @@ daemons_running_centos() {
440446
service libvirt-guests stop > /dev/null 2>&1
441447
service libvirt-guests start
442448
fi
443-
if [ -f /usr/lib/systemd/system/libvirtd.service ]; then
444-
systemctl stop libvirtd.service > /dev/null 2>&1
445-
systemctl start libvirtd.service
449+
450+
if [ "$DISTRO_MAJOR_VERSION" -lt 8 ]; then
451+
if [ -f /usr/lib/systemd/system/libvirtd.service ]; then
452+
systemctl stop libvirtd.service > /dev/null 2>&1
453+
systemctl start libvirtd.service
454+
fi
455+
else
456+
if [ -f /usr/lib/systemd/system/libvirtd-tcp.socket ]; then
457+
systemctl stop libvirtd-tcp.socket > /dev/null 2>&1
458+
systemctl start libvirtd-tcp.socket
459+
fi
446460
fi
461+
447462
if [ -f /usr/lib/systemd/system/libvirt-guests.service ]; then
448463
systemctl stop libvirt-guests.service > /dev/null 2>&1
449464
systemctl start libvirt-guests.service
450465
fi
466+
451467
if [ -f /etc/init.d/supervisord ]; then
452468
service supervisord stop > /dev/null 2>&1
453469
service supervisord start
@@ -599,7 +615,6 @@ install_ubuntu() {
599615
apt install -y qemu-kvm libvirt-bin bridge-utils virt-manager sasl2-bin python3-guestfs supervisor || return 1
600616
fi
601617

602-
603618
return 0
604619
}
605620

webvirtcloud.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -455,7 +455,7 @@ case $distro in
455455
log "yum -y install wget epel-release"
456456

457457
echo "* Installing OS requirements."
458-
PACKAGES="git python3-virtualenv python3-devel libvirt-devel glibc gcc nginx supervisor python3-lxml python3-libguestfs iproute-tc cyrus-sasl-md5 python3-libguestfs"
458+
PACKAGES="git python3-virtualenv python3-devel libvirt-devel glibc gcc nginx supervisor python3-lxml python3-libguestfs iproute-tc cyrus-sasl-md5"
459459
install_packages
460460

461461
set_hosts

0 commit comments

Comments
 (0)