CedarBackup2.writers.util

Package CedarBackup2 :: Package writers :: Module util |
[hide private]
[frames] | no frames]

# Module util

source code

Provides utilities related to image writers.

Author: Kenneth J. Pronovici <pronovic@ieee.org>

Classes | [hide private]
| IsoImage Represents an ISO filesystem image.

Functions | [hide private]
validateDevice(device, unittest=False) Validates a configured device. | source code
validateScsiId(scsiId) Validates a SCSI id string. | source code
validateDriveSpeed(driveSpeed) Validates a drive speed value. | source code
readMediaLabel(devicePath) Reads the media label (volume name) from the indicated device. | source code

Variables | [hide private]
| logger = `logging.getLogger("CedarBackup2.log.writers.util")`
| MKISOFS_COMMAND = ``[``'``mkisofs``'``]``
| VOLNAME_COMMAND = ``[``'``volname``'``]``
| __package__ = ``'``CedarBackup2.writers``'``

Function Details | [hide private]

### validateDevice(device, unittest=False) | source code
Validates a configured device. The device must be an absolute path, must exist, and must be writable. The unittest flag turns off validation of the device on disk. Parameters: `device` - Filesystem device path. `unittest` - Indicates whether we're unit testing. Returns: Device as a string, for instance `"/dev/cdrw"` Raises: `ValueError` - If the device value is invalid. `ValueError` - If some path cannot be encoded properly.

### validateScsiId(scsiId) | source code
Validates a SCSI id string. SCSI id must be a string in the form `[<method>:]scsibus,target,lun`. For Mac OS X (Darwin), we also accept the form `IO.*Services[/N]`. Parameters: `scsiId` - SCSI id for the device. Returns: SCSI id as a string, for instance `"ATA:1,0,0"` Raises: `ValueError` - If the SCSI id string is invalid. Note: For consistency, if `None` is passed in, `None` will be returned.

### validateDriveSpeed(driveSpeed) | source code
Validates a drive speed value. Drive speed must be an integer which is >= 1. Parameters: `driveSpeed` - Speed at which the drive writes. Returns: Drive speed as an integer Raises: `ValueError` - If the drive speed value is invalid. Note: For consistency, if `None` is passed in, `None` will be returned.

### readMediaLabel(devicePath) | source code
Reads the media label (volume name) from the indicated device. The volume name is read using the `volname` command. Parameters: `devicePath` - Device path to read from Returns: Media label as a string, or None if there is no name or it could not be read.