driver: add missing use_cache parameter for get_info()
With 19cb8280232 The driver interface has been updated. Now that the
method get_info() has an extra parameter 'use_cache'. That one is
currently not going to be used in lxd driver since we don't cache such
info.
Also, to ensure that the unit tests pass on a machine with lxd installed
as a snap, there are some additional mocks needed.
Change the nova dependency to pull from stable/stein rather than master.
Change-Id: Iaa1c7e9717619b087b98cc5171de2984954ccc6e
Closes-Bug: #1824300
Signed-off-by: Sahid Orentino Ferdjaoui <sahid.ferdjaoui@canonical.com>
(cherry picked from commit d0faf787d9
)
This commit is contained in:
parent
14819c16f3
commit
5ce47afcb2
|
@ -682,13 +682,15 @@ class LXDDriverTest(test.NoDBTestCase):
|
|||
|
||||
self.client.containers.get.assert_called_once_with(instance.name)
|
||||
|
||||
@mock.patch('nova.virt.lxd.common.is_snap_lxd')
|
||||
@mock.patch('nova.virt.lxd.driver.network')
|
||||
@mock.patch('pwd.getpwuid', mock.Mock(return_value=mock.Mock(pw_uid=1234)))
|
||||
@mock.patch('os.getuid', mock.Mock())
|
||||
@mock.patch('os.path.exists', mock.Mock(return_value=True))
|
||||
@mock.patch('six.moves.builtins.open')
|
||||
@mock.patch.object(driver.utils, 'execute')
|
||||
def test_get_console_output(self, execute, _open, _):
|
||||
def test_get_console_output(self, execute, _open, _, is_snap_lxd):
|
||||
is_snap_lxd.return_value = False
|
||||
ctx = context.get_admin_context()
|
||||
instance = fake_instance.fake_instance_obj(
|
||||
ctx, name='test', memory_mb=0)
|
||||
|
|
|
@ -48,6 +48,11 @@ class ToProfileTest(test.NoDBTestCase):
|
|||
self.CONF2.lxd.pool = None
|
||||
self.CONF2.lxd.root_dir = ''
|
||||
|
||||
is_snap_lxd_patch = mock.patch('nova.virt.lxd.common.is_snap_lxd')
|
||||
self.patchers.append(is_snap_lxd_patch)
|
||||
self.is_snap_lxd = is_snap_lxd_patch.start()
|
||||
self.is_snap_lxd.return_value = False
|
||||
|
||||
def tearDown(self):
|
||||
super(ToProfileTest, self).tearDown()
|
||||
for patcher in self.patchers:
|
||||
|
|
|
@ -479,7 +479,7 @@ class LXDDriver(driver.ComputeDriver):
|
|||
information.
|
||||
"""
|
||||
|
||||
def get_info(self, instance):
|
||||
def get_info(self, instance, use_cache=True):
|
||||
"""Return an InstanceInfo object for the instance."""
|
||||
try:
|
||||
container = self.client.containers.get(instance.name)
|
||||
|
|
Loading…
Reference in New Issue