From 008c1308b49227a0864751be8e73eaeca21af63e Mon Sep 17 00:00:00 2001 From: Jarrod Johnson Date: Sat, 26 Oct 2024 08:16:56 -0400 Subject: [PATCH] Handle nvm subsystem without driver. A variant of the M.2 RAID enablement kit does not manifest with nvme driver. Address this by allowing 'nvm' subsystype. to allow blank driver. Also, to be on the safe side, have self.driver always be a string, so it can be 'falsey' but still work as a string. --- .../el7-diskless/profiles/default/scripts/getinstalldisk | 8 ++++++-- .../el7/profiles/default/scripts/getinstalldisk | 8 ++++++-- .../el8-diskless/profiles/default/scripts/getinstalldisk | 8 ++++++-- .../el8/profiles/default/scripts/getinstalldisk | 8 ++++++-- .../el9-diskless/profiles/default/scripts/getinstalldisk | 8 ++++++-- .../rhvh4/profiles/default/scripts/getinstalldisk | 8 ++++++-- .../suse15/profiles/hpc/scripts/getinstalldisk | 8 ++++++-- .../suse15/profiles/server/scripts/getinstalldisk | 8 ++++++-- .../profiles/default/scripts/getinstalldisk | 8 ++++++-- .../ubuntu20.04/profiles/default/scripts/getinstalldisk | 8 ++++++-- .../ubuntu22.04/profiles/default/scripts/getinstalldisk | 8 ++++++-- 11 files changed, 66 insertions(+), 22 deletions(-) diff --git a/confluent_osdeploy/el7-diskless/profiles/default/scripts/getinstalldisk b/confluent_osdeploy/el7-diskless/profiles/default/scripts/getinstalldisk index 04c7708e..c954a254 100644 --- a/confluent_osdeploy/el7-diskless/profiles/default/scripts/getinstalldisk +++ b/confluent_osdeploy/el7-diskless/profiles/default/scripts/getinstalldisk @@ -1,3 +1,4 @@ +#!/usr/bin/python3 import subprocess import os @@ -10,8 +11,9 @@ class DiskInfo(object): self.path = None self.model = '' self.size = 0 - self.driver = None + self.driver = '' self.mdcontainer = '' + self.subsystype = '' devnode = '/dev/{0}'.format(devname) qprop = subprocess.check_output( ['udevadm', 'info', '--query=property', devnode]) @@ -46,7 +48,9 @@ class DiskInfo(object): elif (k == 'DRIVERS' and not self.driver and v not in ('"sd"', '""')): self.driver = v.replace('"', '') - if not self.driver and 'imsm' not in self.mdcontainer: + elif k == 'ATTRS{subsystype}': + self.subsystype = v.replace('"', '') + if not self.driver and 'imsm' not in self.mdcontainer and self.subsystype != 'nvm': raise Exception("No driver detected") if os.path.exists('/sys/block/{0}/size'.format(self.name)): with open('/sys/block/{0}/size'.format(self.name), 'r') as sizesrc: diff --git a/confluent_osdeploy/el7/profiles/default/scripts/getinstalldisk b/confluent_osdeploy/el7/profiles/default/scripts/getinstalldisk index 04c7708e..c954a254 100644 --- a/confluent_osdeploy/el7/profiles/default/scripts/getinstalldisk +++ b/confluent_osdeploy/el7/profiles/default/scripts/getinstalldisk @@ -1,3 +1,4 @@ +#!/usr/bin/python3 import subprocess import os @@ -10,8 +11,9 @@ class DiskInfo(object): self.path = None self.model = '' self.size = 0 - self.driver = None + self.driver = '' self.mdcontainer = '' + self.subsystype = '' devnode = '/dev/{0}'.format(devname) qprop = subprocess.check_output( ['udevadm', 'info', '--query=property', devnode]) @@ -46,7 +48,9 @@ class DiskInfo(object): elif (k == 'DRIVERS' and not self.driver and v not in ('"sd"', '""')): self.driver = v.replace('"', '') - if not self.driver and 'imsm' not in self.mdcontainer: + elif k == 'ATTRS{subsystype}': + self.subsystype = v.replace('"', '') + if not self.driver and 'imsm' not in self.mdcontainer and self.subsystype != 'nvm': raise Exception("No driver detected") if os.path.exists('/sys/block/{0}/size'.format(self.name)): with open('/sys/block/{0}/size'.format(self.name), 'r') as sizesrc: diff --git a/confluent_osdeploy/el8-diskless/profiles/default/scripts/getinstalldisk b/confluent_osdeploy/el8-diskless/profiles/default/scripts/getinstalldisk index 04c7708e..c954a254 100644 --- a/confluent_osdeploy/el8-diskless/profiles/default/scripts/getinstalldisk +++ b/confluent_osdeploy/el8-diskless/profiles/default/scripts/getinstalldisk @@ -1,3 +1,4 @@ +#!/usr/bin/python3 import subprocess import os @@ -10,8 +11,9 @@ class DiskInfo(object): self.path = None self.model = '' self.size = 0 - self.driver = None + self.driver = '' self.mdcontainer = '' + self.subsystype = '' devnode = '/dev/{0}'.format(devname) qprop = subprocess.check_output( ['udevadm', 'info', '--query=property', devnode]) @@ -46,7 +48,9 @@ class DiskInfo(object): elif (k == 'DRIVERS' and not self.driver and v not in ('"sd"', '""')): self.driver = v.replace('"', '') - if not self.driver and 'imsm' not in self.mdcontainer: + elif k == 'ATTRS{subsystype}': + self.subsystype = v.replace('"', '') + if not self.driver and 'imsm' not in self.mdcontainer and self.subsystype != 'nvm': raise Exception("No driver detected") if os.path.exists('/sys/block/{0}/size'.format(self.name)): with open('/sys/block/{0}/size'.format(self.name), 'r') as sizesrc: diff --git a/confluent_osdeploy/el8/profiles/default/scripts/getinstalldisk b/confluent_osdeploy/el8/profiles/default/scripts/getinstalldisk index 04c7708e..c954a254 100644 --- a/confluent_osdeploy/el8/profiles/default/scripts/getinstalldisk +++ b/confluent_osdeploy/el8/profiles/default/scripts/getinstalldisk @@ -1,3 +1,4 @@ +#!/usr/bin/python3 import subprocess import os @@ -10,8 +11,9 @@ class DiskInfo(object): self.path = None self.model = '' self.size = 0 - self.driver = None + self.driver = '' self.mdcontainer = '' + self.subsystype = '' devnode = '/dev/{0}'.format(devname) qprop = subprocess.check_output( ['udevadm', 'info', '--query=property', devnode]) @@ -46,7 +48,9 @@ class DiskInfo(object): elif (k == 'DRIVERS' and not self.driver and v not in ('"sd"', '""')): self.driver = v.replace('"', '') - if not self.driver and 'imsm' not in self.mdcontainer: + elif k == 'ATTRS{subsystype}': + self.subsystype = v.replace('"', '') + if not self.driver and 'imsm' not in self.mdcontainer and self.subsystype != 'nvm': raise Exception("No driver detected") if os.path.exists('/sys/block/{0}/size'.format(self.name)): with open('/sys/block/{0}/size'.format(self.name), 'r') as sizesrc: diff --git a/confluent_osdeploy/el9-diskless/profiles/default/scripts/getinstalldisk b/confluent_osdeploy/el9-diskless/profiles/default/scripts/getinstalldisk index 04c7708e..c954a254 100644 --- a/confluent_osdeploy/el9-diskless/profiles/default/scripts/getinstalldisk +++ b/confluent_osdeploy/el9-diskless/profiles/default/scripts/getinstalldisk @@ -1,3 +1,4 @@ +#!/usr/bin/python3 import subprocess import os @@ -10,8 +11,9 @@ class DiskInfo(object): self.path = None self.model = '' self.size = 0 - self.driver = None + self.driver = '' self.mdcontainer = '' + self.subsystype = '' devnode = '/dev/{0}'.format(devname) qprop = subprocess.check_output( ['udevadm', 'info', '--query=property', devnode]) @@ -46,7 +48,9 @@ class DiskInfo(object): elif (k == 'DRIVERS' and not self.driver and v not in ('"sd"', '""')): self.driver = v.replace('"', '') - if not self.driver and 'imsm' not in self.mdcontainer: + elif k == 'ATTRS{subsystype}': + self.subsystype = v.replace('"', '') + if not self.driver and 'imsm' not in self.mdcontainer and self.subsystype != 'nvm': raise Exception("No driver detected") if os.path.exists('/sys/block/{0}/size'.format(self.name)): with open('/sys/block/{0}/size'.format(self.name), 'r') as sizesrc: diff --git a/confluent_osdeploy/rhvh4/profiles/default/scripts/getinstalldisk b/confluent_osdeploy/rhvh4/profiles/default/scripts/getinstalldisk index 04c7708e..c954a254 100644 --- a/confluent_osdeploy/rhvh4/profiles/default/scripts/getinstalldisk +++ b/confluent_osdeploy/rhvh4/profiles/default/scripts/getinstalldisk @@ -1,3 +1,4 @@ +#!/usr/bin/python3 import subprocess import os @@ -10,8 +11,9 @@ class DiskInfo(object): self.path = None self.model = '' self.size = 0 - self.driver = None + self.driver = '' self.mdcontainer = '' + self.subsystype = '' devnode = '/dev/{0}'.format(devname) qprop = subprocess.check_output( ['udevadm', 'info', '--query=property', devnode]) @@ -46,7 +48,9 @@ class DiskInfo(object): elif (k == 'DRIVERS' and not self.driver and v not in ('"sd"', '""')): self.driver = v.replace('"', '') - if not self.driver and 'imsm' not in self.mdcontainer: + elif k == 'ATTRS{subsystype}': + self.subsystype = v.replace('"', '') + if not self.driver and 'imsm' not in self.mdcontainer and self.subsystype != 'nvm': raise Exception("No driver detected") if os.path.exists('/sys/block/{0}/size'.format(self.name)): with open('/sys/block/{0}/size'.format(self.name), 'r') as sizesrc: diff --git a/confluent_osdeploy/suse15/profiles/hpc/scripts/getinstalldisk b/confluent_osdeploy/suse15/profiles/hpc/scripts/getinstalldisk index 04c7708e..c954a254 100644 --- a/confluent_osdeploy/suse15/profiles/hpc/scripts/getinstalldisk +++ b/confluent_osdeploy/suse15/profiles/hpc/scripts/getinstalldisk @@ -1,3 +1,4 @@ +#!/usr/bin/python3 import subprocess import os @@ -10,8 +11,9 @@ class DiskInfo(object): self.path = None self.model = '' self.size = 0 - self.driver = None + self.driver = '' self.mdcontainer = '' + self.subsystype = '' devnode = '/dev/{0}'.format(devname) qprop = subprocess.check_output( ['udevadm', 'info', '--query=property', devnode]) @@ -46,7 +48,9 @@ class DiskInfo(object): elif (k == 'DRIVERS' and not self.driver and v not in ('"sd"', '""')): self.driver = v.replace('"', '') - if not self.driver and 'imsm' not in self.mdcontainer: + elif k == 'ATTRS{subsystype}': + self.subsystype = v.replace('"', '') + if not self.driver and 'imsm' not in self.mdcontainer and self.subsystype != 'nvm': raise Exception("No driver detected") if os.path.exists('/sys/block/{0}/size'.format(self.name)): with open('/sys/block/{0}/size'.format(self.name), 'r') as sizesrc: diff --git a/confluent_osdeploy/suse15/profiles/server/scripts/getinstalldisk b/confluent_osdeploy/suse15/profiles/server/scripts/getinstalldisk index 04c7708e..c954a254 100644 --- a/confluent_osdeploy/suse15/profiles/server/scripts/getinstalldisk +++ b/confluent_osdeploy/suse15/profiles/server/scripts/getinstalldisk @@ -1,3 +1,4 @@ +#!/usr/bin/python3 import subprocess import os @@ -10,8 +11,9 @@ class DiskInfo(object): self.path = None self.model = '' self.size = 0 - self.driver = None + self.driver = '' self.mdcontainer = '' + self.subsystype = '' devnode = '/dev/{0}'.format(devname) qprop = subprocess.check_output( ['udevadm', 'info', '--query=property', devnode]) @@ -46,7 +48,9 @@ class DiskInfo(object): elif (k == 'DRIVERS' and not self.driver and v not in ('"sd"', '""')): self.driver = v.replace('"', '') - if not self.driver and 'imsm' not in self.mdcontainer: + elif k == 'ATTRS{subsystype}': + self.subsystype = v.replace('"', '') + if not self.driver and 'imsm' not in self.mdcontainer and self.subsystype != 'nvm': raise Exception("No driver detected") if os.path.exists('/sys/block/{0}/size'.format(self.name)): with open('/sys/block/{0}/size'.format(self.name), 'r') as sizesrc: diff --git a/confluent_osdeploy/ubuntu20.04-diskless/profiles/default/scripts/getinstalldisk b/confluent_osdeploy/ubuntu20.04-diskless/profiles/default/scripts/getinstalldisk index 04c7708e..c954a254 100644 --- a/confluent_osdeploy/ubuntu20.04-diskless/profiles/default/scripts/getinstalldisk +++ b/confluent_osdeploy/ubuntu20.04-diskless/profiles/default/scripts/getinstalldisk @@ -1,3 +1,4 @@ +#!/usr/bin/python3 import subprocess import os @@ -10,8 +11,9 @@ class DiskInfo(object): self.path = None self.model = '' self.size = 0 - self.driver = None + self.driver = '' self.mdcontainer = '' + self.subsystype = '' devnode = '/dev/{0}'.format(devname) qprop = subprocess.check_output( ['udevadm', 'info', '--query=property', devnode]) @@ -46,7 +48,9 @@ class DiskInfo(object): elif (k == 'DRIVERS' and not self.driver and v not in ('"sd"', '""')): self.driver = v.replace('"', '') - if not self.driver and 'imsm' not in self.mdcontainer: + elif k == 'ATTRS{subsystype}': + self.subsystype = v.replace('"', '') + if not self.driver and 'imsm' not in self.mdcontainer and self.subsystype != 'nvm': raise Exception("No driver detected") if os.path.exists('/sys/block/{0}/size'.format(self.name)): with open('/sys/block/{0}/size'.format(self.name), 'r') as sizesrc: diff --git a/confluent_osdeploy/ubuntu20.04/profiles/default/scripts/getinstalldisk b/confluent_osdeploy/ubuntu20.04/profiles/default/scripts/getinstalldisk index 04c7708e..c954a254 100644 --- a/confluent_osdeploy/ubuntu20.04/profiles/default/scripts/getinstalldisk +++ b/confluent_osdeploy/ubuntu20.04/profiles/default/scripts/getinstalldisk @@ -1,3 +1,4 @@ +#!/usr/bin/python3 import subprocess import os @@ -10,8 +11,9 @@ class DiskInfo(object): self.path = None self.model = '' self.size = 0 - self.driver = None + self.driver = '' self.mdcontainer = '' + self.subsystype = '' devnode = '/dev/{0}'.format(devname) qprop = subprocess.check_output( ['udevadm', 'info', '--query=property', devnode]) @@ -46,7 +48,9 @@ class DiskInfo(object): elif (k == 'DRIVERS' and not self.driver and v not in ('"sd"', '""')): self.driver = v.replace('"', '') - if not self.driver and 'imsm' not in self.mdcontainer: + elif k == 'ATTRS{subsystype}': + self.subsystype = v.replace('"', '') + if not self.driver and 'imsm' not in self.mdcontainer and self.subsystype != 'nvm': raise Exception("No driver detected") if os.path.exists('/sys/block/{0}/size'.format(self.name)): with open('/sys/block/{0}/size'.format(self.name), 'r') as sizesrc: diff --git a/confluent_osdeploy/ubuntu22.04/profiles/default/scripts/getinstalldisk b/confluent_osdeploy/ubuntu22.04/profiles/default/scripts/getinstalldisk index 04c7708e..c954a254 100644 --- a/confluent_osdeploy/ubuntu22.04/profiles/default/scripts/getinstalldisk +++ b/confluent_osdeploy/ubuntu22.04/profiles/default/scripts/getinstalldisk @@ -1,3 +1,4 @@ +#!/usr/bin/python3 import subprocess import os @@ -10,8 +11,9 @@ class DiskInfo(object): self.path = None self.model = '' self.size = 0 - self.driver = None + self.driver = '' self.mdcontainer = '' + self.subsystype = '' devnode = '/dev/{0}'.format(devname) qprop = subprocess.check_output( ['udevadm', 'info', '--query=property', devnode]) @@ -46,7 +48,9 @@ class DiskInfo(object): elif (k == 'DRIVERS' and not self.driver and v not in ('"sd"', '""')): self.driver = v.replace('"', '') - if not self.driver and 'imsm' not in self.mdcontainer: + elif k == 'ATTRS{subsystype}': + self.subsystype = v.replace('"', '') + if not self.driver and 'imsm' not in self.mdcontainer and self.subsystype != 'nvm': raise Exception("No driver detected") if os.path.exists('/sys/block/{0}/size'.format(self.name)): with open('/sys/block/{0}/size'.format(self.name), 'r') as sizesrc: