def stop(self): self.domain.shutdown() # stop domain while self.domain.state()[0] != libvirt.VIR_DOMAIN_SHUTOFF: time.sleep(1) self.cdrom.cleanup()