From: Mikhail Balabin <mbalabin@gmail.com>
To: linux-raid@vger.kernel.org
Subject: polling mdX/md/degraded in sysfs
Date: Thu, 5 Jan 2012 14:34:37 +0600 [thread overview]
Message-ID: <CAC9iW=taiG0=JOXcrEDOWKoHswEAp1uRTP2UP=4MepBXNf2Lrg@mail.gmail.com> (raw)
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
next reply other threads:[~2012-01-05 8:34 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-01-05 8:34 Mikhail Balabin [this message]
2012-01-08 9:06 ` polling mdX/md/degraded in sysfs 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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CAC9iW=taiG0=JOXcrEDOWKoHswEAp1uRTP2UP=4MepBXNf2Lrg@mail.gmail.com' \
--to=mbalabin@gmail.com \
--cc=linux-raid@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.