On Mon, 2014-03-31 at 16:41 -0700, Brian C. Lane wrote:
On Mon, Mar 31, 2014 at 01:10:12PM -0500, David Lehman wrote:
> @@ -1399,6 +1379,7 @@ class DeviceTree(object):
> # mirror image
> rname = re.sub(r'_[rm]image.+', '', lv_name[1:-1])
> name = "%s-%s" % (vg_name, rname)
> + addRequiredLV(name, "failed to look up raid lv")
> raid[name]["copies"] += 1
> return
> elif lv_attr[0] == 'e':
> @@ -1409,12 +1390,14 @@ class DeviceTree(object):
> # raid metadata volume
> lv_name = re.sub(r'_rmeta.+', '', lv_name[1:-1])
> name = "%s-%s" % (vg_name, lv_name)
> + addRequiredLV(name, "failed to look up raid lv")
> raid[name]["meta"] += lv_size
> return
> elif lv_attr[0] == 'l':
> # log volume
> rname = re.sub(r'_mlog.*', '', lv_name[1:-1])
> name = "%s-%s" % (vg_name, rname)
> + addRequiredLV(name, "failed to look up log lv")
> raid[name]["log"] = lv_size
> return
> elif lv_attr[0] == 't':
> @@ -1424,17 +1407,9 @@ class DeviceTree(object):
> # thin volume
> pool_name = devicelibs.lvm.thinlvpoolname(vg_name, lv_name)
> pool_device_name = "%s-%s" % (vg_name, pool_name)
> - pool_device = self.getDeviceByName(pool_device_name)
> - if pool_device is None:
> - plv = lv_info[pool_device_name]
> - addLV(plv)
> - pool_device = self.getDeviceByName(pool_device_name)
> -
> - if pool_device is None:
> - raise DeviceTreeError("failed to look up thin pool")
> -
> + addRequiredLV(pool_device_name, "failed to look up thin
pool")
Should these log the name when they fail? Or is that going to be obvious
from surrounding log messages?
It's probably a good idea to log the error before raising the exception
from addRequiredLV.