← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1401132] [NEW] The logic in linux dhcp-agent disable for removing ports is broken

 

Public bug reported:

https://github.com/openstack/neutron/blob/master/neutron/agent/linux/dhcp.py#L215

    def disable(self, retain_port=False):
        """Disable DHCP for this network by killing the local process."""
        pid = self.pid

        if pid:
            if self.active:
                cmd = ['kill', '-9', pid]
                utils.execute(cmd, self.root_helper)
            else:
                LOG.debug('DHCP for %(net_id)s is stale, pid %(pid)d '
                          'does not exist, performing cleanup',
                          {'net_id': self.network.id, 'pid': pid})
            if not retain_port:
                self.device_manager.destroy(self.network,
                                            self.interface_name)
        else:
            LOG.debug('No DHCP started for %s', self.network.id)

if there was no pid (for some reason the local process (dnsmasq) didn't 
start, but the port was created, the port will be left there, and no 
disable will remove the actual port.

** Affects: neutron
     Importance: Undecided
     Assignee: Miguel Angel Ajo (mangelajo)
         Status: New

** Description changed:

  https://github.com/openstack/neutron/blob/master/neutron/agent/linux/dhcp.py#L215
  
-     def disable(self, retain_port=False):
-         """Disable DHCP for this network by killing the local process."""
-         pid = self.pid
+     def disable(self, retain_port=False):
+         """Disable DHCP for this network by killing the local process."""
+         pid = self.pid
  
-         if pid:
-             if self.active:
-                 cmd = ['kill', '-9', pid]
-                 utils.execute(cmd, self.root_helper)
-             else:
-                 LOG.debug('DHCP for %(net_id)s is stale, pid %(pid)d '
-                           'does not exist, performing cleanup',
-                           {'net_id': self.network.id, 'pid': pid})
-             if not retain_port:
-                 self.device_manager.destroy(self.network,
-                                             self.interface_name)
-         else:
-             LOG.debug('No DHCP started for %s', self.network.id)
+         if pid:
+             if self.active:
+                 cmd = ['kill', '-9', pid]
+                 utils.execute(cmd, self.root_helper)
+             else:
+                 LOG.debug('DHCP for %(net_id)s is stale, pid %(pid)d '
+                           'does not exist, performing cleanup',
+                           {'net_id': self.network.id, 'pid': pid})
+             if not retain_port:
+                 self.device_manager.destroy(self.network,
+                                             self.interface_name)
+         else:
+             LOG.debug('No DHCP started for %s', self.network.id)
  
- 
- if there was no pid (for some reason the local process (dnsmasq) didn't start, but
- the port was created, the port will be left there, and no disable will remove the actual
- port.
+ if there was no pid (for some reason the local process (dnsmasq) didn't 
+ start, but the port was created, the port will be left there, and no 
+ disable will remove the actual port.

** Changed in: neutron
     Assignee: (unassigned) => Miguel Angel Ajo (mangelajo)

-- 
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to neutron.
https://bugs.launchpad.net/bugs/1401132

Title:
  The logic in linux dhcp-agent disable for removing ports is broken

Status in OpenStack Neutron (virtual network service):
  New

Bug description:
  https://github.com/openstack/neutron/blob/master/neutron/agent/linux/dhcp.py#L215

      def disable(self, retain_port=False):
          """Disable DHCP for this network by killing the local process."""
          pid = self.pid

          if pid:
              if self.active:
                  cmd = ['kill', '-9', pid]
                  utils.execute(cmd, self.root_helper)
              else:
                  LOG.debug('DHCP for %(net_id)s is stale, pid %(pid)d '
                            'does not exist, performing cleanup',
                            {'net_id': self.network.id, 'pid': pid})
              if not retain_port:
                  self.device_manager.destroy(self.network,
                                              self.interface_name)
          else:
              LOG.debug('No DHCP started for %s', self.network.id)

  if there was no pid (for some reason the local process (dnsmasq) didn't 
  start, but the port was created, the port will be left there, and no 
  disable will remove the actual port.

To manage notifications about this bug go to:
https://bugs.launchpad.net/neutron/+bug/1401132/+subscriptions


Follow ups

References