Revision aed77cea lib/bdev.py
b/lib/bdev.py | ||
---|---|---|
1629 | 1629 |
@return: an instance of FileStorage |
1630 | 1630 |
|
1631 | 1631 |
""" |
1632 |
# TODO: decide whether we should check for existing files and |
|
1633 |
# abort or not |
|
1634 | 1632 |
if not isinstance(unique_id, (tuple, list)) or len(unique_id) != 2: |
1635 | 1633 |
raise ValueError("Invalid configuration data %s" % str(unique_id)) |
1636 | 1634 |
dev_path = unique_id[1] |
1635 |
if os.path.exists(dev_path): |
|
1636 |
_ThrowError("File already existing: %s", dev_path) |
|
1637 | 1637 |
try: |
1638 | 1638 |
f = open(dev_path, 'w') |
1639 | 1639 |
f.truncate(size * 1024 * 1024) |
Also available in: Unified diff