"Fossies" - the Fresh Open Source Software Archive

Member "zun-4.0.0/contrib/nova-docker/devstack/lib/nova" (16 Oct 2019, 1968 Bytes) of package /linux/misc/openstack/zun-4.0.0.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Bash source code syntax highlighting (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file.

    1 #!/bin/bash
    2 #
    3 # lib/nova
    4 # Configure the docker hypervisor
    5 
    6 # Dependencies:
    7 #
    8 # - ``functions`` file
    9 # - ``DEST``, ``NOVA_CONF``, ``STACK_USER`` must be defined
   10 
   11 # ``stack.sh`` calls the entry points in this order:
   12 #
   13 # - configure_nova_docker
   14 
   15 # Save trace setting
   16 _XTRACE_ZUN_NOVA=$(set +o | grep xtrace)
   17 set +o xtrace
   18 
   19 # Defaults
   20 # --------
   21 NOVA_CONF_DIR=${NOVA_CONF_DIR:-/etc/nova}
   22 NOVA_CONF=${NOVA_CONF:-NOVA_CONF_DIR/nova.conf}
   23 
   24 
   25 # Entry Points
   26 # ------------
   27 
   28 # configure_nova_docker - Set config files, create data dirs, etc
   29 function configure_nova_docker {
   30     iniset $NOVA_CONF DEFAULT compute_driver zun.DockerDriver
   31 
   32     # CentOS/RedHat distros don't start the services just after the package
   33     # is installed if it is not explicitily set. So the script fails on
   34     # them in this killall because there is nothing to kill.
   35     sudo killall docker || true
   36 
   37     # Enable debug level logging
   38     if [ -f "/etc/default/docker" ]; then
   39         sudo cat /etc/default/docker
   40         sudo sed -i 's/^.*DOCKER_OPTS=.*$/DOCKER_OPTS=\"--debug --storage-opt dm.override_udev_sync_check=true\"/' /etc/default/docker
   41         sudo cat /etc/default/docker
   42     fi
   43     if [ -f "/etc/sysconfig/docker" ]; then
   44         sudo cat /etc/sysconfig/docker
   45         sudo sed -i 's/^.*OPTIONS=.*$/OPTIONS=--debug --selinux-enabled/' /etc/sysconfig/docker
   46         sudo cat /etc/sysconfig/docker
   47     fi
   48     if [ -f "/usr/lib/systemd/system/docker.service" ]; then
   49         sudo cat /usr/lib/systemd/system/docker.service
   50         sudo sed -i 's/docker daemon/docker daemon --debug/' /usr/lib/systemd/system/docker.service
   51         sudo cat /usr/lib/systemd/system/docker.service
   52         sudo systemctl daemon-reload
   53     fi
   54 
   55     sudo service docker start || true
   56 
   57     # setup rootwrap filters
   58     local rootwrap_conf_src_dir="$DEST/zun/etc/nova"
   59     sudo install -o root -g root -m 644 $rootwrap_conf_src_dir/rootwrap.d/*.filters /etc/nova/rootwrap.d
   60 }
   61 
   62 # Restore xtrace
   63 $_XTRACE_ZUN_NOVA