Revision a0c3fea1 lib/bdev.py
b/lib/bdev.py | ||
---|---|---|
258 | 258 |
return min_percent, max_time, is_degraded |
259 | 259 |
|
260 | 260 |
|
261 |
def SetInfo(self, text): |
|
262 |
"""Update metadata with info text. |
|
263 |
|
|
264 |
Only supported for some device types. |
|
265 |
|
|
266 |
""" |
|
267 |
for child in self._children: |
|
268 |
child.SetInfo(text) |
|
269 |
|
|
270 |
|
|
261 | 271 |
def __repr__(self): |
262 | 272 |
return ("<%s: unique_id: %s, children: %s, %s:%s, %s>" % |
263 | 273 |
(self.__class__, self.unique_id, self._children, |
... | ... | |
477 | 487 |
return snap_name |
478 | 488 |
|
479 | 489 |
|
490 |
def SetInfo(self, text): |
|
491 |
"""Update metadata with info text. |
|
492 |
|
|
493 |
""" |
|
494 |
BlockDev.SetInfo(self, text) |
|
495 |
|
|
496 |
# Replace invalid characters |
|
497 |
text = re.sub('^[^A-Za-z0-9_+.]', '_', text) |
|
498 |
text = re.sub('[^-A-Za-z0-9_+.]', '_', text) |
|
499 |
|
|
500 |
# Only up to 128 characters are allowed |
|
501 |
text = text[:128] |
|
502 |
|
|
503 |
result = utils.RunCmd(["lvchange", "--addtag", text, |
|
504 |
self.dev_path]) |
|
505 |
if result.failed: |
|
506 |
raise errors.BlockDeviceError, ("Command: %s error: %s" % |
|
507 |
(result.cmd, result.fail_reason)) |
|
508 |
|
|
509 |
|
|
480 | 510 |
class MDRaid1(BlockDev): |
481 | 511 |
"""raid1 device implemented via md. |
482 | 512 |
|
Also available in: Unified diff