Beispiel #1
0
 def umount(self, directory_set = None):
     """Unmounts the mount points in our target.  On error returns a set
     containing the directories that could not be unmounted"""
     # Go through all the mount points that we recorded during the mount
     # function
     if directory_set == None:
         directory_set = set()
     loop_tries = 8
     for x in range(0, loop_tries):
         local_set = set()
         for mount_point in self.mounted:
             if os.path.exists(mount_point):
                 result = pdk_utils.umount(mount_point)
                 if not result:
                     local_set.add(mount_point)
         pdk_utils.umountAllInPath(self.path, local_set)
         if not local_set:
             # Success.  All directories could be un-mounted
             break
         else:
             for directory in local_set:
                 print _("Failed to umount FileSystem directory: %s") % directory
                 cmd_line = "lsof | grep %s" % directory
                 print _("Execing: %s") % cmd_line
                 os.system(cmd_line)
             print _("Sleeping for 5 seconds, try %s of %s") % (x+1, loop_tries)
             time.sleep(5)
     directory_set.update(local_set)
     return directory_set
 def __yumDoUmounts(self, chroot_dir):
     pdk_utils.umountAllInPath(chroot_dir)