Redux use of InstanceInfo object

Recent changes in Nova [0] remove a number of parameters from the
InstanceInfo object; re-align the nova-lxd driver to not provide
these values when constructing this object.

Also add chown & chmod to rootwrap configuration file until
nova-lxd moves to using privsep rather than rootwrap.

Include minor change to .testr.conf to deal with switch to
stestr (via os-testr).

[0] I5fe5c8121800e2b8da0860d53d818b7bd83c9e9d

Change-Id: I21caccaeb8794d1ee82956bd8c897b3f1cc366b0
This commit is contained in:
James Page 2017-09-11 09:39:39 -06:00
parent e045b7c928
commit aaa8b60215
4 changed files with 5 additions and 15 deletions

View File

@ -2,8 +2,6 @@
test_command=OS_STDOUT_CAPTURE=${OS_STDOUT_CAPTURE:-1} \
OS_STDERR_CAPTURE=${OS_STDERR_CAPTURE:-1} \
OS_TEST_TIMEOUT=${OS_TEST_TIMEOUT:-60} \
${PYTHON:-python} -m subunit.run discover \
-t ./nova/tests/unit/virt/lxd/ ./nova/tests/unit/virt/lxd \
$LISTOPT $IDOPTION
${PYTHON:-python} -m subunit.run discover -t ./nova/tests/unit/virt/lxd/ ./nova/tests/unit/virt/lxd $LISTOPT $IDOPTION
test_id_option=--load-list $IDFILE
test_list_option=--list

View File

@ -1,7 +1,9 @@
# nova-rootwrap filters for compute nodes running flex
# nova-rootwrap filters for compute nodes running nova-lxd
# This file should be owned by (and only-writable by) the root user
[Filters]
zfs: CommandFilter, zfs, root
zpool: CommandFilter, zpool, root
btrfs: CommandFilter, btrfs, root
chown: CommandFilter, chown, root
chmod: CommandFilter, chmod, root

View File

@ -203,10 +203,6 @@ class LXDDriverTest(test.NoDBTestCase):
info = lxd_driver.get_info(instance)
self.assertEqual(power_state.RUNNING, info.state)
self.assertEqual(3, info.mem_kb)
self.assertEqual(4, info.max_mem_kb)
self.assertEqual(1, info.num_cpu)
self.assertEqual(0, info.cpu_time_ns)
def test_list_instances(self):
self.client.containers.all.return_value = [

View File

@ -466,14 +466,8 @@ class LXDDriver(driver.ComputeDriver):
raise exception.InstanceNotFound(instance_id=instance.uuid)
state = container.state()
mem_kb = state.memory['usage'] >> 10
max_mem_kb = state.memory['usage_peak'] >> 10
return hardware.InstanceInfo(
state=_get_power_state(state.status_code),
max_mem_kb=max_mem_kb,
mem_kb=mem_kb,
num_cpu=instance.flavor.vcpus,
cpu_time_ns=0)
state=_get_power_state(state.status_code))
def list_instances(self):
"""Return a list of all instance names."""