below is my python script which needs to traverse all the physical disks which are having logical-paths as well as direct disks
and if we found any logical_paths then we get corresponding physical disk then we remove the logical-part and add the physical-disk corresponding to it into the check dictionary
check={
"/dev/disks/DISK2": "",
"/dev/disks/DISK4": "",
"/dev/disks/DISK5": "",
"/dev/disks/DISK1": "",
"/dev/disks/DISK6": "",
"/dev/disks/DISK3": "",
"/dev/sda": "/dev/sda"
}
logical_paths={
"/dev/disks/DISK2": "/ dev / sdc1",
"/dev/disks/DISK4": "/ dev / sdd2",
"/dev/disks/DISK5": "/ dev / sde1",
"/dev/disks/DISK1": "/dev/sdb4"
}
for a in check.keys():
print("*****")
print("disk is:"+a)
if a in logical_paths:
check[logical_paths[a]]=check[a]
check.pop(a,None)
print("####")
print(check)
But output of my script is:
*****
disk is:/dev/oracleasm/disks/DISK2
*****
disk is:/dev/oracleasm/disks/DISK4
*****
disk is:/dev/oracleasm/disks/DISK5
*****
disk is:/dev/oracleasm/disks/DISK1
*****
disk is:/ dev / sdc1
*****
disk is:/ dev / sdd2
*****
disk is:/ dev / sde1
*****
disk is:/dev/sdb4
Why is it traversing the disk6,disk3 and SDA