curtin-dev team mailing list archive
-
curtin-dev team
-
Mailing list archive
-
Message #01121
Re: [Merge] ~mwhudson/curtin:pare-down-dasdview-parsing into curtin:master
Diff comments:
> diff --git a/curtin/block/dasd.py b/curtin/block/dasd.py
> index 7450300..8524d63 100644
> --- a/curtin/block/dasd.py
> +++ b/curtin/block/dasd.py
> @@ -461,42 +278,31 @@ class DasdDevice(CcwDevice):
> """ Returns a boolean indicating if the specified device_id is not yet
> formatted.
>
> - :param device_id: string of device ccw bus_id.
> :returns: boolean: True if the device is not formatted.
> """
> return self.ccw_device_attr('status') == "unformatted"
>
> - def is_online(self):
> - """ Returns a boolean indicating if specified device is online.
> -
> - :param device_id: string of device ccw bus_id.
> - :returns: boolean: True if device is online.
> - """
> - return self.ccw_device_attr('online') == "1"
> -
> def blocksize(self):
> """ Read and return device_id's 'blocksize' value.
>
> :param: device_id: string of device ccw bus_id.
> :returns: string: the device's current blocksize.
> """
> - blkattr = 'block/%s/queue/hw_sector_size' % self.kname
> - return self.ccw_device_attr(blkattr)
> + blkattr = 'block/*/queue/hw_sector_size'
> + [path] = glob.glob(self.ccw_device_attr_path(blkattr))
There is only one block device, within a CCW bus device. At this point we are scoped to `/sys/bus/ccw/devices/0.0.154d/`.
Previously, to determine self.kname, the code did `listdir()` of block, and then take the first thing there. Which amounts to globing just the same.
Maybe we can be slightly more explicit and do
`path = glob.glob(...)[0]`?
> + return util.load_file(path)
>
> def disk_layout(self):
> """ Read and return specified device "disk_layout" value.
>
> :returns: string: One of ['cdl', 'ldl', 'not-formatted'].
> :raises: ValueError if dasdview result missing 'format' section.
> -
> """
> - view = dasdview(self.devname)
> - disk_format = view.get('extended', {}).get('format')
> - if not disk_format:
> + format = dasd_format(self.devname)
> + if not format:
> raise ValueError(
> - 'dasdview on %s missing "format" section' % self.devname)
> -
> - return disk_format.txt
> + 'could not determine format of %s' % self.devname)
> + return format
>
> def label(self):
> """Read and return specified device label (VOLSER) value.
--
https://code.launchpad.net/~mwhudson/curtin/+git/curtin/+merge/394207
Your team curtin developers is requested to review the proposed merge of ~mwhudson/curtin:pare-down-dasdview-parsing into curtin:master.
References