Add support for zfs in the charm.
Change-Id: I6df55aee1c814ba44a30ac73a48ce95073e1a4ad
This commit is contained in:
parent
fa6301fe9c
commit
d9b7157396
|
@ -25,7 +25,7 @@ options:
|
||||||
type: string
|
type: string
|
||||||
default: btrfs
|
default: btrfs
|
||||||
description: |
|
description: |
|
||||||
LXD container storage type: btrfs or lvm
|
LXD container storage type: btrfs, zfs, or lvm
|
||||||
ephemeral-unmount:
|
ephemeral-unmount:
|
||||||
type: string
|
type: string
|
||||||
default:
|
default:
|
||||||
|
|
|
@ -52,7 +52,8 @@ BASE_PACKAGES = [
|
||||||
'btrfs-tools',
|
'btrfs-tools',
|
||||||
'lvm2',
|
'lvm2',
|
||||||
'thin-provisioning-tools',
|
'thin-provisioning-tools',
|
||||||
'criu'
|
'criu',
|
||||||
|
'zfsutils-linux'
|
||||||
]
|
]
|
||||||
LXD_PACKAGES = ['lxd', 'lxd-client']
|
LXD_PACKAGES = ['lxd', 'lxd-client']
|
||||||
LXD_SOURCE_PACKAGES = [
|
LXD_SOURCE_PACKAGES = [
|
||||||
|
@ -216,6 +217,17 @@ def configure_lxd_block():
|
||||||
# The LVM thinpool logical volume is lazily created, either on
|
# The LVM thinpool logical volume is lazily created, either on
|
||||||
# image import or container creation. This will force LV creation.
|
# image import or container creation. This will force LV creation.
|
||||||
create_and_import_busybox_image()
|
create_and_import_busybox_image()
|
||||||
|
elif config('storage-type') == 'zfs':
|
||||||
|
status_set('maintenance',
|
||||||
|
'Configuring zfs container storage')
|
||||||
|
if config('overwrite'):
|
||||||
|
cmd = ['zpool', 'create', '-f', 'lxd', dev]
|
||||||
|
else:
|
||||||
|
cmd = ['zpool', 'create', 'lxd', dev]
|
||||||
|
check_call(cmd)
|
||||||
|
|
||||||
|
cmd = ['lxc', 'config', 'set', 'storage.zfs_pool_name', 'lxd']
|
||||||
|
check_call(cmd)
|
||||||
|
|
||||||
|
|
||||||
def create_and_import_busybox_image():
|
def create_and_import_busybox_image():
|
||||||
|
|
|
@ -390,46 +390,3 @@ class LXDBasicDeployment(OpenStackAmuletDeployment):
|
||||||
# TODO: Delete nova keypair
|
# TODO: Delete nova keypair
|
||||||
|
|
||||||
u.log.debug('Ok')
|
u.log.debug('Ok')
|
||||||
|
|
||||||
def test_900_compute_restart_on_config_change(self):
|
|
||||||
"""Verify that the specified services are restarted when the config
|
|
||||||
is changed."""
|
|
||||||
u.log.debug('Checking service restart on charm config '
|
|
||||||
'option change...')
|
|
||||||
|
|
||||||
sentry = self.compute0_sentry
|
|
||||||
juju_service = 'nova-compute'
|
|
||||||
|
|
||||||
# Expected default and alternate values
|
|
||||||
set_default = {'verbose': 'False'}
|
|
||||||
set_alternate = {'verbose': 'True'}
|
|
||||||
|
|
||||||
# Services which are expected to restart upon config change,
|
|
||||||
# and corresponding config files affected by the change
|
|
||||||
conf_file = '/etc/nova/nova.conf'
|
|
||||||
services = {
|
|
||||||
'nova-compute': conf_file,
|
|
||||||
'nova-api': conf_file,
|
|
||||||
'nova-network': conf_file
|
|
||||||
}
|
|
||||||
|
|
||||||
# Make config change, check for service restarts
|
|
||||||
u.log.debug('Making config change on {}...'.format(juju_service))
|
|
||||||
mtime = u.get_sentry_time(sentry)
|
|
||||||
self.d.configure(juju_service, set_alternate)
|
|
||||||
|
|
||||||
sleep_time = 30
|
|
||||||
for s, conf_file in services.iteritems():
|
|
||||||
u.log.debug("Checking that service restarted: {}".format(s))
|
|
||||||
if not u.validate_service_config_changed(sentry, mtime, s,
|
|
||||||
conf_file,
|
|
||||||
sleep_time=sleep_time):
|
|
||||||
|
|
||||||
self.d.configure(juju_service, set_default)
|
|
||||||
msg = "service {} didn't restart after config change".format(s)
|
|
||||||
amulet.raise_status(amulet.FAIL, msg=msg)
|
|
||||||
sleep_time = 0
|
|
||||||
|
|
||||||
self.d.configure(juju_service, set_default)
|
|
||||||
|
|
||||||
u.log.debug('Ok')
|
|
||||||
|
|
|
@ -21,16 +21,17 @@ class TestLXDUtilsDeterminePackages(testing.CharmTestCase):
|
||||||
"""A list of LXD packages should be returned."""
|
"""A list of LXD packages should be returned."""
|
||||||
expected = [
|
expected = [
|
||||||
'btrfs-tools',
|
'btrfs-tools',
|
||||||
'thin-provisioning-tools',
|
|
||||||
'criu',
|
'criu',
|
||||||
'lvm2',
|
'lvm2',
|
||||||
'lxd',
|
'lxd',
|
||||||
'lxd-client',
|
'lxd-client',
|
||||||
|
'thin-provisioning-tools',
|
||||||
|
'zfsutils-linux',
|
||||||
]
|
]
|
||||||
|
|
||||||
packages = lxd_utils.determine_packages()
|
packages = lxd_utils.determine_packages()
|
||||||
|
|
||||||
self.assertEqual(expected, packages)
|
self.assertEqual(expected, sorted(packages))
|
||||||
|
|
||||||
|
|
||||||
class TestLXDUtilsCreateAndImportBusyboxImage(testing.CharmTestCase):
|
class TestLXDUtilsCreateAndImportBusyboxImage(testing.CharmTestCase):
|
||||||
|
|
Loading…
Reference in New Issue