Replace use of vm.wait_for_start() with wait_for is_alive. Also, remove vm.wait_for_start() since it's not actually used anywhere else.
Signed-off-by: Chris Evich <[email protected]> Signed-off-by: Lucas Meneghel Rodrigues <[email protected]> --- client/virt/libvirt_vm.py | 35 ++++------------------------------- client/virt/virt_env_process.py | 4 ---- 2 files changed, 4 insertions(+), 35 deletions(-) diff --git a/client/virt/libvirt_vm.py b/client/virt/libvirt_vm.py index 908f12a..d3aa70a 100644 --- a/client/virt/libvirt_vm.py +++ b/client/virt/libvirt_vm.py @@ -1195,42 +1195,15 @@ class VM(virt_vm.BaseVM): return virsh_screenshot(self.name, filename, self.connect_uri) - def wait_for_start(self, count=60): - """ - Return True on successful domain start. - - Wait for a domain to start, libvirt does not block on domain - start so we need to watch for successful completion. - - @param name: VM name - @param name: Optional timeout value - """ - timeout = count - while count > 0: - # check every 5 seconds - if count % 5 == 0: - if virsh_is_alive(self.name, self.connect_uri): - session = self.wait_for_login(timeout=60) - session.close() - logging.debug("Start took %d seconds", timeout - count) - return True - count -= 1 - time.sleep(1) - logging.debug("Waiting for guest to start %d", count) - return False - - def start(self): """ Starts this VM. """ if virsh_start(self.name, self.connect_uri): - if self.wait_for_start(): - logging.debug("Started VM %s", self.name) - return True - else: - logging.error("VM %s failed to start", self.name) - return False + # Wait for the domain to be created + virt_utils.wait_for(func=self.is_alive, timeout=60, + text=("waiting for domain %s to start" % + self.name)) else: logging.error("VM %s failed to start", self.name) return False diff --git a/client/virt/virt_env_process.py b/client/virt/virt_env_process.py index ab2f77e..818b224 100644 --- a/client/virt/virt_env_process.py +++ b/client/virt/virt_env_process.py @@ -96,10 +96,6 @@ def preprocess_vm(test, params, env, name): if vm_type == "libvirt" and params.get("type") != "unattended_install": vm.params = params vm.start() - # Wait for the domain to be created - virt_utils.wait_for(func=vm.is_alive, timeout=60, - text=("waiting for domain %s to start" % - vm.name)) else: # Start the VM (or restart it if it's already up) vm.create(name, params, test.bindir, -- 1.7.7.3 _______________________________________________ Autotest mailing list [email protected] http://test.kernel.org/cgi-bin/mailman/listinfo/autotest
