[Bug 1560762] [NEW] iSCSI root with multiple NICs fails ifdown -a

Malcolm Weir malc at gelt.org
Wed Mar 23 02:10:18 UTC 2016


Public bug reported:

Ubuntu 14.04.4 LTS
ifupdown version  0.7.47.2ubuntu4.4

In /etc/init/networking.conf, there is a test for an iSCSI filesystem
mounted by the initramfs, which tests to see if the file
/etc/iscsi/iscsi.initramfs exists. If that file exists, the script exits
immediately, which means that the event "deconfiguring-networking" never
occurs.

The correct behavior would seem to be to detect which interface is being
used for the iSCSI mount, and exclude just that interface from the
"ifdown" command just after the event emission.

I.e. if the iSCSI volume is using eth2, then the ifdown command should
be called as "ifdown -a --exclude=lo0 --exclude=eth2"

Appropriate code might be:

<BEGIN /etc/init/networking.conf>
# networking - configure virtual network devices
#
# This task causes virtual network devices that do not have an associated
# kernel object to be started on boot.

description     "configure virtual network devices"

emits static-network-up
emits net-device-up
emits deconfiguring-networking

start on (local-filesystems
    and (stopped udevtrigger or container)) or runlevel [2345] or stopped networking RESULT=failed PROCESS=post-stop EXIT_STATUS=100
stop on unmounted-remote-filesystems

pre-start script
    if [ "$UPSTART_EVENTS" = "stopped" ] && [ "$UPSTART_JOB" = "networking" ] && [ "$EXIT_STATUS" = "100" ]; then
        exit 0
    fi

    mkdir -p /run/network
    ifup -a
end script

post-stop script
    if [ -z "$UPSTART_STOP_EVENTS" ]; then
        echo "Stopping or restarting the networking job is not supported."
        echo "Use ifdown & ifup to reconfigure desired interface."
        exit 100
    fi

    log_warning_msg() {
        echo $*
    }

    # These checks were taken from the Debian ifupdown.networking.init script
    check_network_file_systems() {
        [ -e /proc/mounts ] || return 0

        if [ -e /etc/iscsi/iscsi.initramfs ]; then
            if [ -e /dev/.initramfs/open-iscsi.interface ]
            then
                EXCL_NIC=`cat /dev/.initramfs/open-iscsi.interface`
                log_warning_msg "not deconfiguring specific network interface ${EXCL_NIC}: iSCSI root is mounted."
                EXCLUDE=" --exclude=${EXCL_NIC}"
            else
                log_warning_msg "not deconfiguring network interfaces: iSCSI root is mounted."
            fi
            exit 0
        fi

        while read DEV MTPT FSTYPE REST; do
            case $DEV in
            /dev/nbd*|/dev/nd[a-z]*|/dev/etherd/e*)
                log_warning_msg "not deconfiguring network interfaces: network devices still mounted."
                exit 0
                ;;
            esac
            case $FSTYPE in
            nfs|nfs4|smbfs|ncp|ncpfs|cifs|coda|ocfs2|gfs|pvfs|pvfs2|fuse.httpfs|fuse.curlftpfs)
                log_warning_msg "not deconfiguring network interfaces: network file systems still mounted."
                exit 0
                ;;
            esac
        done < /proc/mounts
    }

    check_network_swap() {
        [ -e /proc/swaps ] || return 0

        while read DEV MTPT FSTYPE REST; do
            case $DEV in
            /dev/nbd*|/dev/nd[a-z]*|/dev/etherd/e*)
                log_warning_msg "not deconfiguring network interfaces: network swap still mounted."
                exit 0
                ;;
            esac
        done < /proc/swaps
    }
<END>
    check_network_file_systems
    check_network_swap

    # Anything that manages network interfaces *MUST* wait for this event
    initctl emit deconfiguring-networking
    ifdown -a --exclude=lo ${EXCLUDE}
end script

** Affects: ifupdown (Ubuntu)
     Importance: Undecided
         Status: New

-- 
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to ifupdown in Ubuntu.
https://bugs.launchpad.net/bugs/1560762

Title:
  iSCSI root with multiple NICs fails ifdown -a

Status in ifupdown package in Ubuntu:
  New

Bug description:
  Ubuntu 14.04.4 LTS
  ifupdown version  0.7.47.2ubuntu4.4

  In /etc/init/networking.conf, there is a test for an iSCSI filesystem
  mounted by the initramfs, which tests to see if the file
  /etc/iscsi/iscsi.initramfs exists. If that file exists, the script
  exits immediately, which means that the event "deconfiguring-
  networking" never occurs.

  The correct behavior would seem to be to detect which interface is
  being used for the iSCSI mount, and exclude just that interface from
  the "ifdown" command just after the event emission.

  I.e. if the iSCSI volume is using eth2, then the ifdown command should
  be called as "ifdown -a --exclude=lo0 --exclude=eth2"

  Appropriate code might be:

  <BEGIN /etc/init/networking.conf>
  # networking - configure virtual network devices
  #
  # This task causes virtual network devices that do not have an associated
  # kernel object to be started on boot.

  description     "configure virtual network devices"

  emits static-network-up
  emits net-device-up
  emits deconfiguring-networking

  start on (local-filesystems
      and (stopped udevtrigger or container)) or runlevel [2345] or stopped networking RESULT=failed PROCESS=post-stop EXIT_STATUS=100
  stop on unmounted-remote-filesystems

  pre-start script
      if [ "$UPSTART_EVENTS" = "stopped" ] && [ "$UPSTART_JOB" = "networking" ] && [ "$EXIT_STATUS" = "100" ]; then
          exit 0
      fi

      mkdir -p /run/network
      ifup -a
  end script

  post-stop script
      if [ -z "$UPSTART_STOP_EVENTS" ]; then
          echo "Stopping or restarting the networking job is not supported."
          echo "Use ifdown & ifup to reconfigure desired interface."
          exit 100
      fi

      log_warning_msg() {
          echo $*
      }

      # These checks were taken from the Debian ifupdown.networking.init script
      check_network_file_systems() {
          [ -e /proc/mounts ] || return 0

          if [ -e /etc/iscsi/iscsi.initramfs ]; then
              if [ -e /dev/.initramfs/open-iscsi.interface ]
              then
                  EXCL_NIC=`cat /dev/.initramfs/open-iscsi.interface`
                  log_warning_msg "not deconfiguring specific network interface ${EXCL_NIC}: iSCSI root is mounted."
                  EXCLUDE=" --exclude=${EXCL_NIC}"
              else
                  log_warning_msg "not deconfiguring network interfaces: iSCSI root is mounted."
              fi
              exit 0
          fi

          while read DEV MTPT FSTYPE REST; do
              case $DEV in
              /dev/nbd*|/dev/nd[a-z]*|/dev/etherd/e*)
                  log_warning_msg "not deconfiguring network interfaces: network devices still mounted."
                  exit 0
                  ;;
              esac
              case $FSTYPE in
              nfs|nfs4|smbfs|ncp|ncpfs|cifs|coda|ocfs2|gfs|pvfs|pvfs2|fuse.httpfs|fuse.curlftpfs)
                  log_warning_msg "not deconfiguring network interfaces: network file systems still mounted."
                  exit 0
                  ;;
              esac
          done < /proc/mounts
      }

      check_network_swap() {
          [ -e /proc/swaps ] || return 0

          while read DEV MTPT FSTYPE REST; do
              case $DEV in
              /dev/nbd*|/dev/nd[a-z]*|/dev/etherd/e*)
                  log_warning_msg "not deconfiguring network interfaces: network swap still mounted."
                  exit 0
                  ;;
              esac
          done < /proc/swaps
      }
  <END>
      check_network_file_systems
      check_network_swap

      # Anything that manages network interfaces *MUST* wait for this event
      initctl emit deconfiguring-networking
      ifdown -a --exclude=lo ${EXCLUDE}
  end script

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/ifupdown/+bug/1560762/+subscriptions



More information about the foundations-bugs mailing list