/[gli]/trunk/src/GLIStorageDevice.py
Gentoo

Diff of /trunk/src/GLIStorageDevice.py

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 686 Revision 687
621# Returns a list of detected partitionable devices 621# Returns a list of detected partitionable devices
622def detect_devices(): 622def detect_devices():
623 devices = [] 623 devices = []
624 624
625 # Make sure sysfs exists 625 # Make sure sysfs exists
626 # TODO: rewrite for 2.4 support
626 if not os.path.exists("/sys/bus"): 627 if not os.path.exists("/sys/bus"):
627 raise GLIException("GLIStorageDeviceError", 'fatal', 'detect_devices', "no sysfs found (you MUST use a kernel >2.6)") 628 raise GLIException("GLIStorageDeviceError", 'fatal', 'detect_devices', "no sysfs found (you MUST use a kernel >2.6)")
628 # Make sure /proc/partitions exists 629 # Make sure /proc/partitions exists
629 if not os.path.exists("/proc/partitions"): 630 if not os.path.exists("/proc/partitions"):
630 raise GLIException("GLIStorageDeviceError", 'fatal', 'detect_devices', "/proc/partitions does not exist! Please make sure procfs is in your kernel and mounted!") 631 raise GLIException("GLIStorageDeviceError", 'fatal', 'detect_devices', "/proc/partitions does not exist! Please make sure procfs is in your kernel and mounted!")
667 668
668 partitions.append(( major, minor, device )) 669 partitions.append(( major, minor, device ))
669 670
670 # Scan sysfs for the devices of type 'x' 671 # Scan sysfs for the devices of type 'x'
671 # 'x' being a member of the list below: 672 # 'x' being a member of the list below:
673 # TODO: rewrite for 2.4 support
672 for dev_type in [ "ide", "scsi" ]: # Other device types? usb? fw? 674 for dev_type in [ "ide", "scsi" ]: # Other device types? usb? fw?
673 if os.path.exists("/sys/bus/" + dev_type): 675 if os.path.exists("/sys/bus/" + dev_type):
674 sysfs_devices = os.listdir("/sys/bus/"+dev_type+"/devices") 676 sysfs_devices = os.listdir("/sys/bus/"+dev_type+"/devices")
675 677
676 # For each device in the devices on that bus 678 # For each device in the devices on that bus

Legend:
Removed from v.686  
changed lines
  Added in v.687

  ViewVC Help
Powered by ViewVC 1.1.20