def config_changed(): # if we are paused, delay doing any config changed hooks. # It is forced on the resume. if is_unit_paused_set(): log("Unit is pause or upgrading. Skipping config_changed", "WARN") return install_packages() install_tmpfilesd() # NOTE(jamespage): purge any packages as a result of py3 switch # at rocky. packages_to_purge = determine_purge_packages() request_nova_compute_restart = False if packages_to_purge: purge_packages(packages_to_purge) request_nova_compute_restart = True sysctl_settings = config('sysctl') if not is_container() and sysctl_settings: create_sysctl(sysctl_settings, '/etc/sysctl.d/50-openvswitch.conf') configure_ovs() CONFIGS.write_all() # NOTE(fnordahl): configure_sriov must be run after CONFIGS.write_all() # to allow us to enable boot time execution of init script configure_sriov() for rid in relation_ids('neutron-plugin'): neutron_plugin_joined( relation_id=rid, request_restart=request_nova_compute_restart)
def config_changed(): # if we are paused, delay doing any config changed hooks. # It is forced on the resume. if is_unit_paused_set(): log("Unit is pause or upgrading. Skipping config_changed", "WARN") return install_packages() install_tmpfilesd() # NOTE(jamespage): purge any packages as a result of py3 switch # at rocky. packages_to_purge = determine_purge_packages() request_nova_compute_restart = False if packages_to_purge: purge_packages(packages_to_purge) request_nova_compute_restart = True sysctl_settings = config('sysctl') if not is_container() and sysctl_settings: create_sysctl(sysctl_settings, '/etc/sysctl.d/50-openvswitch.conf') configure_ovs() CONFIGS.write_all() # NOTE(fnordahl): configure_sriov must be run after CONFIGS.write_all() # to allow us to enable boot time execution of init script configure_sriov() for rid in relation_ids('neutron-plugin'): neutron_plugin_joined( relation_id=rid, request_restart=request_nova_compute_restart)
def test_configure_sriov_no_changes(self, _os_chmod): self.os_release.return_value = 'kilo' _config = {'enable-sriov': True, 'sriov-numvfs': 'auto'} self._configure_sriov_base(_config, False) nutils.configure_sriov() self.assertFalse(self.remote_restart.called)
def config_changed(): install_packages() configure_ovs() CONFIGS.write_all() # NOTE(fnordahl): configure_sriov must be run after CONFIGS.write_all() # to allow us to enable boot time execution of init script configure_sriov() for rid in relation_ids('neutron-plugin'): neutron_plugin_joined(relation_id=rid)
def test_configure_sriov_numvfs_per_device(self, _os_chmod): self.os_release.return_value = 'kilo' _config = {'enable-sriov': True, 'sriov-numvfs': 'ens0:32 sriov23:64'} self._configure_sriov_base(_config, True) nutils.configure_sriov() self.mock_sriov_device.set_sriov_numvfs.assert_called_with(32) self.mock_sriov_device2.set_sriov_numvfs.assert_not_called() self.assertTrue(self.remote_restart.called)
def test_configure_sriov_auto(self, _os_chmod): self.os_release.return_value = 'mitaka' _config = {'enable-sriov': True, 'sriov-numvfs': 'auto'} self._configure_sriov_base(_config, True) nutils.configure_sriov() self.mock_sriov_device.set_sriov_numvfs.assert_called_with( self.mock_sriov_device.sriov_totalvfs) self.mock_sriov_device2.set_sriov_numvfs.assert_called_with( self.mock_sriov_device2.sriov_totalvfs) self.assertTrue(self.remote_restart.called)
def config_changed(): install_packages() if git_install_requested(): if config_value_changed('openstack-origin-git'): git_install(config('openstack-origin-git')) configure_ovs() configure_sriov() CONFIGS.write_all() for rid in relation_ids('zeromq-configuration'): zeromq_configuration_relation_joined(rid) for rid in relation_ids('neutron-plugin'): neutron_plugin_joined(relation_id=rid)
def test_configure_sriov_numvfs_per_device(self, _os_chmod): self.os_release.return_value = 'kilo' _config = { 'enable-sriov': True, 'sriov-numvfs': 'ens0:32 sriov23:64' } self._configure_sriov_base(_config) nutils.configure_sriov() self.mock_sriov_device.set_sriov_numvfs.assert_called_with(32) self.mock_sriov_device2.set_sriov_numvfs.assert_not_called() self.assertTrue(self.remote_restart.called)
def test_configure_sriov_numvfs(self, _os_chmod): self.os_release.return_value = 'mitaka' _config = { 'enable-sriov': True, 'sriov-numvfs': '32', } self._configure_sriov_base(_config) nutils.configure_sriov() self.mock_sriov_device.set_sriov_numvfs.assert_called_with(32) self.mock_sriov_device2.set_sriov_numvfs.assert_called_with(32) self.assertTrue(self.remote_restart.called)
def test_configure_sriov_numvfs(self, _os_chmod, _sh_copy): self.os_release.return_value = 'mitaka' _config = { 'enable-sriov': True, 'sriov-numvfs': '32', } self._configure_sriov_base(_config) nutils.configure_sriov() self.mock_sriov_device.set_sriov_numvfs.assert_called_with(32) self.mock_sriov_device2.set_sriov_numvfs.assert_called_with(32) self.assertTrue(self.remote_restart.called)
def test_configure_sriov_auto_mapping(self, _os_chmod, _sh_copy): self.os_release.return_value = 'mitaka' _config = { 'enable-sriov': True, 'sriov-numvfs': 'auto', 'sriov-device-mappings': 'net1:ens49' } self._configure_sriov_base(_config) nutils.configure_sriov() self.assertFalse(self.mock_sriov_device.set_sriov_numvfs.called) self.mock_sriov_device2.set_sriov_numvfs.assert_called_with( self.mock_sriov_device2.sriov_totalvfs) self.assertTrue(self.remote_restart.called)
def test_configure_sriov_auto_avoid_recall(self, _os_chmod): self.os_release.return_value = 'mitaka' _config = { 'enable-sriov': True, 'sriov-numvfs': 'auto' } self._configure_sriov_base(_config) nutils.configure_sriov() self.mock_sriov_device2.sriov_numvfs = 64 self.mock_sriov_device2.set_sriov_numvfs.assert_called_with( self.mock_sriov_device2.sriov_totalvfs) self.mock_sriov_device2._set_sriov_numvfs.assert_not_called() self.assertTrue(self.remote_restart.called)