Merge "Exposes new ksm config directive."
This commit is contained in:
commit
a0c736680d
@ -308,6 +308,13 @@ options:
|
|||||||
For a systemd system (wily and later) the prefered approach is to enable
|
For a systemd system (wily and later) the prefered approach is to enable
|
||||||
hugepages via kernel parameters set in MAAS and systemd will mount them
|
hugepages via kernel parameters set in MAAS and systemd will mount them
|
||||||
automatically.
|
automatically.
|
||||||
|
ksm:
|
||||||
|
type: string
|
||||||
|
default: "AUTO"
|
||||||
|
description: |
|
||||||
|
Set to 1 to enable KSM, 0 to disable KSM, and AUTO to use default settings.
|
||||||
|
Please note that the AUTO value works for qemu 2.2+ (> Kilo), older
|
||||||
|
releases will be set to 1 as default.
|
||||||
action-managed-upgrade:
|
action-managed-upgrade:
|
||||||
type: boolean
|
type: boolean
|
||||||
default: False
|
default: False
|
||||||
|
@ -33,6 +33,7 @@ from charmhelpers.core.hookenv import (
|
|||||||
related_units,
|
related_units,
|
||||||
service_name,
|
service_name,
|
||||||
ERROR,
|
ERROR,
|
||||||
|
INFO,
|
||||||
)
|
)
|
||||||
from charmhelpers.contrib.openstack.utils import (
|
from charmhelpers.contrib.openstack.utils import (
|
||||||
get_os_version_package,
|
get_os_version_package,
|
||||||
@ -191,6 +192,16 @@ class NovaComputeLibvirtContext(context.OSContextGenerator):
|
|||||||
else:
|
else:
|
||||||
ctxt['kvm_hugepages'] = 0
|
ctxt['kvm_hugepages'] = 0
|
||||||
|
|
||||||
|
if config('ksm') in ("1", "0",):
|
||||||
|
ctxt['ksm'] = config('ksm')
|
||||||
|
else:
|
||||||
|
if release < 'kilo':
|
||||||
|
log("KSM set to 1 by default on openstack releases < kilo",
|
||||||
|
level=INFO)
|
||||||
|
ctxt['ksm'] = "1"
|
||||||
|
else:
|
||||||
|
ctxt['ksm'] = "AUTO"
|
||||||
|
|
||||||
if config('pci-passthrough-whitelist'):
|
if config('pci-passthrough-whitelist'):
|
||||||
ctxt['pci_passthrough_whitelist'] = \
|
ctxt['pci_passthrough_whitelist'] = \
|
||||||
config('pci-passthrough-whitelist')
|
config('pci-passthrough-whitelist')
|
||||||
|
@ -2,5 +2,15 @@
|
|||||||
# [ WARNING ]
|
# [ WARNING ]
|
||||||
# Configuration file maintained by Juju. Local changes may be overwritten.
|
# Configuration file maintained by Juju. Local changes may be overwritten.
|
||||||
###############################################################################
|
###############################################################################
|
||||||
|
# Set to 1 to enable KSM, 0 to disable KSM, and AUTO to use default settings.
|
||||||
|
# After changing this setting restart the qemu-kvm service.
|
||||||
|
KSM_ENABLED={{ ksm }}
|
||||||
|
SLEEP_MILLISECS=200
|
||||||
|
# To load the vhost_net module, which in some cases can speed up
|
||||||
|
# network performance, set VHOST_NET_ENABLED to 1.
|
||||||
|
VHOST_NET_ENABLED=0
|
||||||
|
|
||||||
|
# Set this to 1 if you want hugepages to be available to kvm under
|
||||||
|
# /run/hugepages/kvm
|
||||||
KVM_HUGEPAGES={{ kvm_hugepages }}
|
KVM_HUGEPAGES={{ kvm_hugepages }}
|
||||||
|
|
||||||
|
@ -76,6 +76,7 @@ class NovaComputeContextTests(CharmTestCase):
|
|||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
super(NovaComputeContextTests, self).setUp(context, TO_PATCH)
|
super(NovaComputeContextTests, self).setUp(context, TO_PATCH)
|
||||||
|
self.os_release.return_value = 'kilo'
|
||||||
self.relation_get.side_effect = self.test_relation.get
|
self.relation_get.side_effect = self.test_relation.get
|
||||||
self.config.side_effect = self.test_config.get
|
self.config.side_effect = self.test_config.get
|
||||||
self.log.side_effect = fake_log
|
self.log.side_effect = fake_log
|
||||||
@ -202,6 +203,7 @@ class NovaComputeContextTests(CharmTestCase):
|
|||||||
{'libvirtd_opts': '',
|
{'libvirtd_opts': '',
|
||||||
'libvirt_user': 'libvirt',
|
'libvirt_user': 'libvirt',
|
||||||
'arch': platform.machine(),
|
'arch': platform.machine(),
|
||||||
|
'ksm': 'AUTO',
|
||||||
'kvm_hugepages': 0,
|
'kvm_hugepages': 0,
|
||||||
'listen_tls': 0,
|
'listen_tls': 0,
|
||||||
'host_uuid': self.host_uuid,
|
'host_uuid': self.host_uuid,
|
||||||
@ -216,6 +218,7 @@ class NovaComputeContextTests(CharmTestCase):
|
|||||||
{'libvirtd_opts': '-d',
|
{'libvirtd_opts': '-d',
|
||||||
'libvirt_user': 'libvirtd',
|
'libvirt_user': 'libvirtd',
|
||||||
'arch': platform.machine(),
|
'arch': platform.machine(),
|
||||||
|
'ksm': 'AUTO',
|
||||||
'kvm_hugepages': 0,
|
'kvm_hugepages': 0,
|
||||||
'listen_tls': 0,
|
'listen_tls': 0,
|
||||||
'host_uuid': self.host_uuid,
|
'host_uuid': self.host_uuid,
|
||||||
@ -230,6 +233,7 @@ class NovaComputeContextTests(CharmTestCase):
|
|||||||
{'libvirtd_opts': '-d -l',
|
{'libvirtd_opts': '-d -l',
|
||||||
'libvirt_user': 'libvirtd',
|
'libvirt_user': 'libvirtd',
|
||||||
'arch': platform.machine(),
|
'arch': platform.machine(),
|
||||||
|
'ksm': 'AUTO',
|
||||||
'kvm_hugepages': 0,
|
'kvm_hugepages': 0,
|
||||||
'listen_tls': 0,
|
'listen_tls': 0,
|
||||||
'host_uuid': self.host_uuid,
|
'host_uuid': self.host_uuid,
|
||||||
@ -245,6 +249,7 @@ class NovaComputeContextTests(CharmTestCase):
|
|||||||
'libvirt_user': 'libvirtd',
|
'libvirt_user': 'libvirtd',
|
||||||
'disk_cachemodes': 'file=unsafe,block=none',
|
'disk_cachemodes': 'file=unsafe,block=none',
|
||||||
'arch': platform.machine(),
|
'arch': platform.machine(),
|
||||||
|
'ksm': 'AUTO',
|
||||||
'kvm_hugepages': 0,
|
'kvm_hugepages': 0,
|
||||||
'listen_tls': 0,
|
'listen_tls': 0,
|
||||||
'host_uuid': self.host_uuid,
|
'host_uuid': self.host_uuid,
|
||||||
@ -260,6 +265,7 @@ class NovaComputeContextTests(CharmTestCase):
|
|||||||
'libvirt_user': 'libvirtd',
|
'libvirt_user': 'libvirtd',
|
||||||
'arch': platform.machine(),
|
'arch': platform.machine(),
|
||||||
'hugepages': True,
|
'hugepages': True,
|
||||||
|
'ksm': 'AUTO',
|
||||||
'kvm_hugepages': 1,
|
'kvm_hugepages': 1,
|
||||||
'listen_tls': 0,
|
'listen_tls': 0,
|
||||||
'host_uuid': self.host_uuid,
|
'host_uuid': self.host_uuid,
|
||||||
@ -342,6 +348,7 @@ class NovaComputeContextTests(CharmTestCase):
|
|||||||
{'libvirtd_opts': '-d',
|
{'libvirtd_opts': '-d',
|
||||||
'libvirt_user': 'libvirtd',
|
'libvirt_user': 'libvirtd',
|
||||||
'arch': platform.machine(),
|
'arch': platform.machine(),
|
||||||
|
'ksm': 'AUTO',
|
||||||
'hugepages': True,
|
'hugepages': True,
|
||||||
'kvm_hugepages': 1,
|
'kvm_hugepages': 1,
|
||||||
'listen_tls': 0,
|
'listen_tls': 0,
|
||||||
@ -350,6 +357,38 @@ class NovaComputeContextTests(CharmTestCase):
|
|||||||
'vcpu_pin_set': '^0^2',
|
'vcpu_pin_set': '^0^2',
|
||||||
'pci_passthrough_whitelist': 'mypcidevices'}, libvirt())
|
'pci_passthrough_whitelist': 'mypcidevices'}, libvirt())
|
||||||
|
|
||||||
|
def test_ksm_configs(self):
|
||||||
|
self.test_config.set('ksm', '1')
|
||||||
|
libvirt = context.NovaComputeLibvirtContext()
|
||||||
|
self.assertTrue(libvirt()['ksm'] == '1')
|
||||||
|
|
||||||
|
self.test_config.set('ksm', '0')
|
||||||
|
libvirt = context.NovaComputeLibvirtContext()
|
||||||
|
self.assertTrue(libvirt()['ksm'] == '0')
|
||||||
|
|
||||||
|
self.test_config.set('ksm', 'AUTO')
|
||||||
|
libvirt = context.NovaComputeLibvirtContext()
|
||||||
|
self.assertTrue(libvirt()['ksm'] == 'AUTO')
|
||||||
|
|
||||||
|
self.test_config.set('ksm', '')
|
||||||
|
libvirt = context.NovaComputeLibvirtContext()
|
||||||
|
self.assertTrue(libvirt()['ksm'] == 'AUTO')
|
||||||
|
|
||||||
|
self.os_release.return_value = 'ocata'
|
||||||
|
self.test_config.set('ksm', 'AUTO')
|
||||||
|
libvirt = context.NovaComputeLibvirtContext()
|
||||||
|
self.assertTrue(libvirt()['ksm'] == 'AUTO')
|
||||||
|
|
||||||
|
self.os_release.return_value = 'kilo'
|
||||||
|
self.test_config.set('ksm', 'AUTO')
|
||||||
|
libvirt = context.NovaComputeLibvirtContext()
|
||||||
|
self.assertTrue(libvirt()['ksm'] == 'AUTO')
|
||||||
|
|
||||||
|
self.os_release.return_value = 'cactus'
|
||||||
|
self.test_config.set('ksm', 'AUTO')
|
||||||
|
libvirt = context.NovaComputeLibvirtContext()
|
||||||
|
self.assertTrue(libvirt()['ksm'] == '1')
|
||||||
|
|
||||||
@patch.object(context.uuid, 'uuid4')
|
@patch.object(context.uuid, 'uuid4')
|
||||||
def test_libvirt_cpu_mode_default(self, mock_uuid):
|
def test_libvirt_cpu_mode_default(self, mock_uuid):
|
||||||
libvirt = context.NovaComputeLibvirtContext()
|
libvirt = context.NovaComputeLibvirtContext()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user