Change in vdsm[master]: v2v: separate top level vm information to a method

shavivi at redhat.com shavivi at redhat.com
Mon Jan 12 08:22:18 UTC 2015


Shahar Havivi has uploaded a new change for review.

Change subject: v2v: separate top level vm information to a method
......................................................................

v2v: separate top level vm information to a method

for a clearer code separate general vm information to a method from vm
iteration logic.

Change-Id: I95fea56c193cdd3bb7d1ae545795a122e54a437a
Signed-off-by: Shahar Havivi <shaharh at redhat.com>
---
M vdsm/v2v.py
1 file changed, 9 insertions(+), 5 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/84/36784/1

diff --git a/vdsm/v2v.py b/vdsm/v2v.py
index 594e6dc..d2657b8 100644
--- a/vdsm/v2v.py
+++ b/vdsm/v2v.py
@@ -47,11 +47,7 @@
         for vm in conn.listAllDomains():
             root = ET.fromstring(vm.XMLDesc(0))
             params = {}
-            params['vmName'] = vm.name()
-            if vm.state()[0] == libvirt.VIR_DOMAIN_SHUTOFF:
-                params['status'] = "Down"
-            else:
-                params['status'] = "Up"
+            _add_vm_info(vm, params)
             try:
                 _add_general_info(root, params)
             except InvalidVMConfiguration as e:
@@ -83,6 +79,14 @@
                                      " %r" % unit)
 
 
+def _add_vm_info(vm, params):
+    params['vmName'] = vm.name()
+    if vm.state()[0] == libvirt.VIR_DOMAIN_SHUTOFF:
+        params['status'] = "Down"
+    else:
+        params['status'] = "Up"
+
+
 def _add_general_info(root, params):
     e = root.find('./uuid')
     if e is not None:


-- 
To view, visit http://gerrit.ovirt.org/36784
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I95fea56c193cdd3bb7d1ae545795a122e54a437a
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Shahar Havivi <shavivi at redhat.com>


More information about the vdsm-patches mailing list