summaryrefslogtreecommitdiff
path: root/virtinst/osdict.py
diff options
context:
space:
mode:
authorCole Robinson <crobinso@redhat.com>2019-08-01 19:15:08 -0400
committerCole Robinson <crobinso@redhat.com>2019-08-01 19:15:08 -0400
commit9c051fe65f9435a8a0ad82a58843e6e81d2e45c2 (patch)
tree721ad48d5cd0d51543f549caaf134a40d78ef594 /virtinst/osdict.py
parente77066b713e99a6e4499bdde5a39a4fec897797a (diff)
downloadvirt-manager-9c051fe65f9435a8a0ad82a58843e6e81d2e45c2.tar.gz
osdict: Use media_create_from_location_with_flags
If it's available, because it fixes detection of non-bootable media, like debian s390x
Diffstat (limited to 'virtinst/osdict.py')
-rw-r--r--virtinst/osdict.py12
1 files changed, 11 insertions, 1 deletions
diff --git a/virtinst/osdict.py b/virtinst/osdict.py
index 9ec0e201..c4b08f2f 100644
--- a/virtinst/osdict.py
+++ b/virtinst/osdict.py
@@ -19,6 +19,16 @@ def _in_testsuite():
return "VIRTINST_TEST_SUITE" in os.environ
+def _media_create_from_location(location):
+ if not hasattr(Libosinfo.Media, "create_from_location_with_flags"):
+ return Libosinfo.Media.create_from_location(location, None)
+
+ # We prefer this API, because by default it will not
+ # reject non-bootable media, like debian s390x
+ # pylint: disable=no-member
+ return Libosinfo.Media.create_from_location_with_flags(location, None, 0)
+
+
###################
# Sorting helpers #
###################
@@ -236,7 +246,7 @@ class _OSDB(object):
def guess_os_by_iso(self, location):
try:
- media = Libosinfo.Media.create_from_location(location, None)
+ media = _media_create_from_location(location)
except Exception as e:
log.debug("Error creating libosinfo media object: %s", str(e))
return None