def test_wait_until_inactive(sleep): sleep.set_sleep_time(1) result = util.wait_until_inactive(FakeObject(3)) assert(result is True) assert(sleep.call_count() == 0)
def _stop_domain(self, domain, force=False): if not domain.isActive(): self.say("is already stopped") return if domain_has_state(domain, libvirt.VIR_DOMAIN_PAUSED): domain.resume() domain.shutdown() if not wait_until_inactive(domain): # Try to force off domain.destroy() if not wait_until_inactive(domain): self.warn("could not be stopped") return self.success("stopped!")
def _stop_network(self, net): self.childs_run("stop") if not net.isActive(): self.say("is already stopped") return net.destroy() if not util.wait_until_inactive(net): self.warn("could not stop network") return self.say("stopped!") return
def _stop_network(self, net): self.say("stopping...") self.each_attribute("stop") if not net.isActive(): self.say("is already stopped") return net.destroy() if not util.wait_until_inactive(net): self.warn("could not stop network") return self.success("stopped!") return