diff options
Diffstat (limited to 'cloudinit/util.py')
-rw-r--r-- | cloudinit/util.py | 37 |
1 files changed, 0 insertions, 37 deletions
diff --git a/cloudinit/util.py b/cloudinit/util.py index f9957c67..9e6e0a73 100644 --- a/cloudinit/util.py +++ b/cloudinit/util.py @@ -1835,40 +1835,3 @@ def expand_dotted_devname(dotted): return toks else: return (dotted, None) - - -def devnode_for_dev_part(device, partition): - """ - Find the name of the partition. While this might seem rather - straight forward, its not since some devices are '<device><partition>' - while others are '<device>p<partition>'. For example, /dev/xvda3 on EC2 - will present as /dev/xvda3p1 for the first partition since /dev/xvda3 is - a block device. - """ - if not os.path.exists(device): - return None - - if not partition: - return device - - short_name = os.path.basename(device) - sys_path = "/sys/block/%s" % short_name - - if not os.path.exists(sys_path): - LOG.debug("did not find entry for %s in /sys/block", short_name) - return None - - sys_long_path = sys_path + "/" + short_name - valid_mappings = [sys_long_path + "%s" % partition, - sys_long_path + "p%s" % partition] - - for cdisk in valid_mappings: - if not os.path.exists(cdisk): - continue - - dev_path = "/dev/%s" % os.path.basename(cdisk) - if os.path.exists(dev_path): - return dev_path - - LOG.debug("Did not fine partition %s for device %s", partition, device) - return None |