~niedbalski/charms/trusty/swift-storage/backport-fix-lp1510666

« back to all changes in this revision

Viewing changes to charmhelpers/contrib/storage/linux/loopback.py

  • Committer: Jorge Niedbalski
  • Date: 2015-11-17 17:26:08 UTC
  • Revision ID: jorge.niedbalski@canonical.com-20151117172608-xrbq7tn2jlb0y286
Backport of fix for LP: #1510666.

Show diffs side-by-side

added added

removed removed

Lines of Context:
76
76
        check_call(cmd)
77
77
 
78
78
    return create_loopback(path)
 
79
 
 
80
 
 
81
def is_mapped_loopback_device(device):
 
82
    """
 
83
    Checks if a given device name is an existing/mapped loopback device.
 
84
    :param device: str: Full path to the device (eg, /dev/loop1).
 
85
    :returns: str: Path to the backing file if is a loopback device
 
86
    empty string otherwise
 
87
    """
 
88
    return loopback_devices().get(device, "")