Revision 6342c1ab

b/image_creator/os_type/windows.py
318 318
            self.out.success("started (console on vnc display: %d)." % display)
319 319

  
320 320
            self.out.output("Waiting for OS to boot ...", False)
321
            if not self._wait_on_file(monitor, token):
322
                raise FatalError("Windows booting timed out.")
323
            else:
324
                time.sleep(10)  # Just to be sure everything is up
325
                self.out.success('done')
321
            self._wait_vm_boot(vm, monitor, token)
322
            self.out.success('done')
326 323

  
327 324
            self.out.output("Disabling automatic logon ...", False)
328 325
            self._disable_autologon()
......
425 422
        """Shuts down the windows VM"""
426 423
        self._guest_exec(r'shutdown /s /t 5')
427 424

  
428
    def _wait_on_file(self, fname, msg):
429
        """Wait until a message appears on a file"""
425
    def _wait_vm_boot(self, vm, fname, msg):
426
        """Wait until a message appears on a file or the vm process dies"""
430 427

  
431 428
        for i in range(BOOT_TIMEOUT):
432 429
            time.sleep(1)
......
434 431
                for line in f:
435 432
                    if line.startswith(msg):
436 433
                        return True
437
        return False
434
            if not vm.process.alive:
435
                raise FatalError("Windows VM died unexpectedly!")
436
        raise FatalError("Windows booting timed out!")
438 437

  
439 438
    def _disable_autologon(self):
440 439
        """Disable automatic logon on the windows image"""

Also available in: Unified diff