linux-raid.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* polling mdX/md/degraded in sysfs
@ 2012-01-05  8:34 Mikhail Balabin
  2012-01-08  9:06 ` Alexander Lyakas
  0 siblings, 1 reply; 7+ messages in thread
From: Mikhail Balabin @ 2012-01-05  8:34 UTC (permalink / raw)
  To: linux-raid

Hi!

I'm playing around with monitoring software raid status via sysfs
entries. In my case it's a raid1 array. According to
Documentation/md.txt any md device with redundancy should contain file
"degraded" (for example, /sys/block/md0/md/degraded) with the number
of devices by which the arrays is degraded. It is stated that this
file can be polled to monitor changes in the array, but it does not
work for me. Here is my (stripped-down) python code:

import select
fileName = "/sys/block/md0/md/degraded"
epoll = select.epoll()
while(True):
  file = open(fileName)
  status = file.read()
  print(status)

  epoll.register(file.fileno(), select.EPOLLPRI|select.EPOLLERR)
  epoll.poll()
  print("==== poll ====")
  epoll.unregister(file.fileno())
  file.close()

The script works fine for /proc/mdstat or /proc/mounts, but does not
show any events for /sys/block/md0/md/degraded. Is there a problem in
my code? Or is the documentation inaccurate?

Mikhail Balabin

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2012-01-10 15:19 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-01-05  8:34 polling mdX/md/degraded in sysfs Mikhail Balabin
2012-01-08  9:06 ` Alexander Lyakas
2012-01-08 11:37   ` Mikhail Balabin
2012-01-08 17:19     ` Alexander Lyakas
2012-01-09  0:44   ` NeilBrown
2012-01-09 10:35     ` Mikhail Balabin
2012-01-10 15:19       ` Mikhail Balabin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).