diff -Nru nova-lxd-13.0.0/ChangeLog nova-lxd-13.2.0/ChangeLog --- nova-lxd-13.0.0/ChangeLog 2016-04-08 18:36:35.000000000 +0000 +++ nova-lxd-13.2.0/ChangeLog 2016-12-07 18:30:51.000000000 +0000 @@ -1,10 +1,26 @@ CHANGES ======= -13.0.0 +13.2.0 ------ -* Tag 13.0.0 +* Switch to using lxd: namespace for extra-specs +* Add support for isolated idmaps to mitaka + +13.1.0 +------ + +* Fix permissions on the config drive +* Move the console log out of the container directory +* Fix the ensure_tree call in the unittests to not write to disk +* Check for root-tar image format as well as raw +* Delete the container before deleting the profile +* importable Glance metadata definition file +* Tox runs flake8; travis shouldn't +* Add flake8 to travis install +* Remove specific pythons from travis config +* Have travis call tox, not ostestr raw +* Fix stable/mitaka branch tests for tox * Query the LXD API for memory usage * Fix issue #20 * Fix migration with configdrive @@ -125,10 +141,6 @@ * Refactor LXD container creation * Rename container_config and test_container_config * Bump version - -0.19 ----- - * Bump to v0.19 * Fix grammar * Fix pep8 @@ -282,10 +294,6 @@ * Use os-testr * Adjust image properties * Update setup.cfg - -0.17 ----- - * Container check * small fixes * Fix typo @@ -518,10 +526,6 @@ * Open for liberty * fix git repository * Add todo list - -stable/kilo ------------ - * Various bug fixes * Updates for LXD 0.7 * Removed debug info diff -Nru nova-lxd-13.0.0/contrib/glance_metadefs/compute-lxd-flavor.json nova-lxd-13.2.0/contrib/glance_metadefs/compute-lxd-flavor.json --- nova-lxd-13.0.0/contrib/glance_metadefs/compute-lxd-flavor.json 1970-01-01 00:00:00.000000000 +0000 +++ nova-lxd-13.2.0/contrib/glance_metadefs/compute-lxd-flavor.json 2016-12-07 18:27:20.000000000 +0000 @@ -0,0 +1,32 @@ +{ + "namespace": "OS::Nova::LXDFlavor", + "display_name": "LXD properties", + "description": "You can pass several options to the LXD container hypervisor that will affect the container's capabilities.", + "visibility": "public", + "protected": false, + "resource_type_associations": [ + { + "name": "OS::Nova::Flavor" + } + ], + "properties": { + "lxd:nested_allowed": { + "title": "Allow nested containers", + "description": "Allow or disallow creation of nested containers. If True, you can install and run LXD inside the VM itself and provision another level of containers.", + "type": "string", + "default": false + }, + "lxd:privileged_allowed": { + "title": "Create privileged container", + "description": "Containers created as Privileged have elevated powers on the compute host. You should not set this option on containers that you don't fully trust.", + "type": "string", + "default": false + }, + "lxd:isolated": { + "title": "Create idmap isolated containers", + "description": "Containers created as idmap isolated will run under different subuid/subgid ranges from other containers on the same host, decreasing the risk of cross container compromises within a single compute host.", + "type": "string", + "default": false + } + } +} diff -Nru nova-lxd-13.0.0/debian/changelog nova-lxd-13.2.0/debian/changelog --- nova-lxd-13.0.0/debian/changelog 2016-10-31 15:31:12.000000000 +0000 +++ nova-lxd-13.2.0/debian/changelog 2016-12-12 18:35:03.000000000 +0000 @@ -1,3 +1,10 @@ +nova-lxd (13.2.0-0ubuntu1) xenial; urgency=medium + + * New upstream release for Openstack Mitaka (LP: #1649368, #1648056): + - d/p/*: Dropped, no longer required as included upstream. + + -- Chuck Short Mon, 12 Dec 2016 13:35:03 -0500 + nova-lxd (13.0.0-0ubuntu3.1) xenial; urgency=medium * d/p/bug1638027.patch: Cherry pick fix to ensure that LXD containers diff -Nru nova-lxd-13.0.0/debian/patches/bug1638027.patch nova-lxd-13.2.0/debian/patches/bug1638027.patch --- nova-lxd-13.0.0/debian/patches/bug1638027.patch 2016-10-31 15:31:12.000000000 +0000 +++ nova-lxd-13.2.0/debian/patches/bug1638027.patch 1970-01-01 00:00:00.000000000 +0000 @@ -1,32 +0,0 @@ -From: Paul Hummer -Date: Mon, 31 Oct 2016 14:45:29 +0000 (-0600) -Subject: Delete the container before deleting the profile. -X-Git-Url: https://review.openstack.org/gitweb?p=openstack%2Fnova-lxd.git;a=commitdiff_plain;h=580713510b72f7aabf9dfa7b69bb0fbd3f75fc49 - -Delete the container before deleting the profile. - -If the container that uses the profile still -exists, the profile cannot be deleted, and -raises an exception, resulting in an inability -to delete an instance. - -Fixes bug 1638027 - -Change-Id: I51c108c7ad57936abe9ca46f0013136c8eaef5f5 ---- - -diff --git a/nova_lxd/nova/virt/lxd/operations.py b/nova_lxd/nova/virt/lxd/operations.py -index 9b3f144..e744246 100644 ---- a/nova_lxd/nova/virt/lxd/operations.py -+++ b/nova_lxd/nova/virt/lxd/operations.py -@@ -345,9 +345,9 @@ class LXDContainerOperations(object): - """ - LOG.debug('destroy called for instance', instance=instance) - try: -- self.session.profile_delete(instance) - self.session.container_destroy(instance.name, - instance) -+ self.session.profile_delete(instance) - self.cleanup(context, instance, network_info, block_device_info) - except Exception as ex: - with excutils.save_and_reraise_exception(): diff -Nru nova-lxd-13.0.0/debian/patches/fix-configdrive.patch nova-lxd-13.2.0/debian/patches/fix-configdrive.patch --- nova-lxd-13.0.0/debian/patches/fix-configdrive.patch 2016-10-31 15:31:12.000000000 +0000 +++ nova-lxd-13.2.0/debian/patches/fix-configdrive.patch 1970-01-01 00:00:00.000000000 +0000 @@ -1,82 +0,0 @@ -From 3565f4801e5789fc4c67f16bf62194dec1f69701 Mon Sep 17 00:00:00 2001 -From: Chuck Short -Date: Sat, 16 Apr 2016 15:51:48 -0400 -Subject: Adjust permissions for configdrive - -When attachnig a directory it must have the same permissions for the configdrive -so that the user can access files. In this case, the configdrive permissions were -not correct so the user was not able to ssh into the instances with their -ssh keys. - -Signed-off-by: Chuck Short - -diff --git a/nova_lxd/nova/virt/lxd/operations.py b/nova_lxd/nova/virt/lxd/operations.py -index 7151e6b..022de6b 100644 ---- a/nova_lxd/nova/virt/lxd/operations.py -+++ b/nova_lxd/nova/virt/lxd/operations.py -@@ -268,6 +268,10 @@ class LXDContainerOperations(object): - os.path.join(configdrive_dir, ent)) - utils.execute('chmod', '-R', '775', configdrive_dir, - run_as_root=True) -+ utils.execute('chown', '-R', '%s:%s' -+ % (self._uid_map('/etc/subuid').rstrip(), -+ self._uid_map('/etc/subgid').rstrip()), -+ configdrive_dir, run_as_root=True) - finally: - if mounted: - utils.execute('umount', tmpdir, run_as_root=True) -@@ -549,6 +553,14 @@ class LXDContainerOperations(object): - if destroy_vifs: - self.unplug_vifs(instance, network_info) - -+ name = pwd.getpwuid(os.getuid()).pw_name -+ configdrive_dir = \ -+ self.container_dir.get_container_configdrive(instance.name) -+ if os.path.exists(configdrive_dir): -+ utils.execute('chown', '-R', '%s:%s' % (name, name), -+ configdrive_dir, run_as_root=True) -+ shutil.rmtree(configdrive_dir) -+ - container_dir = self.container_dir.get_instance_dir(instance.name) - if os.path.exists(container_dir): - shutil.rmtree(container_dir) -@@ -645,3 +657,18 @@ class LXDContainerOperations(object): - - def stop_firewall(self, instance, network_info): - self.firewall_driver.unfilter_instance(instance, network_info) -+ -+ def _uid_map(self, subuid_f): -+ LOG.debug('Checking for subuid') -+ -+ line = None -+ with open(subuid_f, 'r') as fp: -+ name = pwd.getpwuid(os.getuid()).pw_name -+ for cline in fp: -+ if cline.startswith(name + ":"): -+ line = cline -+ break -+ if line is None: -+ raise ValueError("%s not found in %s" % (name, subuid_f)) -+ toks = line.split(":") -+ return toks[1] -diff --git a/nova_lxd/tests/test_driver_api.py b/nova_lxd/tests/test_driver_api.py -index f769924..227b111 100644 ---- a/nova_lxd/tests/test_driver_api.py -+++ b/nova_lxd/tests/test_driver_api.py -@@ -232,13 +232,13 @@ class LXDTestDriver(test.NoDBTestCase): - - @mock.patch('os.path.exists', mock.Mock(return_value=True)) - @mock.patch('shutil.rmtree') -- def test_cleanup(self, mr): -+ @mock.patch('pwd.getpwuid', mock.Mock(return_value=mock.Mock(pw_uid=1234))) -+ @mock.patch.object(container_ops.utils, 'execute') -+ def test_cleanup(self, mr, mu): - instance = stubs.MockInstance() - self.assertEqual( - None, - self.connection.cleanup({}, instance, [], [], None, None, None)) -- mr.assert_called_once_with( -- '/fake/instances/path/fake-uuid') - - @mock.patch('six.moves.builtins.open') - @mock.patch.object(container_ops.utils, 'execute') diff -Nru nova-lxd-13.0.0/debian/patches/fix-console-log.patch nova-lxd-13.2.0/debian/patches/fix-console-log.patch --- nova-lxd-13.0.0/debian/patches/fix-console-log.patch 2016-10-31 15:31:12.000000000 +0000 +++ nova-lxd-13.2.0/debian/patches/fix-console-log.patch 1970-01-01 00:00:00.000000000 +0000 @@ -1,39 +0,0 @@ -From 92370937064fb72eca2468cfca149311c306b053 Mon Sep 17 00:00:00 2001 -From: Chuck Short -Date: Mon, 11 Apr 2016 15:04:49 -0400 -Subject: Change location of console.log - -Currently the console for the instance is written to -'/var/lib/contianers/instance-xxx/console.log'. This prevents from -LVM based instances from being destroyed properly because the -file is still open. - -Signed-off-by: Chuck Short - -diff --git a/nova_lxd/nova/virt/lxd/utils.py b/nova_lxd/nova/virt/lxd/utils.py -index d9fc97b..7ad822f 100644 ---- a/nova_lxd/nova/virt/lxd/utils.py -+++ b/nova_lxd/nova/virt/lxd/utils.py -@@ -55,8 +55,7 @@ class LXDContainerDirectories(object): - 'configdrive') - - def get_console_path(self, instance): -- return os.path.join(CONF.lxd.root_dir, -- 'containers', -+ return os.path.join('/var/log/lxd/', - instance, - 'console.log') - -diff --git a/nova_lxd/tests/test_driver_api.py b/nova_lxd/tests/test_driver_api.py -index f769924..630f231 100644 ---- a/nova_lxd/tests/test_driver_api.py -+++ b/nova_lxd/tests/test_driver_api.py -@@ -252,7 +252,7 @@ class LXDTestDriver(test.NoDBTestCase): - self.connection.get_console_output({}, instance)) - calls = [ - mock.call('chown', '1234:1234', -- '/fake/lxd/root/containers/fake-uuid/console.log', -+ '/var/log/lxd/fake-uuid/console.log', - run_as_root=True), - mock.call('chmod', '755', - '/fake/lxd/root/containers/fake-uuid', diff -Nru nova-lxd-13.0.0/debian/patches/fix-unit-tests.patch nova-lxd-13.2.0/debian/patches/fix-unit-tests.patch --- nova-lxd-13.0.0/debian/patches/fix-unit-tests.patch 2016-10-31 15:31:12.000000000 +0000 +++ nova-lxd-13.2.0/debian/patches/fix-unit-tests.patch 1970-01-01 00:00:00.000000000 +0000 @@ -1,22 +0,0 @@ -diff -Naurp nova-lxd-13.0.0.0b2.orig/nova_lxd/tests/test_operations.py nova-lxd-13.0.0.0b2/nova_lxd/tests/test_operations.py ---- nova-lxd-13.0.0.0b2.orig/nova_lxd/tests/test_operations.py 2016-02-18 09:46:05.000000000 -0500 -+++ nova-lxd-13.0.0.0b2/nova_lxd/tests/test_operations.py 2016-02-18 11:39:40.454159824 -0500 -@@ -19,6 +19,8 @@ import mock - from nova import test - from nova.virt import fake - -+from oslo_utils import fileutils -+ - from nova_lxd.nova.virt.lxd import config - from nova_lxd.nova.virt.lxd import image - from nova_lxd.nova.virt.lxd import operations as container_ops -@@ -48,7 +50,8 @@ class LXDTestContainerOps(test.NoDBTestC - vif_patcher.start() - self.addCleanup(vif_patcher.stop) - -- def test_spawn_container(self): -+ @mock.patch('oslo_utils.fileutils.ensure_tree') -+ def test_spawn_container(self, mock_ensure_tree): - """Test spawn method. Ensure that the right calls - are made when creating a container. - """ diff -Nru nova-lxd-13.0.0/debian/patches/series nova-lxd-13.2.0/debian/patches/series --- nova-lxd-13.0.0/debian/patches/series 2016-10-31 15:31:12.000000000 +0000 +++ nova-lxd-13.2.0/debian/patches/series 1970-01-01 00:00:00.000000000 +0000 @@ -1,5 +0,0 @@ -fix-unit-tests.patch -fix-console-log.patch -update-disk-image-format.patch -fix-configdrive.patch -bug1638027.patch diff -Nru nova-lxd-13.0.0/debian/patches/update-disk-image-format.patch nova-lxd-13.2.0/debian/patches/update-disk-image-format.patch --- nova-lxd-13.0.0/debian/patches/update-disk-image-format.patch 2016-10-31 15:31:12.000000000 +0000 +++ nova-lxd-13.2.0/debian/patches/update-disk-image-format.patch 1970-01-01 00:00:00.000000000 +0000 @@ -1,41 +0,0 @@ -From 9836e520f8bb162fede28e06fbbaf6f655e7e517 Mon Sep 17 00:00:00 2001 -From: Chuck Short -Date: Mon, 11 Apr 2016 21:27:24 -0400 -Subject: Re-add check for root-tar image format - -Check for root-tar image format as well as raw. - -Signed-off-by: Chuck Short - -diff --git a/nova_lxd/nova/virt/lxd/image.py b/nova_lxd/nova/virt/lxd/image.py -index 2f29fcd..9988adb 100644 ---- a/nova_lxd/nova/virt/lxd/image.py -+++ b/nova_lxd/nova/virt/lxd/image.py -@@ -130,10 +130,10 @@ class LXDContainerImage(object): - raise exception.ImageUnacceptable(image_id=instance.image_ref, - reason=reason) - -- if disk_format != 'raw': -+ if disk_format not in ['raw', 'root-tar']: - reason = _('nova-lxd does not support images in %s format. ' -- 'You should upload an image in raw format.') % \ -- disk_format -+ 'You should upload an image in raw or root-tar ' -+ 'format.') % disk_format - raise exception.ImageUnacceptable(image_id=instance.image_ref, - reason=reason) - except Exception as ex: -diff --git a/nova_lxd/tests/test_image.py b/nova_lxd/tests/test_image.py -index 5041827..61519dc 100644 ---- a/nova_lxd/tests/test_image.py -+++ b/nova_lxd/tests/test_image.py -@@ -49,7 +49,8 @@ class LXDTestContainerImage(test.NoDBTestCase): - self.image = image.LXDContainerImage() - - @stubs.annotated_data( -- ('valid_image', True, {'disk_format': 'raw'}, None), -+ ('valid_image_raw', True, {'disk_format': 'raw'}, None), -+ ('valid_image_root-tar', True, {'disk_format': 'root-tar'}, None), - ('qcow2_image', False, {'disk_format': 'qcow2'}, - exception.ImageUnacceptable), - ('iso_image', False, {'disk_format': 'iso'}, diff -Nru nova-lxd-13.0.0/nova_lxd/nova/virt/lxd/config.py nova-lxd-13.2.0/nova_lxd/nova/virt/lxd/config.py --- nova-lxd-13.0.0/nova_lxd/nova/virt/lxd/config.py 2016-04-08 18:31:33.000000000 +0000 +++ nova-lxd-13.2.0/nova_lxd/nova/virt/lxd/config.py 2016-12-07 18:27:20.000000000 +0000 @@ -164,16 +164,26 @@ # Determine if we require a nested container flavor = instance.flavor lxd_nested_allowed = flavor.extra_specs.get( - 'lxd_nested_allowed', False) + 'lxd:nested_allowed', False) if lxd_nested_allowed: config['security.nesting'] = 'True' # Determine if we require a privileged container lxd_privileged_allowed = flavor.extra_specs.get( - 'lxd_privileged_allowed', False) + 'lxd:privileged_allowed', False) if lxd_privileged_allowed: config['security.privileged'] = 'True' + lxd_isolated = flavor.extra_specs.get( + 'lxd:isolated', False) + if lxd_isolated: + extensions = self.session.get_host_extensions() + if 'id_map' in extensions: + config['security.idmap.isolated'] = 'True' + else: + msg = _('Host does not support isolated instances') + raise exception.NovaException(msg) + return config def configure_container_root(self, instance): diff -Nru nova-lxd-13.0.0/nova_lxd/nova/virt/lxd/image.py nova-lxd-13.2.0/nova_lxd/nova/virt/lxd/image.py --- nova-lxd-13.0.0/nova_lxd/nova/virt/lxd/image.py 2016-04-08 18:31:33.000000000 +0000 +++ nova-lxd-13.2.0/nova_lxd/nova/virt/lxd/image.py 2016-12-07 18:27:20.000000000 +0000 @@ -130,10 +130,10 @@ raise exception.ImageUnacceptable(image_id=instance.image_ref, reason=reason) - if disk_format != 'raw': + if disk_format not in ['raw', 'root-tar']: reason = _('nova-lxd does not support images in %s format. ' - 'You should upload an image in raw format.') % \ - disk_format + 'You should upload an image in raw or root-tar ' + 'format.') % disk_format raise exception.ImageUnacceptable(image_id=instance.image_ref, reason=reason) except Exception as ex: diff -Nru nova-lxd-13.0.0/nova_lxd/nova/virt/lxd/operations.py nova-lxd-13.2.0/nova_lxd/nova/virt/lxd/operations.py --- nova-lxd-13.0.0/nova_lxd/nova/virt/lxd/operations.py 2016-04-08 18:31:33.000000000 +0000 +++ nova-lxd-13.2.0/nova_lxd/nova/virt/lxd/operations.py 2016-12-07 18:27:20.000000000 +0000 @@ -269,6 +269,10 @@ os.path.join(configdrive_dir, ent)) utils.execute('chmod', '-R', '775', configdrive_dir, run_as_root=True) + utils.execute('chown', '-R', '%s:%s' + % (self._uid_map('/etc/subuid').rstrip(), + self._uid_map('/etc/subgid').rstrip()), + configdrive_dir, run_as_root=True) finally: if mounted: utils.execute('umount', tmpdir, run_as_root=True) @@ -345,9 +349,9 @@ """ LOG.debug('destroy called for instance', instance=instance) try: - self.session.profile_delete(instance) self.session.container_destroy(instance.name, instance) + self.session.profile_delete(instance) self.cleanup(context, instance, network_info, block_device_info) except Exception as ex: with excutils.save_and_reraise_exception(): @@ -550,6 +554,14 @@ if destroy_vifs: self.unplug_vifs(instance, network_info) + name = pwd.getpwuid(os.getuid()).pw_name + configdrive_dir = \ + self.container_dir.get_container_configdrive(instance.name) + if os.path.exists(configdrive_dir): + utils.execute('chown', '-R', '%s:%s' % (name, name), + configdrive_dir, run_as_root=True) + shutil.rmtree(configdrive_dir) + container_dir = self.container_dir.get_instance_dir(instance.name) if os.path.exists(container_dir): shutil.rmtree(container_dir) @@ -649,3 +661,18 @@ def stop_firewall(self, instance, network_info): self.firewall_driver.unfilter_instance(instance, network_info) + + def _uid_map(self, subuid_f): + LOG.debug('Checking for subuid') + + line = None + with open(subuid_f, 'r') as fp: + name = pwd.getpwuid(os.getuid()).pw_name + for cline in fp: + if cline.startswith(name + ":"): + line = cline + break + if line is None: + raise ValueError("%s not found in %s" % (name, subuid_f)) + toks = line.split(":") + return toks[1] diff -Nru nova-lxd-13.0.0/nova_lxd/nova/virt/lxd/session.py nova-lxd-13.2.0/nova_lxd/nova/virt/lxd/session.py --- nova-lxd-13.0.0/nova_lxd/nova/virt/lxd/session.py 2016-04-08 18:31:33.000000000 +0000 +++ nova-lxd-13.2.0/nova_lxd/nova/virt/lxd/session.py 2016-12-07 18:27:20.000000000 +0000 @@ -830,6 +830,10 @@ 'ex': ex} LOG.error(msg) + def get_host_extensions(self): + client = self.get_session() + return client.host_config().get('api_extensions', []) + # # Migrate methods # diff -Nru nova-lxd-13.0.0/nova_lxd/nova/virt/lxd/utils.py nova-lxd-13.2.0/nova_lxd/nova/virt/lxd/utils.py --- nova-lxd-13.0.0/nova_lxd/nova/virt/lxd/utils.py 2016-04-08 18:31:33.000000000 +0000 +++ nova-lxd-13.2.0/nova_lxd/nova/virt/lxd/utils.py 2016-12-07 18:27:20.000000000 +0000 @@ -55,8 +55,7 @@ 'configdrive') def get_console_path(self, instance): - return os.path.join(CONF.lxd.root_dir, - 'containers', + return os.path.join('/var/log/lxd/', instance, 'console.log') diff -Nru nova-lxd-13.0.0/nova_lxd/tests/test_config.py nova-lxd-13.2.0/nova_lxd/tests/test_config.py --- nova-lxd-13.0.0/nova_lxd/tests/test_config.py 2016-04-08 18:31:33.000000000 +0000 +++ nova-lxd-13.2.0/nova_lxd/tests/test_config.py 2016-12-07 18:27:20.000000000 +0000 @@ -16,6 +16,7 @@ import ddt import mock +from nova import exception from nova import test from nova.tests.unit import fake_network @@ -121,14 +122,33 @@ def test_container_nested_container(self): instance = stubs._fake_instance() - instance.flavor.extra_specs = {'lxd_nested_allowed': True} + instance.flavor.extra_specs = {'lxd:nested_allowed': True} config = self.config.config_instance_options({}, instance) self.assertEqual({'security.nesting': 'True', 'boot.autostart': 'True'}, config) def test_container_privileged_container(self): instance = stubs._fake_instance() - instance.flavor.extra_specs = {'lxd_privileged_allowed': True} + instance.flavor.extra_specs = {'lxd:privileged_allowed': True} config = self.config.config_instance_options({}, instance) self.assertEqual({'security.privileged': 'True', 'boot.autostart': 'True'}, config) + + @mock.patch.object(session.LXDAPISession, 'get_host_extensions', + mock.Mock(return_value=['id_map'])) + def test_container_isolated(self): + instance = stubs._fake_instance() + instance.flavor.extra_specs = {'lxd:isolated': True} + config = self.config.config_instance_options({}, instance) + self.assertEqual({'security.idmap.isolated': 'True', + 'boot.autostart': 'True'}, config) + + @mock.patch.object(session.LXDAPISession, 'get_host_extensions', + mock.Mock(return_value=[])) + def test_container_isolated_unsupported(self): + instance = stubs._fake_instance() + instance.flavor.extra_specs = {'lxd:isolated': True} + + self.assertRaises( + exception.NovaException, + self.config.config_instance_options, {}, instance) diff -Nru nova-lxd-13.0.0/nova_lxd/tests/test_driver_api.py nova-lxd-13.2.0/nova_lxd/tests/test_driver_api.py --- nova-lxd-13.0.0/nova_lxd/tests/test_driver_api.py 2016-04-08 18:31:33.000000000 +0000 +++ nova-lxd-13.2.0/nova_lxd/tests/test_driver_api.py 2016-12-07 18:27:20.000000000 +0000 @@ -237,13 +237,13 @@ @mock.patch('os.path.exists', mock.Mock(return_value=True)) @mock.patch('shutil.rmtree') - def test_cleanup(self, mr): + @mock.patch('pwd.getpwuid', mock.Mock(return_value=mock.Mock(pw_uid=1234))) + @mock.patch.object(container_ops.utils, 'execute') + def test_cleanup(self, mr, mu): instance = stubs.MockInstance() self.assertEqual( None, self.connection.cleanup({}, instance, [], [], None, None, None)) - mr.assert_called_once_with( - '/fake/instances/path/fake-uuid') @mock.patch('six.moves.builtins.open') @mock.patch.object(container_ops.utils, 'execute') @@ -257,7 +257,7 @@ self.connection.get_console_output({}, instance)) calls = [ mock.call('chown', '1234:1234', - '/fake/lxd/root/containers/fake-uuid/console.log', + '/var/log/lxd/fake-uuid/console.log', run_as_root=True), mock.call('chmod', '755', '/fake/lxd/root/containers/fake-uuid', diff -Nru nova-lxd-13.0.0/nova_lxd/tests/test_image.py nova-lxd-13.2.0/nova_lxd/tests/test_image.py --- nova-lxd-13.0.0/nova_lxd/tests/test_image.py 2016-04-08 18:31:33.000000000 +0000 +++ nova-lxd-13.2.0/nova_lxd/tests/test_image.py 2016-12-07 18:27:20.000000000 +0000 @@ -49,7 +49,8 @@ self.image = image.LXDContainerImage() @stubs.annotated_data( - ('valid_image', True, {'disk_format': 'raw'}, None), + ('valid_image_raw', True, {'disk_format': 'raw'}, None), + ('valid_image_root-tar', True, {'disk_format': 'root-tar'}, None), ('qcow2_image', False, {'disk_format': 'qcow2'}, exception.ImageUnacceptable), ('iso_image', False, {'disk_format': 'iso'}, diff -Nru nova-lxd-13.0.0/nova_lxd/tests/test_operations.py nova-lxd-13.2.0/nova_lxd/tests/test_operations.py --- nova-lxd-13.0.0/nova_lxd/tests/test_operations.py 2016-04-08 18:31:33.000000000 +0000 +++ nova-lxd-13.2.0/nova_lxd/tests/test_operations.py 2016-12-07 18:27:20.000000000 +0000 @@ -48,7 +48,8 @@ vif_patcher.start() self.addCleanup(vif_patcher.stop) - def test_spawn_container(self): + @mock.patch('oslo_utils.fileutils.ensure_tree') + def test_spawn_container(self, mock_ensure_tree): """Test spawn method. Ensure that the right calls are made when creating a container. """ diff -Nru nova-lxd-13.0.0/nova_lxd.egg-info/pbr.json nova-lxd-13.2.0/nova_lxd.egg-info/pbr.json --- nova-lxd-13.0.0/nova_lxd.egg-info/pbr.json 2016-04-08 18:36:36.000000000 +0000 +++ nova-lxd-13.2.0/nova_lxd.egg-info/pbr.json 2016-12-07 18:30:51.000000000 +0000 @@ -1 +1 @@ -{"is_release": true, "git_version": "ff2792f"} \ No newline at end of file +{"is_release": true, "git_version": "216b7a5"} \ No newline at end of file diff -Nru nova-lxd-13.0.0/nova_lxd.egg-info/PKG-INFO nova-lxd-13.2.0/nova_lxd.egg-info/PKG-INFO --- nova-lxd-13.0.0/nova_lxd.egg-info/PKG-INFO 2016-04-08 18:36:36.000000000 +0000 +++ nova-lxd-13.2.0/nova_lxd.egg-info/PKG-INFO 2016-12-07 18:30:51.000000000 +0000 @@ -1,6 +1,6 @@ Metadata-Version: 1.1 Name: nova-lxd -Version: 13.0.0 +Version: 13.2.0 Summary: native lxd driver for openstack Home-page: http://www.openstack.org/ Author: OpenStack diff -Nru nova-lxd-13.0.0/nova_lxd.egg-info/requires.txt nova-lxd-13.2.0/nova_lxd.egg-info/requires.txt --- nova-lxd-13.0.0/nova_lxd.egg-info/requires.txt 2016-04-08 18:36:36.000000000 +0000 +++ nova-lxd-13.2.0/nova_lxd.egg-info/requires.txt 2016-12-07 18:30:51.000000000 +0000 @@ -1,6 +1,7 @@ pbr>=1.6 Babel>=1.3 requests!=2.9.0,>=2.8.1 +pylxd==2.0.0 oslo.config>=3.4.0 oslo.concurrency>=2.3.0 oslo.utils>=3.4.0 diff -Nru nova-lxd-13.0.0/nova_lxd.egg-info/SOURCES.txt nova-lxd-13.2.0/nova_lxd.egg-info/SOURCES.txt --- nova-lxd-13.0.0/nova_lxd.egg-info/SOURCES.txt 2016-04-08 18:36:36.000000000 +0000 +++ nova-lxd-13.2.0/nova_lxd.egg-info/SOURCES.txt 2016-12-07 18:30:52.000000000 +0000 @@ -17,6 +17,7 @@ setup.py test-requirements.txt tox.ini +contrib/glance_metadefs/compute-lxd-flavor.json devstack/README.rst devstack/nova-lxd-functions.sh devstack/override-defaults diff -Nru nova-lxd-13.0.0/PKG-INFO nova-lxd-13.2.0/PKG-INFO --- nova-lxd-13.0.0/PKG-INFO 2016-04-08 18:36:36.000000000 +0000 +++ nova-lxd-13.2.0/PKG-INFO 2016-12-07 18:30:52.000000000 +0000 @@ -1,6 +1,6 @@ Metadata-Version: 1.1 Name: nova-lxd -Version: 13.0.0 +Version: 13.2.0 Summary: native lxd driver for openstack Home-page: http://www.openstack.org/ Author: OpenStack diff -Nru nova-lxd-13.0.0/requirements.txt nova-lxd-13.2.0/requirements.txt --- nova-lxd-13.0.0/requirements.txt 2016-04-08 18:31:33.000000000 +0000 +++ nova-lxd-13.2.0/requirements.txt 2016-12-07 18:27:20.000000000 +0000 @@ -5,6 +5,7 @@ pbr>=1.6 # Apache-2.0 Babel>=1.3 # BSD requests!=2.9.0,>=2.8.1 # Apache-2.0 +pylxd==2.0.0 oslo.config>=3.4.0 # Apache-2.0 oslo.concurrency>=2.3.0 # Apache-2.0 oslo.utils>=3.4.0 # Apache-2.0 diff -Nru nova-lxd-13.0.0/setup.cfg nova-lxd-13.2.0/setup.cfg --- nova-lxd-13.0.0/setup.cfg 2016-04-08 18:36:36.000000000 +0000 +++ nova-lxd-13.2.0/setup.cfg 2016-12-07 18:30:52.000000000 +0000 @@ -3,7 +3,7 @@ summary = native lxd driver for openstack description-file = README.md -version = 13.0.0 +version = 13.2.0 author = OpenStack author-email = openstack-dev@lists.openstack.org home-page = http://www.openstack.org/ diff -Nru nova-lxd-13.0.0/test-requirements.txt nova-lxd-13.2.0/test-requirements.txt --- nova-lxd-13.0.0/test-requirements.txt 2016-04-08 18:31:33.000000000 +0000 +++ nova-lxd-13.2.0/test-requirements.txt 2016-12-07 18:27:20.000000000 +0000 @@ -16,5 +16,3 @@ testtools>=1.4.0 # MIT os-testr>=0.4.1 # Apache-2.0 nosexcover # BSD --e git+https://github.com/lxc/pylxd#egg=pylxd --e git+https://github.com/openstack/nova#egg=nova diff -Nru nova-lxd-13.0.0/tox.ini nova-lxd-13.2.0/tox.ini --- nova-lxd-13.0.0/tox.ini 2016-04-08 18:31:33.000000000 +0000 +++ nova-lxd-13.2.0/tox.ini 2016-12-07 18:27:20.000000000 +0000 @@ -2,7 +2,7 @@ minversion = 1.6 # Python 3 tests MUST run first, due to this bug: # https://bugs.launchpad.net/testrepository/+bug/1229445 -envlist = py34,py27,pep8 +envlist = py3,py27,pep8 skipsdist = True [testenv] @@ -14,6 +14,7 @@ PYTHONDONTWRITEBYTECODE=1 deps = -r{toxinidir}/requirements.txt -r{toxinidir}/test-requirements.txt + -egit+https://github.com/openstack/nova.git@stable/mitaka#egg=nova commands = ostestr {posargs} [testenv:pep8] diff -Nru nova-lxd-13.0.0/.travis.yml nova-lxd-13.2.0/.travis.yml --- nova-lxd-13.0.0/.travis.yml 2016-04-08 18:31:33.000000000 +0000 +++ nova-lxd-13.2.0/.travis.yml 2016-12-07 18:27:20.000000000 +0000 @@ -1,10 +1,6 @@ language: python -python: - - "3.4" - - "2.7" -install: pip install -U -r requirements.txt -r test-requirements.txt -before_script: flake8 --ignore=E123,E125,H904,H405,H404,H305,H306,H307 -script: ostestr +install: pip install tox flake8 +script: tox cache: directories: - $HOME/.cache/pip