Add charm config option for force_raw_images

Since Ocata, backing images are by default converted into raw format
but since Pike a problem with O_DIRECT calls and ZFS backend storage
has presented - i.e., Pike on LXD with ZFS backend storage will result
in an error about image conversion. This config option allows
that default to be changed so that Pike on LXD with ZFS will lauch
instances succesfully.

Closes-Bug: 1710994

Change-Id: Ieba15b44b4b56a356d58c4504dd259fc80e7575d
This commit is contained in:
Andrew McLeod 2017-10-20 16:55:05 -06:00
parent f21f460dc7
commit a6638ce3bf
4 changed files with 35 additions and 0 deletions

View File

@ -273,6 +273,14 @@ options:
Tell Nova which libvirt image backend to use. Supported backends are rbd,
lvm and qcow2. If no backend is specified, the Nova default (qcow2) is
used. Note that rbd imagebackend is only supported with >= Juno.
force-raw-images:
type: boolean
default: True
description: |
Force conversion of backing images to raw format. Note that the conversion
process in Pike uses O_DIRECT calls - certain file systems do not support this,
for example ZFS; e.g. if using the LXD provider with ZFS backend, this option
should be set to False.
rbd-pool:
type: string
default: 'nova'

View File

@ -244,6 +244,8 @@ class NovaComputeLibvirtContext(context.OSContextGenerator):
if config('libvirt-image-backend'):
ctxt['libvirt_images_type'] = config('libvirt-image-backend')
ctxt['force_raw_images'] = config('force-raw-images')
return ctxt

View File

@ -20,6 +20,7 @@ api_paste_config=/etc/nova/api-paste.ini
enabled_apis=osapi_compute,metadata
auth_strategy=keystone
my_ip = {{ host_ip }}
force_raw_images = {{ force_raw_images }}
{% if arch == 'aarch64' -%}
libvirt_use_virtio_for_bridges=False

View File

@ -225,6 +225,7 @@ class NovaComputeContextTests(CharmTestCase):
'kvm_hugepages': 0,
'listen_tls': 0,
'host_uuid': self.host_uuid,
'force_raw_images': True,
'reserved_host_memory': 512}, libvirt())
def test_libvirt_bin_context_no_migration(self):
@ -241,6 +242,7 @@ class NovaComputeContextTests(CharmTestCase):
'kvm_hugepages': 0,
'listen_tls': 0,
'host_uuid': self.host_uuid,
'force_raw_images': True,
'reserved_host_memory': 512}, libvirt())
def test_libvirt_bin_context_migration_tcp_listen(self):
@ -258,6 +260,7 @@ class NovaComputeContextTests(CharmTestCase):
'listen_tls': 0,
'host_uuid': self.host_uuid,
'live_migration_uri': 'qemu+ssh://%s/system',
'force_raw_images': True,
'reserved_host_memory': 512}, libvirt())
def test_libvirt_disk_cachemodes(self):
@ -275,6 +278,7 @@ class NovaComputeContextTests(CharmTestCase):
'kvm_hugepages': 0,
'listen_tls': 0,
'host_uuid': self.host_uuid,
'force_raw_images': True,
'reserved_host_memory': 512}, libvirt())
def test_libvirt_hugepages(self):
@ -293,6 +297,25 @@ class NovaComputeContextTests(CharmTestCase):
'kvm_hugepages': 1,
'listen_tls': 0,
'host_uuid': self.host_uuid,
'force_raw_images': True,
'reserved_host_memory': 512}, libvirt())
def test_libvirt_context_libvirtd_force_raw_images(self):
self.lsb_release.return_value = {'DISTRIB_CODENAME': 'zesty'}
self.os_release.return_value = 'ocata'
self.kv.return_value = FakeUnitdata(**{'host_uuid': self.host_uuid})
self.test_config.set('force-raw-images', False)
libvirt = context.NovaComputeLibvirtContext()
self.assertEqual(
{'libvirtd_opts': '',
'libvirt_user': 'libvirt',
'arch': platform.machine(),
'ksm': 'AUTO',
'kvm_hugepages': 0,
'listen_tls': 0,
'host_uuid': self.host_uuid,
'force_raw_images': False,
'reserved_host_memory': 512}, libvirt())
def test_lxd_live_migration_opts_xenial(self):
@ -396,6 +419,7 @@ class NovaComputeContextTests(CharmTestCase):
'host_uuid': self.host_uuid,
'reserved_host_memory': 1024,
'vcpu_pin_set': '^0^2',
'force_raw_images': True,
'pci_passthrough_whitelist': 'mypcidevices'}, libvirt())
def test_ksm_configs(self):