Moved ephemeralX.Y handling from Datasource into the cc_disk_setup, which makes it cloud agnostic.

This commit is contained in:
Ben Howard
2013-10-03 16:15:56 -06:00
parent 71abf43bbf
commit 86287e9f8b
5 changed files with 35 additions and 18 deletions

View File

@@ -1869,7 +1869,7 @@ def map_device_alias(device, partition=None, alias=None):
"""
if not device:
return None
raise Exception("Device cannot be undefined!")
if not partition and not alias:
raise Exception("partition or alias is required")
@@ -1877,9 +1877,9 @@ def map_device_alias(device, partition=None, alias=None):
if alias:
partition = map_partition(alias)
# if the partition doesn't map, return the device
if not partition:
return device
# if the partition doesn't map, return the device
if not partition:
return device
short_name = device.split('/')[-1]
sys_path = "/sys/block/%s" % short_name
@@ -1898,6 +1898,9 @@ def map_device_alias(device, partition=None, alias=None):
dev_path = "/dev/%s" % cdisk.split('/')[-1]
if os.path.exists(dev_path):
return dev_path
else:
LOG.warn("Specificed parition %s does not exist on %s" % (
partition, device))
return None