[xenial] _get_systemd_service_status fails to parse systemd "failed" state

Bug #1536368 reported by Ricardo Bánffy
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
MAAS
Fix Released
Critical
Unassigned

Bug Description

During the MAAS startup process, due to a isc-dhcp.server bug, we got the service in a failed state (neither "active" nor "inactive").

Examining regiond's log, we got:

2016-01-20 10:35:43 [HTTPChannel,0,127.0.0.1] 500 Error - /MAAS/api/1.0/nodegroups/c1eccfbd-28e2-468c-83cb-12f92049c182/interfaces/eth1/
        Traceback (most recent call last):
          File "/usr/lib/python3/dist-packages/provisioningserver/twisted/web/wsgi.py", line 497, in run
            appIterator = self.application(self.environ, self.startResponse)
          File "/usr/lib/python3/dist-packages/django/core/handlers/wsgi.py", line 189, in __call__
            response = self.get_response(request)
          File "/usr/lib/python3/dist-packages/maasserver/utils/views.py", line 227, in get_response
            response = get_response(request)
          File "/usr/lib/python3/dist-packages/maasserver/utils/views.py", line 216, in get_response
            request, get_resolver(None), sys.exc_info())
        --- <exception caught here> ---
          File "/usr/lib/python3/dist-packages/maasserver/utils/views.py", line 201, in get_response
            return django_get_response(request)
          File "/usr/lib/python3/dist-packages/maasserver/utils/orm.py", line 325, in __exit__
            self.fire()
          File "/usr/lib/python3/dist-packages/provisioningserver/utils/twisted.py", line 197, in wrapper
            return func(*args, **kwargs)
          File "/usr/lib/python3/dist-packages/maasserver/utils/async.py", line 195, in fire
            self._fire_in_reactor(hook).wait(LONGTIME)
          File "/usr/lib/python3/dist-packages/crochet/_eventloop.py", line 231, in wait
            result.raiseException()
          File "/usr/lib/python3/dist-packages/twisted/python/failure.py", line 368, in raiseException
            raise self.value.with_traceback(self.tb)
        provisioningserver.rpc.exceptions.CannotConfigureDHCP: DHCPv4 server failed to restart: Unable to parse the active state from systemd for service 'maas-dhcpd', active state reported as 'failed'.

The code in _get_systemd_service_status does not deal correctly with a "failed" state.

root@autopkgtest:~# systemctl status maas-dhcpd
● maas-dhcpd.service - MAAS instance of ISC DHCP server for IPv4
   Loaded: loaded (/lib/systemd/system/maas-dhcpd.service; enabled; vendor preset: enabled)
   Active: failed (Result: exit-code) since Wed 2016-01-20 10:35:43 EST; 26min ago
     Docs: man:dhcpd(8)
  Process: 13387 ExecStart=/bin/sh -ec INTERFACES=$(cat /var/lib/maas/dhcpd-interfaces); LEASES_FILE=/var/lib/maas/dhcp/dhcpd.leases; [ -e $LEASES_FILE ] || touch $LEASES_FILE; chown root:root /var/lib/maas/dhcp /var/lib/maas/dhcp/dhcpd.leases*; exec dhcpd -user dhcpd -group dhcpd -f -q -4 -pf /run/maas/dhcp/dhcpd.pid -cf /var/lib/maas/dhcpd.conf -lf $LEASES_FILE $INTERFACES (code=exited, status=1/FAILURE)
  Process: 13383 ExecStartPre=/bin/chown root:root /var/lib/maas/dhcp (code=exited, status=0/SUCCESS)
  Process: 13379 ExecStartPre=/bin/mkdir -p /var/lib/maas/dhcp (code=exited, status=0/SUCCESS)
  Process: 13377 ExecStartPre=/bin/chown root:root /run/maas/dhcp (code=exited, status=0/SUCCESS)
  Process: 13375 ExecStartPre=/bin/mkdir -p /run/maas/dhcp (code=exited, status=0/SUCCESS)
 Main PID: 13387 (code=exited, status=1/FAILURE)

Jan 20 10:35:43 autopkgtest dhcpd[13387]: If you think you have received this message due to a b...her
Jan 20 10:35:43 autopkgtest dhcpd[13387]: than a configuration issue please read the section on ...ing
Jan 20 10:35:43 autopkgtest dhcpd[13387]: bugs on either our web page at www.isc.org or in the R...ile
Jan 20 10:35:43 autopkgtest dhcpd[13387]: before submitting a bug. These pages explain the proper
Jan 20 10:35:43 autopkgtest dhcpd[13387]: process and the information we find helpful for debugging..
Jan 20 10:35:43 autopkgtest dhcpd[13387]:
Jan 20 10:35:43 autopkgtest dhcpd[13387]: exiting.
Jan 20 10:35:43 autopkgtest systemd[1]: maas-dhcpd.service: Main process exited, code=exited, s...LURE
Jan 20 10:35:43 autopkgtest systemd[1]: maas-dhcpd.service: Unit entered failed state.
Jan 20 10:35:43 autopkgtest systemd[1]: maas-dhcpd.service: Failed with result 'exit-code'.
Hint: Some lines were ellipsized, use -l to show in full.

Tags: xenial

Related branches

Revision history for this message
Ricardo Bánffy (rbanffy) wrote :
Changed in maas:
milestone: none → 2.0.0
importance: High → Critical
Changed in maas:
assignee: nobody → Ricardo Bánffy (rbanffy)
Gavin Panella (allenap)
Changed in maas:
assignee: Ricardo Bánffy (rbanffy) → nobody
Changed in maas:
status: Triaged → Fix Committed
Changed in maas:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.