def __getYaim(self, machinename, tempMountpoint, sitename): yaimFile = "/usr/local/vnode-2.0/yaim/yaimgen_" + sitename + "_vNode.cfg" moveYaimFile = "sudo cp " + yaimFile + " " + tempMountpoint + "/root/yaimgen/" logging.info(moveYaimFile) try: output = execute.getCommandOutput(moveYaimFile) except: logging.info('cannot get yaimgen configuration') raise
def getFreeDiskSpace(self): checkPartCmd = "sudo vgs -o vg_free --units M --noheadings " + self.__vgName lines = execute.getCommandOutput(checkPartCmd) if len(lines) == 0: raise Exception('Did not get output from "' + checkPartCmd + '"') checkSizeRe = re.compile(r"([\d]+[.\d]*)M") freeSpace = re.findall(checkSizeRe, lines[0]) if not freeSpace: raise Exception('Could not parse output from "' + checkPartCmd + '"') return float(freeSpace[0])
def __checkPartitionExists(self, partitionName): getPartCmd = "sudo lvs -o lv_name,lv_size|grep " + partitionName lines = execute.getCommandOutput(getPartCmd) return len(lines) > 0