def device_name_to_id(device_name):
    """
    Tries to come up with CloudStack device-id based on physical device name.
    Assumes you have validated this as a proper device name (see 'is_block_device').
    :param device_name: path to device
    :return: CloudStack device-id
    """
    short = device_name.split('/')[-1]
    last_char = short[-1]
    num = ord(last_char) - ord('a')
    if num > 2:
        num += 1
    return num
