aio - dianaclarke/openstack-notes GitHub Wiki

Before:

  • When preallocate_images isn't set in the [DEFAULT] section of nova.conf, io="native" should not appear in libvirt.xml
$ grep preallocate /etc/nova/nova.conf
(no matches)

$ grep native /opt/stack/data/nova/instances/2e87588d-a1eb-4659-b15b-84484f9ff15e/libvirt.xml 
(no matches)
    <disk type="file" device="disk">
      <driver name="qemu" type="qcow2" cache="none"/>
      <source file="/opt/stack/data/nova/instances/2e87588d-a1eb-4659-b15b-84484f9ff15e/disk"/>
      <target bus="virtio" dev="vda"/>
    </disk>
    <disk type="file" device="cdrom">
      <driver name="qemu" type="raw" cache="none"/>
      <source file="/opt/stack/data/nova/instances/2e87588d-a1eb-4659-b15b-84484f9ff15e/disk.config"/>
      <target bus="ide" dev="hdd"/>
    </disk>

After:

  • When preallocate_images is set to 'space' the [DEFAULT] section of nova.conf, io="native" should appear in libvirt.xml for certain image backends
$ grep preallocate /etc/nova/nova.conf 
preallocate_images = space

$ grep native /opt/stack/data/nova/instances/1a3c4a79-7094-49c1-b30f-e3e57b55b8b6/libvirt.xml
      <driver name="qemu" type="qcow2" cache="none" io="native"/>
      <driver name="qemu" type="raw" cache="none" io="native"/>
    <disk type="file" device="disk">
      <driver name="qemu" type="qcow2" cache="none" io="native"/>
      <source file="/opt/stack/data/nova/instances/1a3c4a79-7094-49c1-b30f-e3e57b55b8b6/disk"/>
      <target bus="virtio" dev="vda"/>
    </disk>
    <disk type="file" device="cdrom">
      <driver name="qemu" type="raw" cache="none" io="native"/>
      <source file="/opt/stack/data/nova/instances/1a3c4a79-7094-49c1-b30f-e3e57b55b8b6/disk.config"/>
      <target bus="ide" dev="hdd"/>
    </disk>

File dumps:

  • Full libvirt.xml (before)
$ cat /opt/stack/data/nova/instances/2e87588d-a1eb-4659-b15b-84484f9ff15e/libvirt.xml
<domain type="qemu">
  <uuid>2e87588d-a1eb-4659-b15b-84484f9ff15e</uuid>
  <name>instance-00000002</name>
  <memory>65536</memory>
  <vcpu>1</vcpu>
  <metadata>
    <nova:instance xmlns:nova="http://openstack.org/xmlns/libvirt/nova/1.0">
      <nova:package version="13.0.1"/>
      <nova:name>instance-2</nova:name>
      <nova:creationTime>2016-04-15 22:02:23</nova:creationTime>
      <nova:flavor name="m1.nano">
        <nova:memory>64</nova:memory>
        <nova:disk>0</nova:disk>
        <nova:swap>0</nova:swap>
        <nova:ephemeral>0</nova:ephemeral>
        <nova:vcpus>1</nova:vcpus>
      </nova:flavor>
      <nova:owner>
        <nova:user uuid="d83e39dacfc549449c58987c3c99d379">admin</nova:user>
        <nova:project uuid="162df2e9319041029c8886f07911e9c7">admin</nova:project>
      </nova:owner>
      <nova:root type="image" uuid="ec3cbb5e-0ce8-4faa-96bd-cfa385122d9a"/>
    </nova:instance>
  </metadata>
  <sysinfo type="smbios">
    <system>
      <entry name="manufacturer">OpenStack Foundation</entry>
      <entry name="product">OpenStack Nova</entry>
      <entry name="version">13.0.1</entry>
      <entry name="serial">5cd17f94-687c-43ff-9ed2-733913575a4e</entry>
      <entry name="uuid">2e87588d-a1eb-4659-b15b-84484f9ff15e</entry>
      <entry name="family">Virtual Machine</entry>
    </system>
  </sysinfo>
  <os>
    <type>hvm</type>
    <kernel>/opt/stack/data/nova/instances/2e87588d-a1eb-4659-b15b-84484f9ff15e/kernel</kernel>
    <initrd>/opt/stack/data/nova/instances/2e87588d-a1eb-4659-b15b-84484f9ff15e/ramdisk</initrd>
    <cmdline>root=/dev/vda console=tty0 console=ttyS0 no_timer_check</cmdline>
    <smbios mode="sysinfo"/>
  </os>
  <features>
    <acpi/>
    <apic/>
  </features>
  <cputune>
    <shares>1024</shares>
  </cputune>
  <clock offset="utc"/>
  <cpu match="exact">
    <topology sockets="1" cores="1" threads="1"/>
  </cpu>
  <devices>
    <disk type="file" device="disk">
      <driver name="qemu" type="qcow2" cache="none"/>
      <source file="/opt/stack/data/nova/instances/2e87588d-a1eb-4659-b15b-84484f9ff15e/disk"/>
      <target bus="virtio" dev="vda"/>
    </disk>
    <disk type="file" device="cdrom">
      <driver name="qemu" type="raw" cache="none"/>
      <source file="/opt/stack/data/nova/instances/2e87588d-a1eb-4659-b15b-84484f9ff15e/disk.config"/>
      <target bus="ide" dev="hdd"/>
    </disk>
    <interface type="bridge">
      <mac address="fa:16:3e:cc:82:4f"/>
      <model type="virtio"/>
      <driver name="qemu"/>
      <source bridge="br100"/>
      <filterref filter="nova-instance-instance-00000002-fa163ecc824f"/>
    </interface>
    <serial type="file">
      <source path="/opt/stack/data/nova/instances/2e87588d-a1eb-4659-b15b-84484f9ff15e/console.log"/>
    </serial>
    <serial type="pty"/>
    <graphics type="vnc" autoport="yes" keymap="en-us" listen="127.0.0.1"/>
    <video>
      <model type="cirrus"/>
    </video>
    <memballoon model="virtio">
      <stats period="10"/>
    </memballoon>
  </devices>
</domain>
  • Full nova.conf (before)
$ cat /etc/nova/nova.conf 

[DEFAULT]
flat_interface = ens3
flat_network_bridge = br100
vlan_interface = ens3
public_interface = br100
network_manager = nova.network.manager.FlatDHCPManager
firewall_driver = nova.virt.libvirt.firewall.IptablesFirewallDriver
compute_driver = libvirt.LibvirtDriver
default_ephemeral_format = ext4
dhcpbridge_flagfile = /etc/nova/nova-dhcpbridge.conf
graceful_shutdown_timeout = 5
metadata_workers = 2
osapi_compute_workers = 2
rpc_backend = rabbit
logging_exception_prefix = %(color)s%(asctime)s.%(msecs)03d TRACE %(name)s %(instance)s
logging_debug_format_suffix = from (pid=%(process)d) %(funcName)s %(pathname)s:%(lineno)d
logging_default_format_string = %(asctime)s.%(msecs)03d %(color)s%(levelname)s %(name)s [-%(color)s] %(instance)s%(color)s%(message)s
logging_context_format_string = %(asctime)s.%(msecs)03d %(color)s%(levelname)s %(name)s [%(request_id)s %(user_name)s %(project_name)s%(color)s] %(instance)s%(color)s%(message)s
force_config_drive = True
instances_path = /opt/stack/data/nova/instances
state_path = /opt/stack/data/nova
enabled_apis = osapi_compute,metadata
bindir = /usr/bin
s3_listen = 0.0.0.0
metadata_listen = 0.0.0.0
osapi_compute_listen = 0.0.0.0
instance_name_template = instance-%08x
my_ip = 192.168.122.82
s3_port = 3333
s3_host = 192.168.122.82
default_floating_pool = public
force_dhcp_release = True
scheduler_default_filters = RetryFilter,AvailabilityZoneFilter,RamFilter,DiskFilter,ComputeFilter,ComputeCapabilitiesFilter,ImagePropertiesFilter,ServerGroupAntiAffinityFilter,ServerGroupAffinityFilter,SameHostFilter,DifferentHostFilter
scheduler_driver = filter_scheduler
rootwrap_config = /etc/nova/rootwrap.conf
api_paste_config = /etc/nova/api-paste.ini
allow_resize_to_same_host = True
debug = True

[database]
connection = mysql+pymysql://root:[email protected]/nova?charset=utf8

[api_database]
connection = mysql+pymysql://root:[email protected]/nova_api?charset=utf8

[privsep_osbrick]
helper_command = sudo nova-rootwrap $rootwrap_config privsep-helper --config-file /etc/nova/nova.conf

[keystone_authtoken]
memcached_servers = 192.168.122.82:11211
signing_dir = /var/cache/nova
cafile = /opt/stack/data/ca-bundle.pem
auth_uri = http://192.168.122.82:5000
project_domain_id = default
project_name = service
user_domain_id = default
password = 123456
username = nova
auth_url = http://192.168.122.82:35357
auth_type = password

[oslo_concurrency]
lock_path = /opt/stack/data/nova

[vnc]
xvpvncproxy_host = 0.0.0.0
novncproxy_host = 0.0.0.0
vncserver_proxyclient_address = 127.0.0.1
vncserver_listen = 127.0.0.1
enabled = true
xvpvncproxy_base_url = http://192.168.122.82:6081/console
novncproxy_base_url = http://192.168.122.82:6080/vnc_auto.html

[spice]
enabled = false
html5proxy_base_url = http://192.168.122.82:6082/spice_auto.html

[oslo_messaging_rabbit]
rabbit_userid = stackrabbit
rabbit_password = 123456
rabbit_hosts = 192.168.122.82

[glance]
api_servers = http://192.168.122.82:9292

[conductor]
workers = 2

[cinder]
os_region_name = RegionOne

[libvirt]
inject_partition = -2
live_migration_uri = qemu+ssh://diana@%s/system
use_usb_tablet = False
cpu_mode = none
virt_type = qemu

[keymgr]
fixed_key = bddef4338a9d7f604c71431fe38dbc6c4d994c71beb359294224c64532281e30
  • Full libvirt.xml (after)
$ cat /opt/stack/data/nova/instances/1a3c4a79-7094-49c1-b30f-e3e57b55b8b6/libvirt.xml 
<domain type="qemu">
  <uuid>1a3c4a79-7094-49c1-b30f-e3e57b55b8b6</uuid>
  <name>instance-00000001</name>
  <memory>65536</memory>
  <vcpu>1</vcpu>
  <metadata>
    <nova:instance xmlns:nova="http://openstack.org/xmlns/libvirt/nova/1.0">
      <nova:package version="13.0.1"/>
      <nova:name>instance-1</nova:name>
      <nova:creationTime>2016-04-15 21:17:32</nova:creationTime>
      <nova:flavor name="m1.nano">
        <nova:memory>64</nova:memory>
        <nova:disk>0</nova:disk>
        <nova:swap>0</nova:swap>
        <nova:ephemeral>0</nova:ephemeral>
        <nova:vcpus>1</nova:vcpus>
      </nova:flavor>
      <nova:owner>
        <nova:user uuid="d83e39dacfc549449c58987c3c99d379">admin</nova:user>
        <nova:project uuid="162df2e9319041029c8886f07911e9c7">admin</nova:project>
      </nova:owner>
      <nova:root type="image" uuid="ec3cbb5e-0ce8-4faa-96bd-cfa385122d9a"/>
    </nova:instance>
  </metadata>
  <sysinfo type="smbios">
    <system>
      <entry name="manufacturer">OpenStack Foundation</entry>
      <entry name="product">OpenStack Nova</entry>
      <entry name="version">13.0.1</entry>
      <entry name="serial">5cd17f94-687c-43ff-9ed2-733913575a4e</entry>
      <entry name="uuid">1a3c4a79-7094-49c1-b30f-e3e57b55b8b6</entry>
      <entry name="family">Virtual Machine</entry>
    </system>
  </sysinfo>
  <os>
    <type>hvm</type>
    <kernel>/opt/stack/data/nova/instances/1a3c4a79-7094-49c1-b30f-e3e57b55b8b6/kernel</kernel>
    <initrd>/opt/stack/data/nova/instances/1a3c4a79-7094-49c1-b30f-e3e57b55b8b6/ramdisk</initrd>
    <cmdline>root=/dev/vda console=tty0 console=ttyS0 no_timer_check</cmdline>
    <smbios mode="sysinfo"/>
  </os>
  <features>
    <acpi/>
    <apic/>
  </features>
  <cputune>
    <shares>1024</shares>
  </cputune>
  <clock offset="utc"/>
  <cpu match="exact">
    <topology sockets="1" cores="1" threads="1"/>
  </cpu>
  <devices>
    <disk type="file" device="disk">
      <driver name="qemu" type="qcow2" cache="none" io="native"/>
      <source file="/opt/stack/data/nova/instances/1a3c4a79-7094-49c1-b30f-e3e57b55b8b6/disk"/>
      <target bus="virtio" dev="vda"/>
    </disk>
    <disk type="file" device="cdrom">
      <driver name="qemu" type="raw" cache="none" io="native"/>
      <source file="/opt/stack/data/nova/instances/1a3c4a79-7094-49c1-b30f-e3e57b55b8b6/disk.config"/>
      <target bus="ide" dev="hdd"/>
    </disk>
    <interface type="bridge">
      <mac address="fa:16:3e:fd:09:5a"/>
      <model type="virtio"/>
      <driver name="qemu"/>
      <source bridge="br100"/>
      <filterref filter="nova-instance-instance-00000001-fa163efd095a"/>
    </interface>
    <serial type="file">
      <source path="/opt/stack/data/nova/instances/1a3c4a79-7094-49c1-b30f-e3e57b55b8b6/console.log"/>
    </serial>
    <serial type="pty"/>
    <graphics type="vnc" autoport="yes" keymap="en-us" listen="127.0.0.1"/>
    <video>
      <model type="cirrus"/>
    </video>
    <memballoon model="virtio">
      <stats period="10"/>
    </memballoon>
  </devices>
</domain>
  • Full nova.conf (after)
$ cat /etc/nova/nova.conf 

[DEFAULT]
flat_interface = ens3
flat_network_bridge = br100
vlan_interface = ens3
public_interface = br100
network_manager = nova.network.manager.FlatDHCPManager
firewall_driver = nova.virt.libvirt.firewall.IptablesFirewallDriver
compute_driver = libvirt.LibvirtDriver
default_ephemeral_format = ext4
dhcpbridge_flagfile = /etc/nova/nova-dhcpbridge.conf
graceful_shutdown_timeout = 5
metadata_workers = 2
osapi_compute_workers = 2
rpc_backend = rabbit
logging_exception_prefix = %(color)s%(asctime)s.%(msecs)03d TRACE %(name)s %(instance)s
logging_debug_format_suffix = from (pid=%(process)d) %(funcName)s %(pathname)s:%(lineno)d
logging_default_format_string = %(asctime)s.%(msecs)03d %(color)s%(levelname)s %(name)s [-%(color)s] %(instance)s%(color)s%(message)s
logging_context_format_string = %(asctime)s.%(msecs)03d %(color)s%(levelname)s %(name)s [%(request_id)s %(user_name)s %(project_name)s%(color)s] %(instance)s%(color)s%(message)s
force_config_drive = True
instances_path = /opt/stack/data/nova/instances
state_path = /opt/stack/data/nova
enabled_apis = osapi_compute,metadata
bindir = /usr/bin
s3_listen = 0.0.0.0
metadata_listen = 0.0.0.0
osapi_compute_listen = 0.0.0.0
instance_name_template = instance-%08x
my_ip = 192.168.122.82
s3_port = 3333
s3_host = 192.168.122.82
default_floating_pool = public
force_dhcp_release = True
scheduler_default_filters = RetryFilter,AvailabilityZoneFilter,RamFilter,DiskFilter,ComputeFilter,ComputeCapabilitiesFilter,ImagePropertiesFilter,ServerGroupAntiAffinityFilter,ServerGroupAffinityFilter,SameHostFilter,DifferentHostFilter
scheduler_driver = filter_scheduler
rootwrap_config = /etc/nova/rootwrap.conf
api_paste_config = /etc/nova/api-paste.ini
allow_resize_to_same_host = True
debug = True
preallocate_images = space

[database]
connection = mysql+pymysql://root:[email protected]/nova?charset=utf8

[api_database]
connection = mysql+pymysql://root:[email protected]/nova_api?charset=utf8

[privsep_osbrick]
helper_command = sudo nova-rootwrap $rootwrap_config privsep-helper --config-file /etc/nova/nova.conf

[keystone_authtoken]
memcached_servers = 192.168.122.82:11211
signing_dir = /var/cache/nova
cafile = /opt/stack/data/ca-bundle.pem
auth_uri = http://192.168.122.82:5000
project_domain_id = default
project_name = service
user_domain_id = default
password = 123456
username = nova
auth_url = http://192.168.122.82:35357
auth_type = password

[oslo_concurrency]
lock_path = /opt/stack/data/nova

[vnc]
xvpvncproxy_host = 0.0.0.0
novncproxy_host = 0.0.0.0
vncserver_proxyclient_address = 127.0.0.1
vncserver_listen = 127.0.0.1
enabled = true
xvpvncproxy_base_url = http://192.168.122.82:6081/console
novncproxy_base_url = http://192.168.122.82:6080/vnc_auto.html

[spice]
enabled = false
html5proxy_base_url = http://192.168.122.82:6082/spice_auto.html

[oslo_messaging_rabbit]
rabbit_userid = stackrabbit
rabbit_password = 123456
rabbit_hosts = 192.168.122.82

[glance]
api_servers = http://192.168.122.82:9292

[conductor]
workers = 2

[cinder]
os_region_name = RegionOne

[libvirt]
inject_partition = -2
live_migration_uri = qemu+ssh://diana@%s/system
use_usb_tablet = False
cpu_mode = none
virt_type = qemu

[keymgr]
fixed_key = bddef4338a9d7f604c71431fe38dbc6c4d994c71beb359294224c64532281e30

Notes from Kashyap

If you'd like to test manually, you'd need to have an NFS as a Cinder backend environment. 
To do that, FWIW, I normally use this DevStack configuration that automatically creates an NFS server, and points the Cinder volumes to be on that NFS server:
https://kashyapc.fedorapeople.org/virt/openstack/NFS-as-Cinder-backend-local.conf
Then, you can simply create a Cinder volume, attach it to a Nova instance, then you could check the guest XML for it should have io="native" attribute as part of the 'driver' element.
Not sure if there's some automated setup for RHEL that creates you NFS as a Cinder backend.
If you like to test this:
(1) Setup 'preallocate_images = space' in nova.conf (this means: " storage is fully allocated at instance start")
(2) Boot a Nova instance, with either 'raw' or 'qcow2' disk image formats
(3) Verify that the instance guest XML (`sudo virsh dumpxml $Instance-UUID`) has io="native".  It would be something like the below for a pre-allocated raw image:
[...]
<disk type='file' device='disk'>
   <driver name='qemu' type='raw' io='native'/>
[...]
⚠️ **GitHub.com Fallback** ⚠️