Revision 6b5e3f70
b/lib/backend.py | ||
---|---|---|
2013 | 2013 |
@return: True if all renames succeeded, False otherwise |
2014 | 2014 |
|
2015 | 2015 |
""" |
2016 |
msgs = [] |
|
2016 | 2017 |
result = True |
2017 | 2018 |
for disk, unique_id in devlist: |
2018 | 2019 |
dev = _RecursiveFindBD(disk) |
2019 | 2020 |
if dev is None: |
2021 |
msgs.append("Can't find device %s in rename" % str(disk)) |
|
2020 | 2022 |
result = False |
2021 | 2023 |
continue |
2022 | 2024 |
try: |
... | ... | |
2031 | 2033 |
# cache? for now, we only lose lvm data when we rename, which |
2032 | 2034 |
# is less critical than DRBD or MD |
2033 | 2035 |
except errors.BlockDeviceError, err: |
2036 |
msgs.append("Can't rename device '%s' to '%s': %s" % |
|
2037 |
(dev, unique_id, err)) |
|
2034 | 2038 |
logging.exception("Can't rename device '%s' to '%s'", dev, unique_id) |
2035 | 2039 |
result = False |
2036 |
return result
|
|
2040 |
return (result, "; ".join(msgs))
|
|
2037 | 2041 |
|
2038 | 2042 |
|
2039 | 2043 |
def _TransformFileStorageDir(file_storage_dir): |
b/lib/cmdlib.py | ||
---|---|---|
5251 | 5251 |
|
5252 | 5252 |
info("renaming the old LVs on the target node") |
5253 | 5253 |
result = self.rpc.call_blockdev_rename(tgt_node, rlist) |
5254 |
result.Raise() |
|
5255 |
if not result.data: |
|
5256 |
raise errors.OpExecError("Can't rename old LVs on node %s" % tgt_node) |
|
5254 |
msg = result.RemoteFailMsg() |
|
5255 |
if msg: |
|
5256 |
raise errors.OpExecError("Can't rename old LVs on node %s: %s" % |
|
5257 |
(tgt_node, msg)) |
|
5257 | 5258 |
# now we rename the new LVs to the old LVs |
5258 | 5259 |
info("renaming the new LVs on the target node") |
5259 | 5260 |
rlist = [(new, old.physical_id) for old, new in zip(old_lvs, new_lvs)] |
5260 | 5261 |
result = self.rpc.call_blockdev_rename(tgt_node, rlist) |
5261 |
result.Raise() |
|
5262 |
if not result.data: |
|
5263 |
raise errors.OpExecError("Can't rename new LVs on node %s" % tgt_node) |
|
5262 |
msg = result.RemoteFailMsg() |
|
5263 |
if msg: |
|
5264 |
raise errors.OpExecError("Can't rename new LVs on node %s: %s" % |
|
5265 |
(tgt_node, msg)) |
|
5264 | 5266 |
|
5265 | 5267 |
for old, new in zip(old_lvs, new_lvs): |
5266 | 5268 |
new.logical_id = old.logical_id |
Also available in: Unified diff