~wesley-wiedenmeier/curtin/vmtest-webhook-delay

« back to all changes in this revision

Viewing changes to curtin/block/__init__.py

  • Committer: Ryan Harper
  • Date: 2016-06-14 20:07:48 UTC
  • mfrom: (381.1.10 trunk)
  • Revision ID: ryan.harper@canonical.com-20160614200748-s1g1k4b3gc0ytl5z
merge with trunk

Show diffs side-by-side

added added

removed removed

Lines of Context:
23
23
import itertools
24
24
 
25
25
from curtin import util
 
26
from curtin.udev import udevadm_settle
26
27
from curtin.log import LOG
27
28
 
28
29
 
89
90
        for tok in toks:
90
91
            k, v = tok.split("=", 1)
91
92
            cur[k] = v
92
 
        cur['device_path'] = get_dev_name_entry(cur['NAME'])[1]
93
 
        ret[cur['NAME']] = cur
 
93
        # use KNAME, as NAME may include spaces and other info,
 
94
        # for example, lvm decices may show 'dm0 lvm1'
 
95
        cur['device_path'] = get_dev_name_entry(cur['KNAME'])[1]
 
96
        ret[cur['KNAME']] = cur
94
97
    return ret
95
98
 
96
99
 
262
265
        # we fix LP: #1489521 we kind of need to.
263
266
        LOG.warn("rescanning devices failed: %s", e)
264
267
 
265
 
    util.subp(['udevadm', 'settle'])
 
268
    udevadm_settle()
266
269
 
267
270
    return
268
271
 
412
415
    return target
413
416
 
414
417
 
 
418
def get_blockdev_sector_size(devpath):
 
419
    """
 
420
    Get the logical and physical sector size of device at devpath
 
421
    Returns a tuple of integer values (logical, physical).
 
422
    """
 
423
    info = _lsblock([devpath])
 
424
    LOG.debug('get_blockdev_sector_size: info:\n%s' % util.json_dumps(info))
 
425
    [parent] = info
 
426
    return (int(info[parent]['LOG-SEC']), int(info[parent]['PHY-SEC']))
 
427
 
 
428
 
415
429
def get_volume_uuid(path):
416
430
    """
417
431
    Get uuid of disk with given path. This address uniquely identifies