~ubuntu-branches/debian/stretch/fuel-agent/stretch

« back to all changes in this revision

Viewing changes to fuel_agent/utils/hardware.py

  • Committer: Package Import Robot
  • Author(s): Thomas Goirand
  • Date: 2016-03-16 17:12:17 UTC
  • mfrom: (1.1.1)
  • Revision ID: package-import@ubuntu.com-20160316171217-p5b360dfuxm5yidy
Tags: 9.0~0+2016.03.09.git.b1ba4b7747+dfsg1-1
* New upstream release based on commit b1ba4b7747.
* Uploading to unstable.
* Lots of tweaks to make Debian provisionning works.
* Standards-Version: 3.9.7 (no change).

Show diffs side-by-side

added added

removed removed

Lines of Context:
252
252
    return stat.S_ISBLK(mode)
253
253
 
254
254
 
 
255
def is_multipath_device(device, uspec=None):
 
256
    """Check whether block device with given uspec is multipath device"""
 
257
    if uspec is None:
 
258
        uspec = udevreport(device)
 
259
    return any((devlink.startswith('/dev/disk/by-id/dm-uuid-mpath-')
 
260
                for devlink in uspec.get('DEVLINKS', [])))
 
261
 
 
262
 
255
263
def get_block_devices_from_udev_db():
256
264
    devs = []
257
265
    output = utils.execute('udevadm', 'info', '--export-db')[0]
311
319
        if disks and not is_disk(device, bspec=bspec, uspec=uspec):
312
320
            continue
313
321
 
 
322
        # NOTE(kszukielojc) if block device is multipath device,
 
323
        # devlink /dev/mapper/* should be used instead /dev/dm-*
 
324
        if is_multipath_device(device, uspec=uspec):
 
325
            device = [devlink for devlink in uspec['DEVLINKS']
 
326
                      if devlink.startswith('/dev/mapper/')][0]
 
327
 
314
328
        bdev = {
315
329
            'device': device,
316
330
            # NOTE(agordeev): blockdev gets 'startsec' from sysfs,