This bug is a clone of bug # 865345. That bug will be focused on using tools like libguestfs/libosinfo to select the proper drivers for each guest in an automated fashion. This bug will be a simpler method, providing users the ability to manually select driver types on a per guest basis via API calls/parameters Users should be able to choose between virtio for NIC/disk and options like e1000/rtl and IDE/SCSI Not sure if other options should be exposed in addition to those, so add'l comments welcome on those lists.
https://code.engineering.redhat.com/gerrit/#/q/status:open+project:nova+branch:rh-folsom-rhel-6-patches+topic:bug/1131306,n,z
WRT testing, by default all images will boot with virtio for harddisks, IDE for CDROMs and virtio for NICs. With this change, you can customize those by tagging glance images # glance image-update \ --property disk_bus=ide \ --property cdrom_bus=ide \ --property vif_model=e1000 \ f16-x86_64-openstack-sda Valid vif_model: 'virtio', 'ne2k_pci', 'pcnet', 'rtl8139', 'e1000' (trim to what RHEL kvm officially supports) Valid disk/cdrom bus: 'virtio', 'scsi', 'ide', 'usb' (again trim to what RHEL kvm officially supports)
Created attachment 711162 [details] list of devices supported by qemu-kvm in rhel -> Find the list of devices supported (Thanks to Rich Jones for reminding me on querying the device list) ================== $ rpm -q qemu-kvm-rhev qemu-kvm-rhev-0.12.1.2-2.355.el6_4.2.x86_64 $ #/usr/libexec/qemu-kvm -device \? 2>&1 | tee devices-list.txt ================== In short, it supports all the devices listed by Dan in comment #3
1] Version info: #-------------# $ cat /etc/redhat-release ; arch Red Hat Enterprise Linux Server release 6.4 (Santiago) x86_64 #-------------# 2] Ensure the fix is in: #-------------# $ rpm -q openstack-nova --changelog | grep 887968 - Configurable hardware models for disk/nic #887968 #-------------# $ grep hw_ -A1 -B1 /usr/lib/python2.6/site-packages/nova/virt/libvirt/blockinfo.py /usr/lib/python2.6/site-pack ages/nova/virt/libvirt/vif.py /usr/lib/python2.6/site-packages/nova/virt/libvirt/blockinfo.py- if image_meta: /usr/lib/python2.6/site-packages/nova/virt/libvirt/blockinfo.py: key = "hw_" + device_type + "_bus" /usr/lib/python2.6/site-packages/nova/virt/libvirt/blockinfo.py- disk_bus = image_meta.get('properties', {}).get(key) -- /usr/lib/python2.6/site-packages/nova/virt/libvirt/vif.py- vif_model = image_meta.get('properties', /usr/lib/python2.6/site-packages/nova/virt/libvirt/vif.py: {}).get('hw_vif_model') /usr/lib/python2.6/site-packages/nova/virt/libvirt/vif.py- if vif_model is not None: #-------------# 3] Test procedure and verification: -> list an existing image ================== $ glance image-list | grep -i fedora-16 | 13075320-004d-46f0-a35c-9d7c577610b1 | fedora-16 | qcow2 | bare | 213581824 | active | ================== -> try ide for disk_bus, cdrom_bus ; e1000 ================== $ glance image-update --property disk_bus=ide --property cdrom_bus=ide --property vif_model=e1000 fedora-16 +----------------------+--------------------------------------+ | Property | Value | +----------------------+--------------------------------------+ | Property 'cdrom_bus' | ide | | Property 'disk_bus' | ide | | Property 'vif_model' | e1000 | | checksum | 755122332caeb9f661d5c978adb8b45f | | container_format | bare | | created_at | 2013-03-16T18:43:59 | | deleted | False | | deleted_at | None | | disk_format | qcow2 | | id | 13075320-004d-46f0-a35c-9d7c577610b1 | | is_public | True | | min_disk | 0 | | min_ram | 0 | | name | fedora-16 | | owner | 57ff99aae24b4035b52177a722c4091f | | protected | False | | size | 213581824 | | status | active | | updated_at | 2013-03-16T19:06:55 | +----------------------+--------------------------------------+ [tuser1@interceptor ~(keystone_user1)]$ ================== -> try 'virtio' : ================== $ glance image-update --property disk_bus=virtio --property cdrom_bus=virtio --property vif_model=virtio fedora-16 +----------------------+--------------------------------------+ | Property | Value | +----------------------+--------------------------------------+ | Property 'cdrom_bus' | virtio | | Property 'disk_bus' | virtio | | Property 'vif_model' | virtio | | checksum | 755122332caeb9f661d5c978adb8b45f | | container_format | bare | | created_at | 2013-03-16T18:43:59 | | deleted | False | | deleted_at | None | | disk_format | qcow2 | | id | 13075320-004d-46f0-a35c-9d7c577610b1 | | is_public | True | | min_disk | 0 | | min_ram | 0 | | name | fedora-16 | | owner | 57ff99aae24b4035b52177a722c4091f | | protected | False | | size | 213581824 | | status | active | | updated_at | 2013-03-16T19:09:16 | +----------------------+--------------------------------------+ [tuser1@interceptor ~(keystone_user1)]$ -> see if it reflects ================== [tuser1@interceptor ~(keystone_user1)]$ glance image-show fedora-16 | grep -i property | Property | Value | | Property 'cdrom_bus' | virtio | | Property 'disk_bus' | virtio | | Property 'vif_model' | virtio | [tuser1@interceptor ~(keystone_user1)]$ ================== -> boot a nova instance ================== $ nova boot --flavor 2 --key_name oskey3 --image 13075320-004d-46f0-a35c-9d7c577610b1 f16-t1 ; watch nova list ================== -> Find if virtio devices reflect in the libvirt's xml ================== $ sudo virsh dumpxml instance-00000040 | grep -i virtio -A1 -B1 <source file='/export/nova/instances/instance-00000040/disk'/> <target dev='vda' bus='virtio'/> <alias name='virtio-disk0'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/> -- <target dev='vnet4'/> <model type='virtio'/> <filterref filter='nova-instance-instance-00000040-fa163e233fb4'> -- </video> <memballoon model='virtio'> <alias name='balloon0'/> [tuser1@interceptor ~(keystone_user1)]$ ==================
Updating disk_bus & vif_model as e1000 doesn't reflect in its xml properties, when a new nova instance is booted, it still reflects as virtio. For details, see below: * Firstly * (1) yes, virtio does appear to be the default, however: $ glance image-show fedora-17 | grep -i property | Property | Value | $ doesn't return the existing 'Property' attributes of the image. I wondered why, so went ahead, and added a few properties as prevoiusly, /then/ it listed the property attributes reflecting what I added. (2) You get the 'default' information by grepping the libvirt xml of a running instance (# note - there's no cdrom, hence it's not displayed here) ====== $ sudo virsh dumpxml instance-0000003e | egrep -i virtio -A1 -B1 <source file='/export/nova/instances/instance-0000003e/disk'/> <target dev='vda' bus='virtio'/> <alias name='virtio-disk0'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/> -- <target dev='vnet1'/> <model type='virtio'/> <filterref filter='nova-instance-instance-0000003e-fa163e6d6a5b'> -- </video> <memballoon model='virtio'> <alias name='balloon0'/> [tuser1@interceptor ~(keystone_user1)]$ ====== (3) This is how I imported the f17 image, by default it didn't have any properties listed: $ wget http://berrange.fedorapeople.org/images/2012-11-15/f17-x86_64-openstack-sda.qcow2 # And an f16 image too (used in the previous comment): $ wget http://berrange.fedorapeople.org/images/2012-02-29/f16-x86_64-openstack-sda.qcow2 $ glance image-create --name="fedora-16" --is-public=true --disk-format=qcow2 --container-format bare < f16-x86_64-openstack-sda.qcow2 * Secondly * test with disk_bus, cdrom_bus as ide ; vif_model as e1000. details below: -> update the "Property" attributes: ================== [tuser1@interceptor test(keystone_user1)]$ glance image-update --property disk_bus=ide --property cdrom_bus=ide --property vif_model=e1000 fedora-16 +----------------------+--------------------------------------+ | Property | Value | +----------------------+--------------------------------------+ | Property 'cdrom_bus' | ide | | Property 'disk_bus' | ide | | Property 'vif_model' | e1000 | | checksum | 755122332caeb9f661d5c978adb8b45f | | container_format | bare | | created_at | 2013-03-16T18:43:59 | | deleted | False | | deleted_at | None | | disk_format | qcow2 | | id | 13075320-004d-46f0-a35c-9d7c577610b1 | | is_public | True | | min_disk | 0 | | min_ram | 0 | | name | fedora-16 | | owner | 57ff99aae24b4035b52177a722c4091f | | protected | False | | size | 213581824 | | status | active | | updated_at | 2013-03-18T09:46:44 | +----------------------+--------------------------------------+ [tuser1@interceptor test(keystone_user1)]$ ================== -> show the "Property" attributes: ================== [tuser1@interceptor ~(keystone_user1)]$ glance image-show fedora-16 | grep -i property | Property | Value | | Property 'cdrom_bus' | ide | | Property 'disk_bus' | ide | | Property 'vif_model' | e1000 | [tuser1@interceptor ~(keystone_user1)]$ ================== -> boot a new instance: ================== [tuser1@interceptor ~(keystone_user1)]$ nova boot --flavor 1 --key_name oskey3 --image 13075320-004d-46f0-a35c-9d7c577610b1 f16-t2 ; watch nova list +------------------------+--------------------------------------+ | Property | Value | +------------------------+--------------------------------------+ | status | BUILD | | updated | 2013-03-18T10:09:12Z | | OS-EXT-STS:task_state | scheduling | | key_name | oskey3 | | image | fedora-16 | | hostId | | | OS-EXT-STS:vm_state | building | | flavor | m1.tiny | | id | f72a4737-4280-4138-97f9-5e04ad1926cb | | security_groups | [{u'name': u'default'}] | | user_id | 320ce46de7e24a75a7ff8906d7355ff7 | | name | f16-t2 | | adminPass | vg4BH7TYFifM | | tenant_id | 57ff99aae24b4035b52177a722c4091f | | created | 2013-03-18T10:09:12Z | | OS-DCF:diskConfig | MANUAL | | accessIPv4 | | | accessIPv6 | | | progress | 0 | | OS-EXT-STS:power_state | 0 | | metadata | {} | | config_drive | | +------------------------+--------------------------------------+ [tuser1@interceptor ~(keystone_user1)]$ ================== -> find out the libvirt xml instance by grepping the id of the instance: [root@interceptor qemu(keystone_user1)]# sudo grep -i f72a4737-4280-4138-97f9-5e04ad1926cb /etc/libvirt/qemu/* /etc/libvirt/qemu/instance-00000042.xml: <uuid>f72a4737-4280-4138-97f9-5e04ad1926cb</uuid> /etc/libvirt/qemu/instance-00000042.xml: <entry name='uuid'>f72a4737-4280-4138-97f9-5e04ad1926cb</entry> [root@interceptor qemu(keystone_user1)]# -> grep for device model e1000, it doesn't reflect: ================== [tuser1@interceptor ~(keystone_user1)]$ sudo virsh dumpxml instance-00000042 | egrep -i e1000 -A1 -B1 [tuser1@interceptor ~(keystone_user1)]$ ================== -> let's grep for virtio, here too, the disk bus shows as 'virtio', while we updated 'ide' as the disk_bus property: ================== [tuser1@interceptor ~(keystone_user1)]$ sudo virsh dumpxml instance-00000042 | egrep -i virtio -A1 -B1 <source file='/export/nova/instances/instance-0000003e/disk'/> <target dev='vda' bus='virtio'/> <alias name='virtio-disk0'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/> -- <target dev='vnet1'/> <model type='virtio'/> <filterref filter='nova-instance-instance-0000003e-fa163e6d6a5b'> -- </video> <memballoon model='virtio'> <alias name='balloon0'/> ================== is the above a bug ? side question: should there be a way to list 'default' properites of an image ? - if a new bug is needed here, I can file one.
Per this later bug https://bugzilla.redhat.com/show_bug.cgi?id=916176, we had to rename the image properties. So you should be testing with $ glance image-update \ --property hw_disk_bus=ide \ --property hw_cdrom_bus=ide \ --property hw_vif_model=e1000 \ f16imagedemo
Thank you Dan. VERIFIED. - Version info noted in comment #8 -> verification details: -> update the image properties: [tuser1@interceptor ~(keystone_user1)]$ glance image-update --property hw_disk_bus=ide --property hw_cdrom_bus=ide --property hw_vif_model=e1000 fedora-16 +-------------------------+--------------------------------------+ | Property | Value | +-------------------------+--------------------------------------+ | Property 'hw_cdrom_bus' | ide | | Property 'hw_disk_bus' | ide | | Property 'hw_vif_model' | e1000 | | checksum | 755122332caeb9f661d5c978adb8b45f | | container_format | bare | | created_at | 2013-03-18T20:32:45 | | deleted | False | | deleted_at | None | | disk_format | qcow2 | | id | 40497881-5a89-4c39-b3f7-5d22db2fee51 | | is_public | True | | min_disk | 0 | | min_ram | 0 | | name | fedora-16 | | owner | 57ff99aae24b4035b52177a722c4091f | | protected | False | | size | 213581824 | | status | active | | updated_at | 2013-03-18T20:32:55 | +-------------------------+--------------------------------------+ [tuser1@interceptor ~(keystone_user1)]$ -> boot any image: nova boot --flavor 1 --key_name oskey3 --image 40497881-5a89-4c39-b3f7-5d22db2fee51 f16-t4 ; watch nova list -> ensure the newly created instance is ACTIVE $ nova list | grep -i f16-t4 | 639b3bf0-cb97-466c-9f8e-3cf369077e1f | f16-t4 | ACTIVE | net1=xx.yy.zz.pp | -> grep for the ID to find out the virsh instance ID [root@interceptor ~(keystone_user1)]# grep -i 639b3bf0-cb97-466c-9f8e-3cf369077e1f /etc/libvirt/qemu/*.xml /etc/libvirt/qemu/instance-00000044.xml: <uuid>639b3bf0-cb97-466c-9f8e-3cf369077e1f</uuid> /etc/libvirt/qemu/instance-00000044.xml: <entry name='uuid'>639b3bf0-cb97-466c-9f8e-3cf369077e1f</entry> [root@interceptor ~(keystone_user1)]# -> now, dumpxml the guest's details, and grep for the hardware models. In this case, ide and e1000 for disk and net, respectively: [tuser1@interceptor ~(keystone_user1)]$ sudo virsh dumpxml instance-00000044 | egrep -i 'ide|e1000' -A1 -B1 <source file='/export/nova/instances/instance-00000044/disk'/> <target dev='hda' bus='ide'/> <alias name='ide0-0-0'/> <address type='drive' controller='0' bus='0' target='0' unit='0'/> -- </controller> <controller type='ide' index='0'> <alias name='ide0'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/> -- <target dev='vnet7'/> <model type='e1000'/> <filterref filter='nova-instance-instance-00000044-fa163e5658b2'> -- </graphics> <video> <model type='cirrus' vram='9216' heads='1'/> <alias name='video0'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/> </video> <memballoon model='virtio'>
Since the problem described in this bug report should be resolved in a recent advisory, it has been closed with a resolution of ERRATA. For information on the advisory, and where to find the updated files, follow the link below. If the solution does not work for you, open a new bug report. http://rhn.redhat.com/errata/RHSA-2013-0709.html