On my system, when I booted from a 2.6.29 kernel to a 2.6.30 kernel, the
scan order of devices changed, and what was sda became sdc.  This
confused autotest, which then printed out the following error and failed
the job:

ABORT   build   reboot.verify_config    timestamp=1287536803
localtime=Oct 19 21:06:43       mounted partitions are different after
reboot (old entries: set([('/dev/sdc3', '/'), ('/dev/sdc1', '/boot'),
('/dev/sdc2', None)]), new entries: set([('/dev/sda3', '/'),
('/dev/sda1', '/boot'), ('/dev/sda2', None)]))  END ABORT

I modified job.py to check the uuids of the mounted file systems instead
of the devices themselves.  This resolved the issue in my environment.

Changes from v1:
- Refactored the steps to get the mount info
- Replaced the subprocess call with autotest API

Signed-off-by: Jeff Moyer <[email protected]>
Signed-off-by: Lucas Meneghel Rodrigues <[email protected]>
---
 client/bin/job.py       |    5 +++--
 client/bin/partition.py |   18 ++++++++++++++++++
 2 files changed, 21 insertions(+), 2 deletions(-)

diff --git a/client/bin/job.py b/client/bin/job.py
index 6dd19d1..3d552ce 100644
--- a/client/bin/job.py
+++ b/client/bin/job.py
@@ -663,7 +663,8 @@ class base_client_job(base_job.base_job):
         # check to see if any partitions have changed
         partition_list = partition_lib.get_partition_list(self,
                                                           exclude_swap=False)
-        mount_info = set((p.device, p.get_mountpoint()) for p in 
partition_list)
+        mount_info = partition_lib.get_mount_info(partition_list)
+
         old_mount_info = self._state.get('client', 'mount_info')
         if mount_info != old_mount_info:
             new_entries = mount_info - old_mount_info
@@ -782,7 +783,7 @@ class base_client_job(base_job.base_job):
         # save the partition list and mount points, as well as the cpu count
         partition_list = partition_lib.get_partition_list(self,
                                                           exclude_swap=False)
-        mount_info = set((p.device, p.get_mountpoint()) for p in 
partition_list)
+        mount_info = partition_lib.get_mount_info(partition_list)
         self._state.set('client', 'mount_info', mount_info)
         self._state.set('client', 'cpu_count', utils.count_cpus())
 
diff --git a/client/bin/partition.py b/client/bin/partition.py
index f72d2d5..c4fce66 100644
--- a/client/bin/partition.py
+++ b/client/bin/partition.py
@@ -176,6 +176,24 @@ def get_partition_list(job, min_blocks=0, 
filter_func=None, exclude_swap=True,
     return partitions
 
 
+def get_mount_info(partition_list):
+    """
+    Picks up mount point information about the machine mounts. By default, we
+    try to associate mount points with UUIDs, because in newer distros the
+    partitions are uniquely identified using them.
+    """
+    mount_info = set()
+    for p in partition_list:
+        try:
+            uuid = utils.system_output('blkid -s UUID -o value %s' % p.device)
+        except error.CmdError:
+            # fall back to using the partition
+            uuid = p.device
+        mount_info.add((uuid, p.get_mountpoint()))
+
+    return mount_info
+
+
 def filter_partition_list(partitions, devnames):
     """
     Pick and choose which partition to keep.
-- 
1.7.2.3

_______________________________________________
Autotest mailing list
[email protected]
http://test.kernel.org/cgi-bin/mailman/listinfo/autotest

Reply via email to