463
463
compute_context.CEPH_SECRET_UUID,
464
464
'--base64', key])
466
@patch.object(utils, 'check_call')
467
@patch.object(utils, 'check_output')
468
def test_configure_lxd_daemon(self, _check_output, _check_call):
469
self.test_config.set('virt-type', 'lxd')
470
utils.configure_lxd_daemon('nova')
471
self.add_user_to_group.assert_called_with('nova', 'lxd')
472
self.service_restart.assert_called_with('lxd')
473
_check_output.assert_called_wth(['sudo', '-u', 'nova', 'lxc', 'list'])
475
@patch.object(utils, 'configure_lxd_daemon')
476
466
@patch.object(utils, 'configure_subuid')
477
def test_configure_lxd_vivid(self, _configure_subuid,
478
_configure_lxd_daemon):
467
def test_configure_lxd_vivid(self, _configure_subuid):
479
468
self.lsb_release.return_value = {
480
469
'DISTRIB_CODENAME': 'vivid'
482
471
utils.configure_lxd('nova')
483
472
_configure_subuid.assert_called_with(user='nova')
484
_configure_lxd_daemon.assert_called_with(user='nova')
486
@patch.object(utils, 'configure_lxd_daemon')
487
474
@patch.object(utils, 'configure_subuid')
488
def test_configure_lxd_pre_vivid(self, _configure_subuid,
489
_configure_lxd_daemon):
475
def test_configure_lxd_pre_vivid(self, _configure_subuid):
490
476
self.lsb_release.return_value = {
491
477
'DISTRIB_CODENAME': 'trusty'
493
479
with self.assertRaises(Exception):
494
480
utils.configure_lxd('nova')
495
481
self.assertFalse(_configure_subuid.called)
496
self.assertFalse(_configure_lxd_daemon.called)
498
483
def test_enable_nova_metadata(self):
499
484
class DummyContext():