示例#1
0
def md_get_devices_list(devpath):
    sysfs_md = sys_block_path(devpath, "md")
    devices = [
        dev_path(dev[4:]) for dev in os.listdir(sysfs_md)
        if (dev.startswith('dev-') and util.load_file(
            os.path.join(sysfs_md, dev, 'state')).strip() != 'spare')
    ]
    return devices
示例#2
0
def md_check_array_uuid(md_devname, md_uuid):
    valid_mdname(md_devname)

    # confirm we have /dev/{mdname} by following the udev symlink
    mduuid_path = ('/dev/disk/by-id/md-uuid-' + md_uuid)
    mdlink_devname = dev_path(os.path.realpath(mduuid_path))
    if md_devname != mdlink_devname:
        err = ('Mismatch between devname and md-uuid symlink: ' +
               '%s -> %s != %s' % (mduuid_path, mdlink_devname, md_devname))
        raise ValueError(err)