From aca3e6508c7ae3f5ee4f440c27c75325e5352e11 Mon Sep 17 00:00:00 2001 From: Nikos Skalkotos Date: Fri, 2 Aug 2013 13:44:12 +0300 Subject: [PATCH 1/1] Raise FatalError for guestfs < 1.17.18 in windows If the media is windows and guestfs version is less than 1.17.18 raise a Fatal Error. The versions below this have a bug and inspect_os will fail if the HKLM\SYSTEM\MountedDevices registry key is missing. This key gets deleted by Microsoft Sysprep --- image_creator/os_type/windows.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/image_creator/os_type/windows.py b/image_creator/os_type/windows.py index a5ef78a..9b5d79f 100644 --- a/image_creator/os_type/windows.py +++ b/image_creator/os_type/windows.py @@ -116,6 +116,16 @@ class Windows(OSBase): def __init__(self, image, **kargs): super(Windows, self).__init__(image, **kargs) + # This commit was added in libguestfs 1.17.18 and is critical because + # Microsoft Sysprep removes this key: + # + # When a Windows guest doesn't have a HKLM\SYSTEM\MountedDevices node, + # inspection fails. However inspection should not completely fail just + # because we cannot get the drive letter mapping from a guest. + if check_guestfs_version(self.image.g, 1, 17, 18) < 0: + raise FatalError( + 'For windows support libguestfs 1.17.17 or above is needed') + device = self.image.g.part_to_dev(self.root) self.last_part_num = self.image.g.part_list(device)[-1]['part_num'] -- 1.7.10.4