Commit 1c69db7c authored by Nikos Skalkotos's avatar Nikos Skalkotos
Browse files

windows: Fix the valid VirtIO directory check

Rewrite the virtio_dir_check function that checks if a given directory
is indeed hosting VirtIO drivers.
parent 17cf1338
......@@ -86,13 +86,13 @@ KMS_CLIENT_SETUP_KEYS = {
"Windows Server 2008 for Itanium-Based Systems":
"viostor", # "VirtIO SCSI controller"
"vioscsi", # "VirtIO SCSI pass-through controller"
"vioser", # "VirtIO Serial Driver"
"netkvm", # "VirtIO Ethernet Adapter"
"balloon", # "VirtIO Balloon Driver
"viorng"] # "VirtIO RNG Driver"
"viorng") # "VirtIO RNG Driver"
def virtio_dir_check(dirname):
......@@ -102,18 +102,19 @@ def virtio_dir_check(dirname):
if not dirname:
return "" # value not set
critical = ('viostor', 'netkvm')
extension = ('cat', 'inf', 'sys')
missing = []
ext = ('cat', 'inf', 'sys')
files = set(os.listdir(dirname))
for nam in ["%s.%s" % (b, e) for b in critical for e in extension]:
if nam not in files:
# Check files in a case insensitive manner
files = set([f.lower() for f in os.listdir(dirname)])
found = False
for cat, inf, sys in [["%s.%s" % (b, e) for e in ext] for b in VIRTIO]:
if cat in files and inf in files and sys in files:
found = True
if not found:
raise ValueError("Invalid VirtIO directory. No VirtIO driver found")
if len(missing):
raise ValueError("Invalid VirtIO directory. The following files were "
"not found: %s" % ", ".join(missing))
return dirname
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment