Revision 0c6c04ec lib/bdev.py
b/lib/bdev.py | ||
---|---|---|
368 | 368 |
""" |
369 | 369 |
if not self.minor and not self.Attach(): |
370 | 370 |
# the LV does not exist |
371 |
return True
|
|
371 |
return |
|
372 | 372 |
result = utils.RunCmd(["lvremove", "-f", "%s/%s" % |
373 | 373 |
(self._vg_name, self._lv_name)]) |
374 | 374 |
if result.failed: |
375 |
logging.error("Can't lvremove: %s - %s", |
|
376 |
result.fail_reason, result.output) |
|
377 |
|
|
378 |
return not result.failed |
|
375 |
_ThrowError("Can't lvremove: %s - %s", result.fail_reason, result.output) |
|
379 | 376 |
|
380 | 377 |
def Rename(self, new_id): |
381 | 378 |
"""Rename this logical volume. |
... | ... | |
506 | 503 |
|
507 | 504 |
# remove existing snapshot if found |
508 | 505 |
snap = LogicalVolume((self._vg_name, snap_name), None) |
509 |
snap.Remove()
|
|
506 |
_IgnoreError(snap.Remove)
|
|
510 | 507 |
|
511 | 508 |
pvs_info = self.GetPVInfo(self._vg_name) |
512 | 509 |
if not pvs_info: |
... | ... | |
1511 | 1508 |
"""Stub remove for DRBD devices. |
1512 | 1509 |
|
1513 | 1510 |
""" |
1514 |
return self.Shutdown()
|
|
1511 |
self.Shutdown() |
|
1515 | 1512 |
|
1516 | 1513 |
@classmethod |
1517 | 1514 |
def Create(cls, unique_id, children, size): |
... | ... | |
1620 | 1617 |
@return: True if the removal was successful |
1621 | 1618 |
|
1622 | 1619 |
""" |
1623 |
if not os.path.exists(self.dev_path): |
|
1624 |
return True |
|
1625 | 1620 |
try: |
1626 | 1621 |
os.remove(self.dev_path) |
1627 |
return True |
|
1628 | 1622 |
except OSError, err: |
1629 |
logging.error("Can't remove file '%s': %s", self.dev_path, err)
|
|
1630 |
return False
|
|
1623 |
if err.errno != errno.ENOENT:
|
|
1624 |
_ThrowError("Can't remove file '%s': %s", self.dev_path, err)
|
|
1631 | 1625 |
|
1632 | 1626 |
def Attach(self): |
1633 | 1627 |
"""Attach to an existing file. |
Also available in: Unified diff