[virt-tools-list] [osinfo PATCH] Rework udev rule some more

Christophe Fergeau cfergeau at redhat.com
Fri Jan 27 17:04:40 UTC 2012


Now that the rules to remove device properties when the CD is ejected
have been fixed, another bug in these rules shows up: there are 2 rules
very similar to the rules for disk insertion. One of them matches
ID_FS_TYPE != "iso9660" and the other matches ID_FS_TYPE != "udf" which
means that at least one of them will trigger and will remove the
OSINFO_* properties that have been just set by the insertion rules.

While attempting to fix them, I've noticed that these properties go
away anyway when the disk is removed (??), so we can get rid of them.
While at it, I've added a test to check that the 'change' events correspond
to a media change.
---
 data/95-osinfo.rules.in |   20 ++------------------
 1 files changed, 2 insertions(+), 18 deletions(-)

diff --git a/data/95-osinfo.rules.in b/data/95-osinfo.rules.in
index 33e5986..ec42b74 100644
--- a/data/95-osinfo.rules.in
+++ b/data/95-osinfo.rules.in
@@ -15,27 +15,11 @@ ACTION=="add|remove", \
 ACTION=="change", \
  SUBSYSTEM=="block", \
  ENV{ID_FS_TYPE}=="iso9660", \
+ ENV{DISK_MEDIA_CHANGE}==1, \
  IMPORT{program}="@bindir@/osinfo-detect -f env $tempnode"
 
 ACTION=="change", \
  SUBSYSTEM=="block", \
  ENV{ID_FS_TYPE}=="udf", \
+ ENV{DISK_MEDIA_CHANGE}==1, \
  IMPORT{program}="@bindir@/osinfo-detect -f env $tempnode"
-
-# Disk ejected
-ACTION=="change", \
- SUBSYSTEM=="block", \
- ENV{ID_FS_TYPE}!="iso9660", \
- ENV{OSINFO_BOOTABLE}="", \
- ENV{OSINFO_INSTALLER}="", \
- ENV{OSINFO_LIVE}="", \
- ENV{OSINFO_MEDIA}=""
-
-ACTION=="change", \
- SUBSYSTEM=="block", \
- ENV{ID_FS_TYPE}!="udf", \
- ENV{OSINFO_BOOTABLE}="", \
- ENV{OSINFO_INSTALLER}="", \
- ENV{OSINFO_LIVE}="", \
- ENV{OSINFO_MEDIA}=""
-
-- 
1.7.7.6




More information about the virt-tools-list mailing list