def get_lvm_dev(): output = read_cmd("pvdisplay") m = re.search("\s+PV Name\s+([^\s]+)\s+", output) if m != None: dev = m.group(1) return dev.split("/")[2] return None
def get_symlink_dest(link): cmd = "ls -l %s" % link out = read_cmd(cmd) sep = "->" out = out.split(sep) return out[1].strip()