[gnome-boxes] tests: Add libvirt_domain_get_install_state()
- From: Zeeshan Ali Khattak <zeeshanak src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-boxes] tests: Add libvirt_domain_get_install_state()
- Date: Wed, 10 Jun 2015 17:17:23 +0000 (UTC)
commit d12afb04537cbb611ad46bfaa2c7b4351830e5f4
Author: Vladimir Benes <benesv email cz>
Date: Wed Jun 10 13:23:29 2015 +0200
tests: Add libvirt_domain_get_install_state()
This function can be used for VM state checking from libvirt. It
can say whether system is installing or installed.
https://bugzilla.gnome.org/show_bug.cgi?id=748006
tests/steps/express-install.py | 23 +++++++++++++++++++++++
1 files changed, 23 insertions(+), 0 deletions(-)
---
diff --git a/tests/steps/express-install.py b/tests/steps/express-install.py
new file mode 100644
index 0000000..2b135d5
--- /dev/null
+++ b/tests/steps/express-install.py
@@ -0,0 +1,23 @@
+#!/usr/bin/python
+
+from __future__ import unicode_literals
+import libvirt
+from general import libvirt_domain_get_val, libvirt_domain_get_context
+
+def libvirt_domain_get_install_state(title):
+ state = None
+
+ conn = libvirt.openReadOnly(None)
+ doms = conn.listAllDomains()
+ for dom in doms:
+ try:
+ dom0 = conn.lookupByName(dom.name())
+ # Annoyiingly, libvirt prints its own error message here
+ except libvirt.libvirtError:
+ print("Domain %s is not running" % name)
+ ctx = libvirt_domain_get_context(dom0)
+
+ if libvirt_domain_get_val(ctx, "/domain/title") == title:
+ return libvirt_domain_get_val(ctx, "/domain/metadata/*/os-state")
+
+ return None
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]