From: Nikos Skalkotos Date: Fri, 2 Aug 2013 12:40:36 +0000 (+0300) Subject: Print a meaningful msg if windows shrinking fails X-Git-Tag: 0.5~1^2~5 X-Git-Url: https://code.grnet.gr/git/snf-image-creator/commitdiff_plain/df36e2a4214bf9df7af7fb1b39f78e3baef0cbca?ds=sidebyside Print a meaningful msg if windows shrinking fails --- diff --git a/image_creator/os_type/windows.py b/image_creator/os_type/windows.py index 9b5d79f..5d56a05 100644 --- a/image_creator/os_type/windows.py +++ b/image_creator/os_type/windows.py @@ -124,7 +124,7 @@ class Windows(OSBase): # 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') + 'For windows support libguestfs 1.17.18 or above is needed') device = self.image.g.part_to_dev(self.root) @@ -275,8 +275,12 @@ class Windows(OSBase): r'IF NOT !ERRORLEVEL! EQU 0 EXIT /B 1 & ' + r'DEL /Q %SCRIPT%"') - stdout, stderr, rc = self._guest_exec(cmd) + stdout, stderr, rc = self._guest_exec(cmd, False) + if rc != 0: + FatalError("Shrinking failed. Please make sure the media is " + "defraged with a command like this: " + "`Defrag.exe /U /X /W'") for line in stdout.splitlines(): if line.find('shrunk') >= 0: self.out.output(line)