writeImageBlankSafe(config,
rebuildMedia,
todayIsStart,
blankBehavior,
stagingDirs)
| source code
|
Builds and writes an ISO image containing the indicated stage
directories.
The generated image will contain each of the staging directories
listed in stagingDirs . The directories will be placed into
the image at the root by date, so staging directory
/opt/stage/2005/02/10 will be placed into the disc at
/2005/02/10 . The media will always be written with a media
label specific to Cedar Backup.
This function is similar to writeImage, but tries to implement a smarter blanking
strategy.
First, the media is always blanked if the rebuildMedia
flag is true. Then, if rebuildMedia is false, blanking
behavior and todayIsStart come into effect:
If no blanking behavior is specified, and it is the start of the week,
the disc will be blanked
If blanking behavior is specified, and either the blank mode is "daily"
or the blank mode is "weekly" and it is the start of the week, then
the disc will be blanked if it looks like the weekly backup will not
fit onto the media.
Otherwise, the disc will not be blanked
How do we decide whether the weekly backup will fit onto the media?
That is what the blanking factor is used for. The following formula is
used:
will backup fit? = (bytes available / (1 + bytes required) <= blankFactor
The blanking factor will vary from setup to setup, and will probably
require some experimentation to get it right.
- Parameters:
config - Config object.
rebuildMedia - Indicates whether media should be rebuilt
todayIsStart - Indicates whether today is the starting day of the week
blankBehavior - Blank behavior from configuration, or None to use
default behavior
stagingDirs - Dictionary mapping directory path to date suffix.
- Raises:
ValueError - Under many generic error conditions
IOError - If there is a problem writing the image to disc.
|