[virt-tools-list] [python-virtinst 2/2] virt-install: Create OS dict from libosinfo

Cole Robinson crobinso at redhat.com
Thu Jul 7 14:09:04 UTC 2011


On 07/01/2011 04:32 PM, Zeeshan Ali (Khattak) wrote:
> From: "Zeeshan Ali (Khattak)" <zeeshanak at gnome.org>
> 
> Issues:
> 
> * Some info is still hard-coded
> 
> * We lose the following information:
>   * distro
>   * sortby
> 
> * I get the following error from pylint:
> 
>   E: 25: No name 'Libosinfo' in module 'gi.repository'
> 
>   Apparently pylint doesn't know about how introspection works.
> 
> * libosinfo is not yet in a stage that we can add a dependency on
>   it so this patch must not be merged into git master yet.
> ---
>  virtinst/osdict.py |  401 +++++++++++++---------------------------------------
>  1 files changed, 100 insertions(+), 301 deletions(-)
>

Any idea if gobject introspection is in RHEL6? If it isn't, what would
it take to get libosinfo + python bindings in RHEL6?

I'm afraid of deleting the existing OS_TYPES data if we won't ever have
libosinfo bindings in RHEL6, since if RHEL5 is any indication we will be
rebasing python-virtinst for quite a few RHEL6 releases, and a hard
dependency on libosinfo could cause pain later.

> diff --git a/virtinst/osdict.py b/virtinst/osdict.py
> index a520faa..040bd24 100644
> --- a/virtinst/osdict.py
> +++ b/virtinst/osdict.py
> @@ -22,6 +22,7 @@
>  import support
>  from VirtualDevice import VirtualDevice
>  from virtinst import _virtinst as _
> +from gi.repository import Libosinfo as libosinfo
>  
>  HV_ALL = "all"
>  
> @@ -36,31 +37,42 @@ INPUT = VirtualDevice.VIRTUAL_DEV_INPUT
>  SOUND = VirtualDevice.VIRTUAL_DEV_AUDIO
>  VIDEO = VirtualDevice.VIRTUAL_DEV_VIDEO
>  
> -VIRTIO_DISK = {
> -    "bus" : [
> -        (support.SUPPORT_CONN_HV_VIRTIO, "virtio"),
> -    ]
> -}
> -
> -VIRTIO_NET = {
> -    "model" : [
> -        (support.SUPPORT_CONN_HV_VIRTIO, "virtio"),
> -    ]
> -}
> -
> -USB_TABLET = {
> -    "type" : [
> -        (HV_ALL, "tablet"),
> -    ],
> -    "bus"  : [
> -        (HV_ALL, "usb"),
> -    ]
> -}
> -
> -VGA_VIDEO = {
> -    "model_type": [
> -        (HV_ALL, "vga"),
> -    ]
> +DEVICES = {
> +    "http://pciids.sourceforge.net/v2.2/pci.ids/1af4/1001": {
> +        "bus" : [
> +            (support.SUPPORT_CONN_HV_VIRTIO, "virtio"),
> +        ]
> +    },
> +    "http://pciids.sourceforge.net/v2.2/pci.ids/1af4/1000": {
> +        "model" : [
> +                (support.SUPPORT_CONN_HV_VIRTIO, "virtio"),
> +        ]
> +    },
> +    "http://www.linux-usb.org/usb.ids/80ee/0021": {
> +        "type" : [
> +                (HV_ALL, "tablet"),
> +        ],
> +        "bus"  : [
> +                (HV_ALL, "usb"),
> +        ]
> +    },
> +    "http://pciids.sourceforge.net/v2.2/pci.ids/1234/1111": {
> +        "model_type": [
> +                (HV_ALL, "vga"),
> +        ]
> +    },
> +    "http://pciids.sourceforge.net/v2.2/pci.ids/10ec/8029": {
> +        "model" : [ (HV_ALL, "ne2k_pci")
> +        ]
> +    },
> +    "http://pciids.sourceforge.net/v2.2/pci.ids/8086/100e": {
> +        "model" : [ (HV_ALL, "e1000")
> +        ]
> +    },
> +    "http://pciids.sourceforge.net/v2.2/pci.ids/1022/2000": {
> +        "model" : [ (HV_ALL, "pcnet")
> +        ]
> +    }
>  }
>  

Would be nice here to have a comment for each entry indicating what
device type it maps to in the guest XML, it was a bit more clear before.
Example:

   # virtio network
   "http://pciids.sourceforge.net/v2.2/pci.ids/1af4/1000": {
       "model" : [
               (support.SUPPORT_CONN_HV_VIRTIO, "virtio"),
       ]
   },

Otherwise looks fine, provided existing virtinst tests pass, and python
setup.py sdist doesn't generate a different OS list in the man page.

Thanks,
Cole




More information about the virt-tools-list mailing list