diff options
| author | Vladyslav Drok <vdrok@mirantis.com> | 2020-10-16 13:03:32 +0200 |
|---|---|---|
| committer | Julia Kreger <juliaashleykreger@gmail.com> | 2020-11-11 17:25:59 +0000 |
| commit | c7858d3cc8709d95d63ff45e427f5215320bc67a (patch) | |
| tree | 3567f5ac8f59b9894191063c553b0206514cbc06 /ironic_python_agent/hardware.py | |
| parent | f52863a4d8bc1709bb1fc87e2d1c1cf94b666bba (diff) | |
| download | ironic-python-agent-c7858d3cc8709d95d63ff45e427f5215320bc67a.tar.gz | |
Add UUID to BlockDevice object
It'd allow for example custom ansible playbooks to use UUIDs of the
introspected node's disks. In future it might also enable agent
to use UUID (or by_path value) to refer to a device instead of
name, as it happens currently.
Change-Id: Id00437d2295c39fb12f3c25a92b30b56a58eef13
Diffstat (limited to 'ironic_python_agent/hardware.py')
| -rw-r--r-- | ironic_python_agent/hardware.py | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/ironic_python_agent/hardware.py b/ironic_python_agent/hardware.py index a7ea9acc..e58918a6 100644 --- a/ironic_python_agent/hardware.py +++ b/ironic_python_agent/hardware.py @@ -416,7 +416,7 @@ def list_all_block_devices(block_type='disk', "Cause: %(error)s", {'path': disk_by_path_dir, 'error': e}) # NOTE(dtantsur): keep in sync with utils.LSBLK_COLUMNS - columns = ['KNAME', 'MODEL', 'SIZE', 'ROTA', 'TYPE'] + columns = ['KNAME', 'MODEL', 'SIZE', 'ROTA', 'TYPE', 'UUID'] report = utils.execute('lsblk', '-Pbia', '-o{}'.format(','.join(columns)), check_exit_code=[0])[0] lines = report.splitlines() @@ -534,6 +534,7 @@ def list_all_block_devices(block_type='disk', vendor=_get_device_info(device['KNAME'], 'block', 'vendor'), by_path=by_path_name, + uuid=device['UUID'], **extra)) return devices @@ -600,11 +601,13 @@ class BlockDevice(encoding.SerializableComparable): def __init__(self, name, model, size, rotational, wwn=None, serial=None, vendor=None, wwn_with_extension=None, - wwn_vendor_extension=None, hctl=None, by_path=None): + wwn_vendor_extension=None, hctl=None, by_path=None, + uuid=None): self.name = name self.model = model self.size = size self.rotational = rotational + self.uuid = uuid self.wwn = wwn self.serial = serial self.vendor = vendor |
