Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: MythTV: Dev

[mythtv-commits] Ticket #5210: Automatic shutdown for SBE

 

 

MythTV dev RSS feed   Index | Next | Previous | View Threaded


f-myth-users at media

Dec 4, 2008, 10:43 PM

Post #1 of 3 (673 views)
Permalink
[mythtv-commits] Ticket #5210: Automatic shutdown for SBE

> Date: Thu, 4 Dec 2008 21:45:09 -0500
> From: Chris Pinkham <cpinkham [at] bc2va>

> * On Fri Dec 05, 2008 at 12:23:57AM -0000, MythTV wrote:
> > #5210: Automatic shutdown for SBE

> > Great news.
> >
> > In my solution, the slave backend was awaken by the master backend with a
> > magic wol packet sended by a "at" job... this mecanism was done outside
> > mythtv but your work seems promising!

> My plan is to have a "WakeupCommand" setting per slave. When the master
> wants to wakeup a slave, it will run this command. I was considering making
> it a special case if the command actually was just a xx:xx:xx:xx:xx:xx
> format MAC address. In this case, the master would just use a
> SendWOL(QString MAC) method in backendutil.cpp rather than relying on the
> user to install another WOL binary.

If you do that, here's something that might save some headscratching:
if the MAC is 01:02:03:04:05:06:07:08, send a WOL package for both
that MAC -and- one in reversed byte order (08:07:06:05:04:03:02:01).

Yes, seriously. Oy.

I know for a fact that there are some motherboard combos (e.g.,
certain MSI/nVidia chipsets) and some distros (older Ubuntus at least,
and probably others) where the hardware got set up incorrectly, such
that it wouldn't come back up without the bytes reversed.

Also, some chipsets require that the packet be sent to the broadcast
address and -not- just to the IP address of the relevant machine;
presumably, they don't have enough brains in waiting-for-WOL mode to
know their own MAC and instead drop all non-broadcast packets before
they even look to see if it's a WOL. (All of the MSI/nVidia mobos I
tested required broadcast; the single MSI/VIA mobo I tried did not.)

The other issue is that slaves will have to arrange to do something
like "ethtool -s eth0 wol g" (the Ubuntu default seems to be "d",
unless that changed at some point) before shutdown, to leave the
hardware in the right state. Of course, that requires the SBE to
know which interface to use; maybe it should just enumerate all
interfaces and do that?

I know this is klugy, but it's a fairly small amount of hair, and
might eliminate a lot of "why isn't my backend waking up again?"
sort of traffic on the lists...
_______________________________________________
mythtv-dev mailing list
mythtv-dev [at] mythtv
http://mythtv.org/cgi-bin/mailman/listinfo/mythtv-dev


f-myth-users at media

Dec 4, 2008, 10:55 PM

Post #2 of 3 (627 views)
Permalink
[mythtv-commits] Ticket #5210: Automatic shutdown for SBE [In reply to]

> Date: Fri, 5 Dec 2008 01:43:24 -0500 (EST)
> From: f-myth-users [at] media

> If you do that, here's something that might save some headscratching:
> if the MAC is 01:02:03:04:05:06:07:08, send a WOL package for both
> that MAC -and- one in reversed byte order (08:07:06:05:04:03:02:01).

Err, let's just pretend that my example above was actually a 48-bit
Ethernet MAC and not the 64-bit who-knows-what that I actually typed,
shall we? :)
_______________________________________________
mythtv-dev mailing list
mythtv-dev [at] mythtv
http://mythtv.org/cgi-bin/mailman/listinfo/mythtv-dev


cpinkham at bc2va

Dec 5, 2008, 9:11 AM

Post #3 of 3 (610 views)
Permalink
Re: [mythtv-commits] Ticket #5210: Automatic shutdown for SBE [In reply to]

* On Fri Dec 05, 2008 at 01:43:24AM -0500, f-myth-users [at] media wrote:
>> format MAC address. In this case, the master would just use a
>> SendWOL(QString MAC) method in backendutil.cpp rather than relying on the
>> user to install another WOL binary.
>
> If you do that, here's something that might save some headscratching:
> if the MAC is 01:02:03:04:05:06:07:08, send a WOL package for both
> that MAC -and- one in reversed byte order (08:07:06:05:04:03:02:01).

Thanks, I put this in my TODO.

> Also, some chipsets require that the packet be sent to the broadcast
> address and -not- just to the IP address of the relevant machine;

The 'wakelan' program I'm currently using sends to the broadcast, all I
specify on the command line is the MAC address. I was planning on
implementing the same functionality where only the MAC was required.

> The other issue is that slaves will have to arrange to do something
> like "ethtool -s eth0 wol g" (the Ubuntu default seems to be "d",

Since WOL is just one of the many ways that a server could be resumed,
I was leaving that up to the user in their 'SleepCommand' script which
gets run on the slave.

WakeUpCommand = run on master to wakeup a sleeping slave. This command
could do anything, from sending a WOL packet to toggling a bit on a
serial port to flip a relay to sending an X10 command to turn on a
remote receptacle.

SleepCommand = run on slave to put itself to 'sleep'. This could be
anything from a regular shutown, a 'poweroff -f' like I do on my nfsroot
servers, or sending an X10 command to turn a receptacle off.

The user is the one implementing these commands, so I was leaving the
details up to them. The only reason for putting a small utility
function in for sending a WOL packet is to save the user from having to
install another binary and we can utilize the WOL code in other places
in Myth as well.

> I know this is klugy, but it's a fairly small amount of hair, and
> might eliminate a lot of "why isn't my backend waking up again?"
> sort of traffic on the lists...

Easy enough for them to test. Run the SleepCommand on the slave and
see if it shuts down (or whatever it's supposed to do). Then run the
WakeUpCommand on the master and see it if brings the slave back to life
and reconnects to the master backend.

I tested my patch some last night and it is working as intended. The
master is commanding an inactive slave to shutdown and waking it up
again when necessary. I need to add in a bit more code to do things
like attempting to wake up all slaves when the master first starts so
that the master can get a proper indication as to what slaves are
available so scheduling can be done properly. I also need to detect
a little better when a slave is in use for instance if it is being
used to stream a recording or run jobs in the JobQueue. When a slave
is asleep, it's as if it was never connected to the master except
for purposes of scheduling future recordings. The master will not
try to wakeup the slave for anything but a scheduled recording. This
means LiveTV can't use those tuners unless the slave is already awake.
The main idea is to allow slaves without local storage to be shutdown
when idle. I have diskless frontends and diskless backends as well,
even my master uses nfsroot. There's no need to keep a slave up 24x7
when if it's tuners are only used a few hours a day (or week in the
case of some of my tuners).

--
Chris
_______________________________________________
mythtv-dev mailing list
mythtv-dev [at] mythtv
http://mythtv.org/cgi-bin/mailman/listinfo/mythtv-dev

MythTV dev RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.