[Kimchi-devel] [PATCH 3/7] fix: store distro and version information when creating vm

lvroyce at linux.vnet.ibm.com lvroyce at linux.vnet.ibm.com
Sun Apr 13 08:16:02 UTC 2014


From: Royce Lv <lvroyce at linux.vnet.ibm.com>

We need to decide which cdrom bus and disk bus to use
on different architecture and different guest distros.
So record these information for attach disk to decide bus type.

Signed-off-by: Royce Lv <lvroyce at linux.vnet.ibm.com>
---
 src/kimchi/model/vms.py | 23 +++++++++++++----------
 1 file changed, 13 insertions(+), 10 deletions(-)

diff --git a/src/kimchi/model/vms.py b/src/kimchi/model/vms.py
index 2425a43..94e7d79 100644
--- a/src/kimchi/model/vms.py
+++ b/src/kimchi/model/vms.py
@@ -178,16 +178,19 @@ class VMsModel(object):
         t.validate()
 
         # Store the icon for displaying later
-        icon = t.info.get('icon')
-        if icon:
-            try:
-                with self.objstore as session:
-                    session.store('vm', vm_uuid, {'icon': icon})
-            except Exception as e:
-                # It is possible to continue Kimchi executions without store
-                # vm icon info
-                kimchi_log.error('Error trying to update database with guest '
-                                 'icon information due error: %s', e.message)
+        icon = t.info.get('icon', 'images/icon-vm.png')
+        distro = t.info.get('os_distro', 'unknown')
+        version = t.info.get('os_version', 'unknown')
+        try:
+            with self.objstore as session:
+                session.store(
+                    'vm', vm_uuid,
+                    {'icon': icon, 'distro': distro, 'version': version})
+        except Exception as e:
+            # It is possible to continue Kimchi executions without store
+            # vm icon info
+            kimchi_log.error('Error trying to update database with guest '
+                             'icon information due error: %s', e.message)
 
         # If storagepool is SCSI, volumes will be LUNs and must be passed by
         # the user from UI or manually.
-- 
1.8.3.2




More information about the Kimchi-devel mailing list