diff options
author | Fabiano FidĂȘncio <fidencio@redhat.com> | 2019-07-30 17:57:15 +0200 |
---|---|---|
committer | Cole Robinson <crobinso@redhat.com> | 2019-08-06 17:59:05 -0400 |
commit | 8ab2e49e364aea113bd90a409a7894ad18efe525 (patch) | |
tree | 2fbd94e5a116fedb8b9dc6a121351a766a8ffee4 /virtinst/osdict.py | |
parent | 3009888a0ed200a4f472dd32239a7c5157fef391 (diff) | |
download | virt-manager-8ab2e49e364aea113bd90a409a7894ad18efe525.tar.gz |
osdict: Add _get_{pre,post}_installable_drivers()
Let's add two new *private* methods to get the pre & post installable
drivers, returning a list of OsinfoDeviceDrivers;
Those are going to be used later on this series in order to get the
drivers' locations.
Reviewed-by: Cole Robinson <crobinso@redhat.com>
Signed-off-by: Fabiano FidĂȘncio <fidencio@redhat.com>
Diffstat (limited to 'virtinst/osdict.py')
-rw-r--r-- | virtinst/osdict.py | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/virtinst/osdict.py b/virtinst/osdict.py index 6fc94339..0584c655 100644 --- a/virtinst/osdict.py +++ b/virtinst/osdict.py @@ -646,6 +646,39 @@ class _OsVariant(object): return [] # pragma: no cover return list(_OsinfoIter(self._os.get_install_script_list())) + def _get_installable_drivers(self, arch): + if not self._os: + return [] + + installable_drivers = [] + device_drivers = list(_OsinfoIter(self._os.get_device_drivers())) + for device_driver in device_drivers: + if arch != "all" and device_driver.get_architecture() != arch: + continue + + installable_drivers.append(device_driver) + return installable_drivers + + def _get_pre_installable_drivers(self, arch): + installable_drivers = self._get_installable_drivers(arch) + pre_inst_drivers = [] + for driver in installable_drivers: + if not driver.get_pre_installable(): + continue + + pre_inst_drivers.append(driver) + return pre_inst_drivers + + def _get_post_installable_drivers(self, arch): + installable_drivers = self._get_installable_drivers(arch) + post_inst_drivers = [] + for driver in installable_drivers: + if driver.get_pre_installable(): + continue + + post_inst_drivers.append(driver) + return post_inst_drivers + class _OsMedia(object): def __init__(self, osinfo_media): |