def getAllDevices(): """Return a list of Device objects for all devices in the system.""" from _ped import device_probe_all from _ped import device_get_next lst = [] device = None device_probe_all() while True: try: if not device: device = device_get_next() else: device = device_get_next(device) lst.append(Device(PedDevice=device)) except IndexError: return lst
def getDevice(path): """Given the operating system level path to a device node, return a Device object for that disk. Raises DeviceException if an invalid path is given.""" return Device(path=path)