Revision 58194535 snf-cyclades-app/synnefo/volume/util.py

b/snf-cyclades-app/synnefo/volume/util.py
57 57
def snapshot_to_links(snapshot_id):
58 58
    href = join_urls(SNAPSHOTS_URL, str(snapshot_id))
59 59
    return [{"rel": rel, "href": href} for rel in ("self", "bookmark")]
60

  
61

  
62
def get_disk_template_provider(disk_template):
63
    """Extract provider from disk template.
64

  
65
    Provider for `ext` disk_template is encoded in the disk template
66
    name, which is formed `ext_<provider_name>`. Provider is None
67
    for all other disk templates.
68

  
69
    """
70
    provider = None
71
    if disk_template.startswith("ext") and "_" in disk_template:
72
        disk_template, provider = disk_template.split("_", 1)
73
    return disk_template, provider

Also available in: Unified diff