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

Aline Manera alinefm at linux.vnet.ibm.com
Thu Apr 17 01:39:13 UTC 2014


On 04/13/2014 05:16 AM, lvroyce at linux.vnet.ibm.com wrote:
> 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.

The code is good but based in what we discussed in the scrum meeting 
today I think you will change it
to store the bus type on VM metadata, right?
As we will do for interface model.




More information about the Kimchi-devel mailing list