This commit is contained in:
Shital Savekar 2015-08-12 18:49:40 +05:30
Родитель 0a6d9f4def
Коммит c40cca0772
1 изменённых файлов: 6 добавлений и 7 удалений

Просмотреть файл

@ -8,8 +8,8 @@ def RunTest(command):
RunLog.info("Checking if swap disk is enable or not..")
RunLog.info("Executing swapon -s..")
temp = Run(command)
lsblkOutput = Run("lsblk")
output = temp
if os.path.exists("/etc/lsb-release") and int(Run("cat /etc/lsb-release | grep -i coreos | wc -l")) > 0:
waagent_conf_file = "/usr/share/oem/waagent.conf"
else:
@ -21,20 +21,19 @@ def RunTest(command):
for line in outputlist:
if(line.find("ResourceDisk.EnableSwap")!=-1):
break
RunLog.info("Value ResourceDisk.EnableSwap in " + waagent_conf_file + ": " + line.strip()[-1])
if (("swap" in output) and (line.strip()[-1] == "n")):
RunLog.info("Value " + line.strip().split()[0] + " in " + waagent_conf_file)
if ((("swap" in output) or ("SWAP" in lsblkOutput)) and (line.strip().split()[0] == "ResourceDisk.EnableSwap=n")):
RunLog.error('Swap is enabled. Swap should not be enabled.')
RunLog.error('%s', output)
ResultLog.error('FAIL')
elif ((output.find("swap")==-1) and (line.strip()[-1] == "y")):
elif (((output.find("swap")==-1) or ("SWAP" in lsblkOutput)) and (line.strip().split()[0] == "ResourceDisk.EnableSwap=y")):
RunLog.error('Swap is disabled. Swap should be enabled.')
RunLog.error('%s', output)
RunLog.info("Pleae check value of setting ResourceDisk.SwapSizeMB")
ResultLog.error('FAIL')
elif(("swap" in output) and (line.strip()[-1] == "y")):
elif((("swap" in output) or ("SWAP" in lsblkOutput)) and (line.strip().split()[0] == "ResourceDisk.EnableSwap=y")):
RunLog.info('swap is enabled.')
if(IsUbuntu()) :
mntresource = "/mnt"
@ -47,7 +46,7 @@ def RunTest(command):
else:
RunLog.info("swap is not enabled on resource disk")
ResultLog.info('FAIL')
elif((output.find("swap")==-1) and (line.strip()[-1] == "n")):
elif(((output.find("swap")==-1) or ("SWAP" in lsblkOutput)) and (line.strip().split()[0] == "ResourceDisk.EnableSwap=n")):
RunLog.info('swap is disabled.')
ResultLog.info('PASS')
UpdateState("TestCompleted")