Browse Source

new libvirt version with logging

master
Antoine 3 months ago
parent
commit
ebd073a56c
Signed by: antoine <antoinroux@hotmail.fr> GPG Key ID: 098FB66FC0475E70
3 changed files with 26 additions and 5 deletions
  1. +3
    -1
      Dockerfile
  2. +5
    -0
      docker-compose.yml
  3. +18
    -4
      libvirtd.sh

+ 3
- 1
Dockerfile View File

@@ -11,8 +11,10 @@ RUN yum install -y \
libvirt-client \
selinux-policy selinux-policy-targeted \
wget \
augeas
augeas \
procps

ENV LOG_LEVEL 3
COPY augconf /augconf
COPY libvirtd.sh /libvirtd.sh



+ 5
- 0
docker-compose.yml View File

@@ -14,6 +14,11 @@ services:
environment:
LIBVIRTD_DEFAULT_NETWORK: "true"
LIBVIRTD_DEFAULT_POOL_PATH: "/var/lib/libvirt/pool/default"
# 1: DEBUG
# 2: INFO
# 3: WARNING
# 4: ERROR
LOG_LEVEL: 1
volumes:
- /var/run/dbus/system_bus_socket:/var/run/dbus/system_bus_socket
- libvirt-pool:/var/lib/libvirt/pool


+ 18
- 4
libvirtd.sh View File

@@ -50,6 +50,20 @@ mkdir -p /var/log/libvirt
touch /var/log/libvirt/qemu.log
chown qemu:qemu /var/log/libvirt/qemu.log

# clean previously configured value into /etc/libvirt/libvirtd.conf
sed -i 's/^log_level.*//g' /etc/libvirt/libvirtd.conf
sed -i 's/^log_outputs.*//g' /etc/libvirt/libvirtd.conf
# replace commented default value to appropriate configuration
sed -i "s/^#log_level.*/log_level = $LOG_LEVEL/g" /etc/libvirt/libvirtd.conf
sed -i "s/^#log_outputs.*/log_outputs=\"$LOG_LEVEL:file:\/var\/log\/libvirt\/libvirtd.log\"/g" /etc/libvirt/libvirtd.conf

# clean previously configured value into /etc/libvirt/virtlogd.conf
sed -i 's/^log_level.*//g' /etc/libvirt/virtlogd.conf
sed -i 's/^log_outputs.*//g' /etc/libvirt/virtlogd.conf
# replace commented default value to appropriate configuration
sed -i "s/^#log_level.*/log_level = $LOG_LEVEL/g" /etc/libvirt/virtlogd.conf
sed -i "s/^#log_outputs.*/log_outputs=\"$LOG_LEVEL:file:\/var\/log\/libvirt\/libvirtd.log\"/g" /etc/libvirt/virtlogd.conf

# We create the network on a file basis to not
# have to wait for libvirtd to come up
if [[ -n "$LIBVIRTD_DEFAULT_NETWORK" ]]; then
@@ -75,16 +89,16 @@ fi
# have to wait for libvirtd to come up
if [[ -n "$LIBVIRTD_DEFAULT_POOL_PATH" ]]; then
mkdir -p /etc/libvirt/storage/autostart
cat > /etc/libvirt/storage/default.xml <<EOX
cat > /etc/libvirt/storage/pool_1.xml <<EOX
<!-- Generated by libvirtd.sh container script -->
<pool type='dir'>
<name>default</name>
<name>pool_1</name>
<target>
<path>$LIBVIRTD_DEFAULT_POOL_PATH</path>
</target>
</pool>
EOX
ln -s /etc/libvirt/storage/default.xml /etc/libvirt/storage/autostart/default.xml
ln -s /etc/libvirt/storage/pool_1.xml /etc/libvirt/storage/autostart/pool_1.xml
fi

echo "cgroup_controllers = []" >> /etc/libvirt/qemu.conf
@@ -114,4 +128,4 @@ trap 'cleanup' SIGTERM
wait $!

#Cleanup
cleanup
cleanup

Loading…
Cancel
Save