示例#1
0
文件: test_util.py 项目: jloehel/xii
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)
示例#2
0
文件: node_component.py 项目: xii/xii
    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!")
示例#3
0
文件: node.py 项目: jloehel/xii
    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!")
示例#4
0
    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
示例#5
0
    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
示例#6
0
    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