[mythtv-commits] mythtv commit: r20084 - in trunk/mythtv by cpinkham

mythtv at cvs.mythtv.org mythtv at cvs.mythtv.org
Mon Mar 2 05:56:48 UTC 2009


      Author: cpinkham
        Date: 2009-03-02 05:56:48 +0000 (Mon, 02 Mar 2009)
New Revision: 20084
   Changeset: http://cvs.mythtv.org/trac/changeset/20084

Modified:

   trunk/mythtv/libs/libmythtv/tv.h
   trunk/mythtv/programs/mythbackend/encoderlink.cpp
   trunk/mythtv/programs/mythbackend/encoderlink.h
   trunk/mythtv/programs/mythbackend/httpstatus.cpp
   trunk/mythtv/programs/mythbackend/main.cpp
   trunk/mythtv/programs/mythbackend/mainserver.cpp
   trunk/mythtv/programs/mythbackend/mainserver.h
   trunk/mythtv/programs/mythbackend/playbacksock.cpp
   trunk/mythtv/programs/mythbackend/playbacksock.h
   trunk/mythtv/programs/mythbackend/scheduler.cpp
   trunk/mythtv/programs/mythbackend/scheduler.h
   trunk/mythtv/programs/mythfrontend/statusbox.cpp
   trunk/mythtv/programs/mythtv-setup/backendsettings.cpp

Log:

Allow slave backends to be shut down and awakened on demand by the master
backend.  To use this functionality, a slave must have a SleepCommand and
WakeUpCommand configured via mythtv-setup.

If a slave has a SleepCommand and WakeUpCommand configured, and is going to
be inactive for 45 minutes, the master backend will command the slave to
run its SleepCommand to go to sleep.  The Scheduler on the master considers
a sleeping slave the same as a slave that is awake and connected for
scheduling purposes.  Recordings will be scheduled on sleeping slaves and
they will be awakened at 240 seconds prior to a scheduled recording.  This
should give the slave long enough to come up and stabilize before the
recording needs to begin.  The master runs the WakeUpCommand for a slave to
wake that slave up.  Slaves run their own SleepCommand to go to sleep.
To adjust the 45-minute inactive threshold and the 240 second wakeup
threshold, you can set the 'undocumented' SleepThreshold and WakeUpThreshold
commands respectively in the database.  Both values are stored in seconds
in the database.

The master backend will check at least every 5 minutes to see if there are
any slaves that can be shutdown.  It also checks every time the scheduler
runs.  The reason for the 5-minute check is so that slaves which were busy
doing something other than recording when the scheduler was run can be
shutdown later when they are not busy.

If the WakeUpCommand command for a slave is set to a MAC address, the slave
will be sent a WOL packet.  If the WakeUpCommand does not look like a MAC
address, it will be run as a regular system command using myth_system().

The mythfrontend tuner status page and the mythbackend status webpage
have been updated to indicate which disconnected slaves are asleep and
which are truly disconnected and can't be awakened.

WARNING: This supercedes the old WOLslaveBackendsCommand which was a Global
         setting.  When the master backend is started, it will wakeup any
         slave which has a WakeUpCommand configured.

NOTE: This patch adds a GET_SLEEPSTATUS subcommand to the QUERY_REMOTEENCODER
      main backend command.  I have not bumped up the protocol version for
      this because it is only necessary on the master itself and the slaves
      which are using the on-demand functionality.

NOTE2: This patch does not handle LiveTV in any way.  If a slave is asleep,
       its tuners will be unavailable for LiveTV.  The only consideration
       for sleeping slaves is that the master scheduler knows they are asleep
       and can be awakened to record.

NOTE3: Since I've been running this patch on my production systems for the
       past 17 days, my slave with some lesser-used ATSC tuners in it has
       only been turned on for 22 hours (5%) and was put to sleep the rest
       of the time (95%)






More information about the mythtv-commits mailing list