Merge "Add support for zfs in the charm."
This commit is contained in:
commit
0ed13c080a
|
@ -25,7 +25,7 @@ options:
|
|||
type: string
|
||||
default: btrfs
|
||||
description: |
|
||||
LXD container storage type: btrfs or lvm
|
||||
LXD container storage type: btrfs, zfs, or lvm
|
||||
ephemeral-unmount:
|
||||
type: string
|
||||
default:
|
||||
|
|
|
@ -52,7 +52,8 @@ BASE_PACKAGES = [
|
|||
'btrfs-tools',
|
||||
'lvm2',
|
||||
'thin-provisioning-tools',
|
||||
'criu'
|
||||
'criu',
|
||||
'zfsutils-linux'
|
||||
]
|
||||
LXD_PACKAGES = ['lxd', 'lxd-client']
|
||||
LXD_SOURCE_PACKAGES = [
|
||||
|
@ -216,6 +217,17 @@ def configure_lxd_block():
|
|||
# The LVM thinpool logical volume is lazily created, either on
|
||||
# image import or container creation. This will force LV creation.
|
||||
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():
|
||||
|
|
|
@ -390,46 +390,3 @@ class LXDBasicDeployment(OpenStackAmuletDeployment):
|
|||
# TODO: Delete nova keypair
|
||||
|
||||
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."""
|
||||
expected = [
|
||||
'btrfs-tools',
|
||||
'thin-provisioning-tools',
|
||||
'criu',
|
||||
'lvm2',
|
||||
'lxd',
|
||||
'lxd-client',
|
||||
'thin-provisioning-tools',
|
||||
'zfsutils-linux',
|
||||
]
|
||||
|
||||
packages = lxd_utils.determine_packages()
|
||||
|
||||
self.assertEqual(expected, packages)
|
||||
self.assertEqual(expected, sorted(packages))
|
||||
|
||||
|
||||
class TestLXDUtilsCreateAndImportBusyboxImage(testing.CharmTestCase):
|
||||
|
|
Loading…
Reference in New Issue