From 6b73c281bcbde20acb00386bbe4c0d4d1c501a04 Mon Sep 17 00:00:00 2001 From: "ChangBo Guo(gcb)" Date: Fri, 10 Feb 2017 19:54:54 +0800 Subject: [PATCH] Remove usage of config option verbose oslo.log deprecate config option verbose since aug 1, 2015 in review: in https://review.openstack.org/#/c/206437/ That was a long time ago so it should be possible to remove it now. This was already merged once but had to be reverted because some projects were still relying on it. Oslo team plan to remove it, so we need clean up its usage before removing it. Closes-Bug: #1663570 Change-Id: I072e1078486f50cebea92695ff46c1af879eb23d --- nova/scheduler/filters/trusted_filter.py | 2 +- nova/tests/fixtures.py | 2 -- nova/tests/functional/integrated_helpers.py | 1 - .../api/openstack/compute/test_consoles.py | 1 - .../unit/api/openstack/compute/test_fping.py | 2 +- .../openstack/compute/test_multiple_create.py | 1 - .../api/openstack/compute/test_serversV21.py | 4 +-- .../api/openstack/compute/test_user_data.py | 1 - tools/xenserver/populate_other_config.py | 7 +++--- tools/xenserver/vm_vdi_cleaner.py | 25 +++++-------------- 10 files changed, 12 insertions(+), 34 deletions(-) diff --git a/nova/scheduler/filters/trusted_filter.py b/nova/scheduler/filters/trusted_filter.py index a44025faff91..c54487ad4eab 100644 --- a/nova/scheduler/filters/trusted_filter.py +++ b/nova/scheduler/filters/trusted_filter.py @@ -29,7 +29,7 @@ are in the ``nova.conf`` file in a separate ``trust`` section. For example, the config file will look something like: [DEFAULT] - verbose=True + debug=True ... [trust] server=attester.mynetwork.com diff --git a/nova/tests/fixtures.py b/nova/tests/fixtures.py index 5149e49921f5..01dea5b48bdc 100644 --- a/nova/tests/fixtures.py +++ b/nova/tests/fixtures.py @@ -769,7 +769,6 @@ class OSAPIFixture(fixtures.Fixture): conf_overrides = { 'osapi_compute_listen': '127.0.0.1', 'osapi_compute_listen_port': 0, - 'verbose': True, 'debug': True, } self.useFixture(ConfPatcher(**conf_overrides)) @@ -805,7 +804,6 @@ class OSMetadataServer(fixtures.Fixture): conf_overrides = { 'metadata_listen': '127.0.0.1', 'metadata_listen_port': 0, - 'verbose': True, 'debug': True } self.useFixture(ConfPatcher(**conf_overrides)) diff --git a/nova/tests/functional/integrated_helpers.py b/nova/tests/functional/integrated_helpers.py index bd123d89453e..e977acc3358a 100644 --- a/nova/tests/functional/integrated_helpers.py +++ b/nova/tests/functional/integrated_helpers.py @@ -72,7 +72,6 @@ class _IntegratedTestBase(test.TestCase): def setUp(self): super(_IntegratedTestBase, self).setUp() - self.flags(verbose=True) # TODO(mriedem): Fix the functional tests to work with Neutron. self.flags(use_neutron=self.USE_NEUTRON) diff --git a/nova/tests/unit/api/openstack/compute/test_consoles.py b/nova/tests/unit/api/openstack/compute/test_consoles.py index 43314780af71..37f68dc95153 100644 --- a/nova/tests/unit/api/openstack/compute/test_consoles.py +++ b/nova/tests/unit/api/openstack/compute/test_consoles.py @@ -123,7 +123,6 @@ def stub_instance(id, user_id='fake', project_id='fake', host=None, class ConsolesControllerTestV21(test.NoDBTestCase): def setUp(self): super(ConsolesControllerTestV21, self).setUp() - self.flags(verbose=True) self.instance_db = FakeInstanceDB() self.stub_out('nova.db.instance_get', self.instance_db.return_server_by_id) diff --git a/nova/tests/unit/api/openstack/compute/test_fping.py b/nova/tests/unit/api/openstack/compute/test_fping.py index 5f7de6362260..6e222a93e0cc 100644 --- a/nova/tests/unit/api/openstack/compute/test_fping.py +++ b/nova/tests/unit/api/openstack/compute/test_fping.py @@ -35,7 +35,7 @@ class FpingTestV21(test.TestCase): def setUp(self): super(FpingTestV21, self).setUp() - self.flags(verbose=True, use_ipv6=False) + self.flags(use_ipv6=False) return_server = fakes.fake_instance_get() return_servers = fakes.fake_instance_get_all_by_filters() self.stub_out("nova.db.instance_get_all_by_filters", diff --git a/nova/tests/unit/api/openstack/compute/test_multiple_create.py b/nova/tests/unit/api/openstack/compute/test_multiple_create.py index c3f46e42da60..61b4dd63a25f 100644 --- a/nova/tests/unit/api/openstack/compute/test_multiple_create.py +++ b/nova/tests/unit/api/openstack/compute/test_multiple_create.py @@ -41,7 +41,6 @@ class MultiCreateExtensionTestV21(test.TestCase): """Shared implementation for tests below that create instance.""" super(MultiCreateExtensionTestV21, self).setUp() - self.flags(verbose=True) self.flags(enable_instance_password=True, group='api') self.instance_cache_num = 0 self.instance_cache_by_id = {} diff --git a/nova/tests/unit/api/openstack/compute/test_serversV21.py b/nova/tests/unit/api/openstack/compute/test_serversV21.py index 892e76da83e2..89dfdca95e4b 100644 --- a/nova/tests/unit/api/openstack/compute/test_serversV21.py +++ b/nova/tests/unit/api/openstack/compute/test_serversV21.py @@ -158,7 +158,7 @@ class ControllerTest(test.TestCase): def setUp(self): super(ControllerTest, self).setUp() - self.flags(verbose=True, use_ipv6=False) + self.flags(use_ipv6=False) fakes.stub_out_key_pair_funcs(self) fake.stub_out_image_service(self) return_server = fakes.fake_compute_get() @@ -2520,7 +2520,6 @@ class ServersControllerCreateTest(test.TestCase): """Shared implementation for tests below that create instance.""" super(ServersControllerCreateTest, self).setUp() - self.flags(verbose=True) self.flags(enable_instance_password=True, group='api') self.instance_cache_num = 0 self.instance_cache_by_id = {} @@ -3835,7 +3834,6 @@ class ServersControllerCreateTestWithMock(test.TestCase): """Shared implementation for tests below that create instance.""" super(ServersControllerCreateTestWithMock, self).setUp() - self.flags(verbose=True) self.flags(enable_instance_password=True, group='api') self.instance_cache_num = 0 self.instance_cache_by_id = {} diff --git a/nova/tests/unit/api/openstack/compute/test_user_data.py b/nova/tests/unit/api/openstack/compute/test_user_data.py index 14f27db7be06..9ce5885a08af 100644 --- a/nova/tests/unit/api/openstack/compute/test_user_data.py +++ b/nova/tests/unit/api/openstack/compute/test_user_data.py @@ -53,7 +53,6 @@ class ServersControllerCreateTest(test.TestCase): """Shared implementation for tests below that create instance.""" super(ServersControllerCreateTest, self).setUp() - self.flags(verbose=True) self.flags(enable_instance_password=True, group='api') self.instance_cache_num = 0 self.instance_cache_by_id = {} diff --git a/tools/xenserver/populate_other_config.py b/tools/xenserver/populate_other_config.py index f99ed29816e9..8613ddfb0b78 100644 --- a/tools/xenserver/populate_other_config.py +++ b/tools/xenserver/populate_other_config.py @@ -28,7 +28,7 @@ populated. Run on compute-worker (not Dom0): - python ./tools/xenserver/populate_other_config.py [--dry-run|--verbose] + python ./tools/xenserver/populate_other_config.py [--dry-run] """ import os import sys @@ -92,9 +92,8 @@ def main(): vm_utils._set_vdi_info(session, vdi_ref, vdi_type, name_label, vdi_type, instance) - if CONF.verbose: - print("Setting other_config for instance_uuid=%s vdi_uuid=%s" % ( - instance_uuid, vdi_rec['uuid'])) + print("Setting other_config for instance_uuid=%s vdi_uuid=%s" % ( + instance_uuid, vdi_rec['uuid'])) if CONF.dry_run: print("Dry run completed") diff --git a/tools/xenserver/vm_vdi_cleaner.py b/tools/xenserver/vm_vdi_cleaner.py index 0c8a5d013b69..6d868b20252b 100755 --- a/tools/xenserver/vm_vdi_cleaner.py +++ b/tools/xenserver/vm_vdi_cleaner.py @@ -49,7 +49,6 @@ cli_opt = cfg.StrOpt('command', CONF = nova.conf.CONF CONF.register_opts(cleaner_opts) CONF.register_cli_opt(cli_opt) -CONF.import_opt('verbose', 'nova.openstack.common.log') ALLOWED_COMMANDS = ["list-vdis", "clean-vdis", "list-instances", @@ -123,8 +122,6 @@ def print_xen_object(obj_type, obj, indent_level=0, spaces_per_indent=4): VM (abcd-abcd-abcd): 'name label here' """ - if not CONF.verbose: - return uuid = obj["uuid"] try: name_label = obj["name_label"] @@ -246,17 +243,13 @@ def find_orphaned_vdi_uuids(xenapi): def list_orphaned_vdis(vdi_uuids): """List orphaned VDIs.""" for vdi_uuid in vdi_uuids: - if CONF.verbose: - print("ORPHANED VDI (%s)" % vdi_uuid) - else: - print(vdi_uuid) + print("ORPHANED VDI (%s)" % vdi_uuid) def clean_orphaned_vdis(xenapi, vdi_uuids): """Clean orphaned VDIs.""" for vdi_uuid in vdi_uuids: - if CONF.verbose: - print("CLEANING VDI (%s)" % vdi_uuid) + print("CLEANING VDI (%s)" % vdi_uuid) vdi_ref = call_xenapi(xenapi, 'VDI.get_by_uuid', vdi_uuid) try: @@ -268,17 +261,13 @@ def clean_orphaned_vdis(xenapi, vdi_uuids): def list_orphaned_instances(orphaned_instances): """List orphaned instances.""" for vm_ref, vm_rec, orphaned_instance in orphaned_instances: - if CONF.verbose: - print("ORPHANED INSTANCE (%s)" % orphaned_instance.name) - else: - print(orphaned_instance.name) + print("ORPHANED INSTANCE (%s)" % orphaned_instance.name) def clean_orphaned_instances(xenapi, orphaned_instances): """Clean orphaned instances.""" for vm_ref, vm_rec, instance in orphaned_instances: - if CONF.verbose: - print("CLEANING INSTANCE (%s)" % instance.name) + print("CLEANING INSTANCE (%s)" % instance.name) cleanup_instance(xenapi, instance, vm_ref, vm_rec) @@ -303,11 +292,9 @@ def main(): xenapi = xenapi_driver.XenAPIDriver(virtapi.VirtAPI()) if command == "list-vdis": - if CONF.verbose: - print("Connected VDIs:\n") + print("Connected VDIs:\n") orphaned_vdi_uuids = find_orphaned_vdi_uuids(xenapi) - if CONF.verbose: - print("\nOrphaned VDIs:\n") + print("\nOrphaned VDIs:\n") list_orphaned_vdis(orphaned_vdi_uuids) elif command == "clean-vdis": orphaned_vdi_uuids = find_orphaned_vdi_uuids(xenapi)