Revision 746f7476
b/lib/backend.py | ||
---|---|---|
1249 | 1249 |
|
1250 | 1250 |
""" |
1251 | 1251 |
msgs = [] |
1252 |
result = True |
|
1252 | 1253 |
r_dev = _RecursiveFindBD(disk) |
1253 | 1254 |
if r_dev is not None: |
1254 | 1255 |
r_path = r_dev.dev_path |
1255 | 1256 |
try: |
1256 |
result = r_dev.Shutdown() |
|
1257 |
r_dev.Shutdown() |
|
1258 |
DevCacheManager.RemoveCache(r_path) |
|
1257 | 1259 |
except errors.BlockDeviceError, err: |
1258 | 1260 |
msgs.append(str(err)) |
1259 | 1261 |
result = False |
1260 |
if result: |
|
1261 |
DevCacheManager.RemoveCache(r_path) |
|
1262 |
else: |
|
1263 |
result = True |
|
1262 |
|
|
1264 | 1263 |
if disk.children: |
1265 | 1264 |
for child in disk.children: |
1266 | 1265 |
c_status, c_msg = BlockdevShutdown(child) |
1267 | 1266 |
result = result and c_status |
1268 | 1267 |
if c_msg: # not an empty message |
1269 | 1268 |
msgs.append(c_msg) |
1269 |
|
|
1270 | 1270 |
return (result, "; ".join(msgs)) |
1271 | 1271 |
|
1272 | 1272 |
|
b/lib/bdev.py | ||
---|---|---|
455 | 455 |
volumes on shutdown. |
456 | 456 |
|
457 | 457 |
""" |
458 |
return True
|
|
458 |
pass
|
|
459 | 459 |
|
460 | 460 |
def GetSyncStatus(self): |
461 | 461 |
"""Returns the sync status of the device. |
... | ... | |
1447 | 1447 |
self._children[1].dev_path) |
1448 | 1448 |
if not result: |
1449 | 1449 |
return False |
1450 |
need_localdev_teardown = True |
|
1451 | 1450 |
if self._lhost and self._lport and self._rhost and self._rport: |
1452 | 1451 |
result = self._AssembleNet(minor, |
1453 | 1452 |
(self._lhost, self._lport, |
... | ... | |
1456 | 1455 |
hmac=constants.DRBD_HMAC_ALG, |
1457 | 1456 |
secret=self._secret) |
1458 | 1457 |
if not result: |
1459 |
if need_localdev_teardown: |
|
1460 |
# we will ignore failures from this |
|
1461 |
logging.error("net setup failed, tearing down local device") |
|
1462 |
self._ShutdownAll(minor) |
|
1463 | 1458 |
return False |
1464 | 1459 |
self._SetFromMinor(minor) |
1465 | 1460 |
return True |
... | ... | |
1498 | 1493 |
""" |
1499 | 1494 |
result = utils.RunCmd(["drbdsetup", cls._DevPath(minor), "down"]) |
1500 | 1495 |
if result.failed: |
1501 |
logging.error("Can't shutdown drbd device: %s", result.output) |
|
1502 |
return not result.failed |
|
1496 |
_ThrowError("Can't shutdown drbd device: %s", result.output) |
|
1503 | 1497 |
|
1504 | 1498 |
def Shutdown(self): |
1505 | 1499 |
"""Shutdown the DRBD device. |
1506 | 1500 |
|
1507 | 1501 |
""" |
1508 | 1502 |
if self.minor is None and not self.Attach(): |
1509 |
logging.info("DRBD device not attached to a device during Shutdown") |
|
1510 |
return True |
|
1511 |
if not self._ShutdownAll(self.minor): |
|
1512 |
return False |
|
1503 |
logging.info("drbd%d: not attached during Shutdown()", self._aminor) |
|
1504 |
return |
|
1505 |
minor = self.minor |
|
1513 | 1506 |
self.minor = None |
1514 | 1507 |
self.dev_path = None |
1515 |
return True
|
|
1508 |
self._ShutdownAll(minor)
|
|
1516 | 1509 |
|
1517 | 1510 |
def Remove(self): |
1518 | 1511 |
"""Stub remove for DRBD devices. |
... | ... | |
1602 | 1595 |
the file on shutdown. |
1603 | 1596 |
|
1604 | 1597 |
""" |
1605 |
return True
|
|
1598 |
pass
|
|
1606 | 1599 |
|
1607 | 1600 |
def Open(self, force=False): |
1608 | 1601 |
"""Make the device ready for I/O. |
Also available in: Unified diff