Enable file logging for podman neutron sidecars
In order to get a more complete container logging, we now enable the file logging for the podman containers. This will output container stdout/stderr in a file located in the new /var/log/containers/stdouts location. This follows the other efforts already made with paunch[1] and docker-puppet.py (now named container-puppet.py)[2] Notes: - podman supports only "json-file", allowing to push files in the location we want via the "path" log option - docker doesn't have the "path" log option and push its log in /var/lib/docker/containers/ID/ID-json.log - unusable since it's destroyed upon container removal. [1] https://review.openstack.org/635437 [2] https://review.openstack.org/635438 Change-Id: Ibaa8bca52ea2f68afa1effc989b04d2e6213813a
This commit is contained in:
parent
e10400a022
commit
be1c9e1f85
@ -24,9 +24,11 @@ NETNS=$(ip netns identify)
|
||||
NAME=neutron-dibbler-${NETNS}
|
||||
<%- if $container_cli == 'docker' { -%>
|
||||
CLI='docker'
|
||||
LOGGING=''
|
||||
CMD="ip netns exec ${NETNS} /usr/sbin/dibbler-client run"
|
||||
<%- } elsif $container_cli == 'podman' { -%>
|
||||
CLI="nsenter --net=/run/netns/${NETNS} --preserve-credentials -m -t 1 podman"
|
||||
LOGGING="--log-driver json-file --log-opt path=/var/log/containers/stdouts/${NAME}.log"
|
||||
CMD='/usr/sbin/dibbler-client run'
|
||||
<%- } else { -%>
|
||||
CLI='echo noop'
|
||||
@ -47,7 +49,7 @@ fi
|
||||
# If the NAME is already taken by a container, give it an unique name
|
||||
printf "%s\n" "${LIST}" | grep -q "${NAME}$" && NAME="${NAME}-$(date +%Y-%m-%d-%H%M%S-%N)"
|
||||
echo "Starting a new child container ${NAME}"
|
||||
$CLI run --detach \
|
||||
$CLI run --detach ${LOGGING} \
|
||||
-v /var/lib/config-data/puppet-generated/neutron/etc/neutron:/etc/neutron:ro \
|
||||
-v /run/netns:/run/netns:shared \
|
||||
-v /var/lib/neutron:/var/lib/neutron:z,shared \
|
||||
|
@ -21,9 +21,11 @@ NETNS=$(ip netns identify)
|
||||
NAME=neutron-dnsmasq-${NETNS}
|
||||
<%- if $container_cli == 'docker' { -%>
|
||||
CLI='docker'
|
||||
LOGGING=''
|
||||
CMD="ip netns exec ${NETNS} /usr/sbin/dnsmasq -k"
|
||||
<%- } elsif $container_cli == 'podman' { -%>
|
||||
CLI="nsenter --net=/run/netns/${NETNS} --preserve-credentials -m -t 1 podman"
|
||||
LOGGING="--log-driver json-file --log-opt path=/var/log/containers/stdouts/${NAME}.log"
|
||||
CMD='/usr/sbin/dnsmasq -k'
|
||||
<%- } else { -%>
|
||||
CLI='echo noop'
|
||||
@ -45,7 +47,7 @@ fi
|
||||
# If the NAME is already taken by a container, give it an unique name
|
||||
printf "%s\n" "${LIST}" | grep -q "${NAME}$" && NAME="${NAME}-$(date +%Y-%m-%d-%H%M%S-%N)"
|
||||
echo "Starting a new child container ${NAME}"
|
||||
$CLI run --detach \
|
||||
$CLI run --detach ${LOGGING} \
|
||||
-v /var/lib/config-data/puppet-generated/neutron/etc/neutron:/etc/neutron:ro \
|
||||
-v /run/netns:/run/netns:shared \
|
||||
-v /var/lib/neutron:/var/lib/neutron:z,shared \
|
||||
|
@ -22,9 +22,11 @@ NAME=neutron-haproxy-${NETNS}
|
||||
HAPROXY_CMD='$(if [ -f /usr/sbin/haproxy-systemd-wrapper ]; then echo "/usr/sbin/haproxy -Ds"; else echo "/usr/sbin/haproxy -Ws"; fi)'
|
||||
<%- if $container_cli == 'docker' { -%>
|
||||
CLI='docker'
|
||||
LOGGING=''
|
||||
CMD="ip netns exec ${NETNS} "'$HAPROXY'
|
||||
<%- } elsif $container_cli == 'podman' { -%>
|
||||
CLI="nsenter --net=/run/netns/${NETNS} --preserve-credentials -m -t 1 podman"
|
||||
LOGGING="--log-driver json-file --log-opt path=/var/log/containers/stdouts/${NAME}.log"
|
||||
CMD='$HAPROXY'
|
||||
<%- } else { -%>
|
||||
CLI='echo noop'
|
||||
@ -45,7 +47,7 @@ fi
|
||||
# If the NAME is already taken by a container, give it an unique name
|
||||
printf "%s\n" "${LIST}" | grep -q "${NAME}$" && NAME="${NAME}-$(date +%Y-%m-%d-%H%M%S-%N)"
|
||||
echo "Starting a new child container ${NAME}"
|
||||
$CLI run --detach \
|
||||
$CLI run --detach ${LOGGING} \
|
||||
-v /var/lib/config-data/puppet-generated/neutron/etc/neutron:/etc/neutron:ro \
|
||||
-v /run/netns:/run/netns:shared \
|
||||
-v /var/lib/neutron:/var/lib/neutron:z,shared \
|
||||
|
@ -21,9 +21,11 @@ NETNS=$(ip netns identify)
|
||||
NAME=neutron-keepalived-${NETNS}
|
||||
<%- if $container_cli == 'docker' { -%>
|
||||
CLI='docker'
|
||||
LOGGING=''
|
||||
CMD="ip netns exec ${NETNS} /usr/sbin/keepalived -n -l -D"
|
||||
<%- } elsif $container_cli == 'podman' { -%>
|
||||
CLI="nsenter --net=/run/netns/${NETNS} --preserve-credentials -m -t 1 podman"
|
||||
LOGGING="--log-driver json-file --log-opt path=/var/log/containers/stdouts/${NAME}.log"
|
||||
CMD='/usr/sbin/keepalived -n -l -D'
|
||||
<%- } else { -%>
|
||||
CLI='echo noop'
|
||||
@ -44,7 +46,7 @@ fi
|
||||
# If the NAME is already taken by a container, give it an unique name
|
||||
printf "%s\n" "${LIST}" | grep -q "${NAME}$" && NAME="${NAME}-$(date +%Y-%m-%d-%H%M%S-%N)"
|
||||
echo "Starting a new child container ${NAME}"
|
||||
$CLI run --detach \
|
||||
$CLI run --detach ${LOGGING} \
|
||||
-v /var/lib/config-data/puppet-generated/neutron/etc/neutron:/etc/neutron:ro \
|
||||
-v /lib/modules:/lib/modules:ro \
|
||||
-v /sbin/modprobe:/sbin/modprobe:ro \
|
||||
|
@ -21,9 +21,11 @@ NETWORK_ID=$(echo $ARGS| awk '{if (match($0, /(\w{8}-\w{4}-\w{4}-\w{4}-\w{12})/,
|
||||
NAME=neutron-radvd-${NETWORK_ID}
|
||||
<%- if $container_cli == 'docker' { -%>
|
||||
CLI='docker'
|
||||
LOGGING=''
|
||||
CMD="ip netns exec qrouter-${NETWORK_ID} /usr/sbin/radvd -n"
|
||||
<%- } elsif $container_cli == 'podman' { -%>
|
||||
CLI="nsenter --net=/run/netns/${NETNS} --preserve-credentials -m -t 1 podman"
|
||||
LOGGING="--log-driver json-file --log-opt path=/var/log/containers/stdouts/${NAME}.log"
|
||||
CMD='/usr/sbin/radvd -n'
|
||||
<%- } else { -%>
|
||||
CLI='echo noop'
|
||||
@ -44,7 +46,7 @@ fi
|
||||
# If the NAME is already taken by a container, give it an unique name
|
||||
printf "%s\n" "${LIST}" | grep -q "${NAME}$" && NAME="${NAME}-$(date +%Y-%m-%d-%H%M%S-%N)"
|
||||
echo "Starting a new child container ${NAME}"
|
||||
$CLI run --detach \
|
||||
$CLI run --detach ${LOGGING} \
|
||||
-v /var/lib/config-data/puppet-generated/neutron/etc/neutron:/etc/neutron:ro \
|
||||
-v /run/netns:/run/netns:shared \
|
||||
-v /var/lib/neutron:/var/lib/neutron:z,shared \
|
||||
|
Loading…
x
Reference in New Issue
Block a user