new libvirt version with logging
This commit is contained in:
parent
6e6f8cb647
commit
ebd073a56c
@ -11,8 +11,10 @@ RUN yum install -y \
|
|||||||
libvirt-client \
|
libvirt-client \
|
||||||
selinux-policy selinux-policy-targeted \
|
selinux-policy selinux-policy-targeted \
|
||||||
wget \
|
wget \
|
||||||
augeas
|
augeas \
|
||||||
|
procps
|
||||||
|
|
||||||
|
ENV LOG_LEVEL 3
|
||||||
COPY augconf /augconf
|
COPY augconf /augconf
|
||||||
COPY libvirtd.sh /libvirtd.sh
|
COPY libvirtd.sh /libvirtd.sh
|
||||||
|
|
||||||
|
@ -14,6 +14,11 @@ services:
|
|||||||
environment:
|
environment:
|
||||||
LIBVIRTD_DEFAULT_NETWORK: "true"
|
LIBVIRTD_DEFAULT_NETWORK: "true"
|
||||||
LIBVIRTD_DEFAULT_POOL_PATH: "/var/lib/libvirt/pool/default"
|
LIBVIRTD_DEFAULT_POOL_PATH: "/var/lib/libvirt/pool/default"
|
||||||
|
# 1: DEBUG
|
||||||
|
# 2: INFO
|
||||||
|
# 3: WARNING
|
||||||
|
# 4: ERROR
|
||||||
|
LOG_LEVEL: 1
|
||||||
volumes:
|
volumes:
|
||||||
- /var/run/dbus/system_bus_socket:/var/run/dbus/system_bus_socket
|
- /var/run/dbus/system_bus_socket:/var/run/dbus/system_bus_socket
|
||||||
- libvirt-pool:/var/lib/libvirt/pool
|
- libvirt-pool:/var/lib/libvirt/pool
|
||||||
|
20
libvirtd.sh
20
libvirtd.sh
@ -50,6 +50,20 @@ mkdir -p /var/log/libvirt
|
|||||||
touch /var/log/libvirt/qemu.log
|
touch /var/log/libvirt/qemu.log
|
||||||
chown qemu:qemu /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
|
# We create the network on a file basis to not
|
||||||
# have to wait for libvirtd to come up
|
# have to wait for libvirtd to come up
|
||||||
if [[ -n "$LIBVIRTD_DEFAULT_NETWORK" ]]; then
|
if [[ -n "$LIBVIRTD_DEFAULT_NETWORK" ]]; then
|
||||||
@ -75,16 +89,16 @@ fi
|
|||||||
# have to wait for libvirtd to come up
|
# have to wait for libvirtd to come up
|
||||||
if [[ -n "$LIBVIRTD_DEFAULT_POOL_PATH" ]]; then
|
if [[ -n "$LIBVIRTD_DEFAULT_POOL_PATH" ]]; then
|
||||||
mkdir -p /etc/libvirt/storage/autostart
|
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 -->
|
<!-- Generated by libvirtd.sh container script -->
|
||||||
<pool type='dir'>
|
<pool type='dir'>
|
||||||
<name>default</name>
|
<name>pool_1</name>
|
||||||
<target>
|
<target>
|
||||||
<path>$LIBVIRTD_DEFAULT_POOL_PATH</path>
|
<path>$LIBVIRTD_DEFAULT_POOL_PATH</path>
|
||||||
</target>
|
</target>
|
||||||
</pool>
|
</pool>
|
||||||
EOX
|
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
|
fi
|
||||||
|
|
||||||
echo "cgroup_controllers = []" >> /etc/libvirt/qemu.conf
|
echo "cgroup_controllers = []" >> /etc/libvirt/qemu.conf
|
||||||
|
Loading…
Reference in New Issue
Block a user