mirror of
https://github.com/virt-manager/virt-manager.git
synced 2025-02-25 18:55:27 -06:00
osdict: Use media_create_from_location_with_flags
If it's available, because it fixes detection of non-bootable media, like debian s390x
This commit is contained in:
parent
e77066b713
commit
9c051fe65f
@ -19,6 +19,16 @@ def _in_testsuite():
|
|||||||
return "VIRTINST_TEST_SUITE" in os.environ
|
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 #
|
# Sorting helpers #
|
||||||
###################
|
###################
|
||||||
@ -236,7 +246,7 @@ class _OSDB(object):
|
|||||||
|
|
||||||
def guess_os_by_iso(self, location):
|
def guess_os_by_iso(self, location):
|
||||||
try:
|
try:
|
||||||
media = Libosinfo.Media.create_from_location(location, None)
|
media = _media_create_from_location(location)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
log.debug("Error creating libosinfo media object: %s", str(e))
|
log.debug("Error creating libosinfo media object: %s", str(e))
|
||||||
return None
|
return None
|
||||||
|
Loading…
Reference in New Issue
Block a user