- device = self.g.part_to_dev(self.root)
-
- self.last_part_num = self.g.part_list(device)[-1]['part_num']
+ # The commit with the following message was added in
+ # libguestfs 1.17.18:
+ #
+ # 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.
+ #
+ # Since Microsoft Sysprep removes the aforementioned key, image
+ # creation for windows can only be supported if the installed guestfs
+ # version is 1.17.18 or higher
+ if self.image.check_guestfs_version(1, 17, 18) < 0:
+ raise FatalError(
+ 'For windows support libguestfs 1.17.18 or above is required')
+
+ device = self.image.g.part_to_dev(self.root)
+
+ self.last_part_num = self.image.g.part_list(device)[-1]['part_num']