Bug #4797

If a hook exits nonzero, doesn't get logs in oned.log

Added by John Noss almost 5 years ago. Updated almost 5 years ago.

Status:ClosedStart date:09/19/2016
Priority:NormalDue date:
Assignee:Ruben S. Montero% Done:

0%

Category:Core & System
Target version:Release 5.2
Resolution:worksforme Pull request:
Affected Versions:OpenNebula 5.0

Description

If a hook exits nonzero, the output from it does not show up in oned.log; only logs that print are:

Message received: LOG I <integer failure count> Command execution fail: <resulting hook command>
Message received: EXECUTE FAILURE <integer failure count> <hook name>

Expected output would be any stdout/stderr printed from the hook script up to the point that it exited. (Tested and this does work as expected as long as the hook script exits 0 - stdout does show up in oned.log in that case.)

History

#1 Updated by Ruben S. Montero almost 5 years ago

  • Status changed from Pending to New
  • Target version set to Release 5.2

#2 Updated by Ruben S. Montero almost 5 years ago

  • Category set to Core & System
  • Assignee set to Ruben S. Montero

#3 Updated by Ruben S. Montero almost 5 years ago

I've tested this with the last code base for one-5.0 branch with this

  • Created a hook for VM "on create"
     VM_HOOK = [
       name      = "stderr_hook",
       on        = "CREATE",
       remote    = NO,
       command   = "/tmp/test.sh" 
     ]
    
  • The hook outputs several things from stderr and exits non-zero:
    #!/bin/bash
    
    echo "This is an error message from driver" 1>&2
    
    rm /var
    
    exit 1
    
  • I'm getting the full stderr stream:
Wed Sep 21 18:55:11 2016 [Z0][HKM][D]: Message received: LOG I 1 Command execution fail: /tmp/test.sh -

Wed Sep 21 18:55:11 2016 [Z0][HKM][D]: Message received: LOG I 1 This is an error message from driver

Wed Sep 21 18:55:11 2016 [Z0][HKM][D]: Message received: LOG I 1 rm: cannot remove '/var': Is a directory

Wed Sep 21 18:55:11 2016 [Z0][HKM][D]: Message received: LOG I 1 ExitCode: 1

Wed Sep 21 18:55:11 2016 [Z0][HKM][D]: Message received: EXECUTE FAILURE 1 stderr_hook: -

It seems it is working as expected.

#4 Updated by Ruben S. Montero almost 5 years ago

  • Status changed from New to Closed
  • Resolution set to worksforme

Also available in: Atom PDF