• Leigh B. Stoller's avatar
    A set of debugging changes to allow running multiple stateds. This is · cf61f6f3
    Leigh B. Stoller authored
    probably imperfect, but better then nothing. New option, "-t tag"
    allows you to specify an arbitrary tag to match against the stated_tag
    of the nodes table. The stated invocation will only operate on nodes
    that match the tag, ignoring all events for other nodes. If
    unspecified, stated will operate on all nodes with a NULL tag. This is
    setup up at the beginning of time (or during a reload) saving the
    per-node tag in the $nodes hash. Each time an event arrives, check the
    tag in the table, ignoring the event if not a match.
    
    On signaled reload() must also be careful to throw away timeouts from
    the queue (and be careful not to set up new timeouts for ignored
    nodes).  So, this allows you to set the tag for a node in the DB, and
    then HUP stated so that it reloads it tables. That node will now be
    ignored by that stated.
    
    Also made some changes to debug mode. In debug mode, don't worry about
    the pidfile or the lockfile or checking for other running stated
    (which causes my debug version to exit! right away). Also, added a new
    -l option to turn of syslog output and just send it all to stdout with
    the debug output. -l can be only be used with -d of course.
    
    So what can I do with all this:
    
    	update nodes set stated_tag='lbs' where node_id='pc5';
    	sudo kill -HUP `cat /var/run/stated.pid`
    	sudo stated -d -l -t lbs
    
    Which tells the main stated to ignore pc5. Then I run a debugging
    stated that operates only on pc5. Later when done:
    
    	update nodes set stated_tag=NULL where node_id='pc5';
    	sudo kill -HUP `cat /var/run/stated.pid`
    
    Which tells the main stated to operate on pc5 again.
    cf61f6f3
stated.in 41.4 KB