From 3c6a0b9f8a6b0c3ce262afb166c63e7b0b3a4947 Mon Sep 17 00:00:00 2001 From: Sergey Vilgelm Date: Mon, 10 Jun 2013 12:28:44 +0400 Subject: [PATCH] Replace FLAGS with cfg.CONF in tests Replace all the FLAGS with cfg.CONF in cinder/tests Large commit was split into several parts Change-Id: I20a188c20f440e4ba3f5167bd65346ec9fb6e90b Fixes: bug #1182037 --- cinder/tests/__init__.py | 24 +++++----- .../test_extended_snapshot_attributes.py | 5 +-- cinder/tests/api/contrib/test_hosts.py | 2 - .../tests/api/contrib/test_volume_actions.py | 4 -- cinder/tests/api/middleware/test_sizelimit.py | 9 ++-- cinder/tests/api/test_extensions.py | 9 ++-- cinder/tests/api/test_router.py | 2 - cinder/tests/api/v1/test_snapshots.py | 2 - cinder/tests/api/v1/test_volumes.py | 7 +-- cinder/tests/api/v2/test_snapshots.py | 2 - cinder/tests/api/v2/test_volumes.py | 13 +++--- cinder/tests/declare_flags.py | 6 +-- cinder/tests/image/fake.py | 4 -- cinder/tests/image/test_glance.py | 8 ++-- cinder/tests/integrated/test_extensions.py | 9 ++-- cinder/tests/runtime_flags.py | 6 +-- cinder/tests/scheduler/test_host_manager.py | 6 +-- cinder/tests/scheduler/test_rpcapi.py | 8 ++-- cinder/tests/scheduler/test_scheduler.py | 5 --- cinder/tests/test_backup.py | 11 +++-- cinder/tests/test_backup_swift.py | 5 +-- cinder/tests/test_db_api.py | 45 ++++++++++++------- cinder/tests/test_drivers_compatibility.py | 9 ++-- cinder/tests/test_emc.py | 5 ++- cinder/tests/test_glusterfs.py | 3 +- cinder/tests/test_nexenta.py | 14 +++--- cinder/tests/test_policy.py | 10 +++-- cinder/tests/test_quota.py | 10 +++-- cinder/tests/test_service.py | 6 ++- cinder/tests/test_utils.py | 10 ++--- cinder/tests/test_volume.py | 26 ++++++----- cinder/tests/test_volume_configuration.py | 23 +++++----- cinder/tests/test_volume_rpcapi.py | 9 ++-- cinder/tests/test_volume_transfer.py | 5 ++- cinder/tests/test_volume_types.py | 5 ++- cinder/tests/test_volume_utils.py | 13 +++--- cinder/tests/test_windows.py | 3 ++ cinder/tests/test_xenapi_sm.py | 3 +- cinder/tests/test_xiv.py | 19 ++++---- cinder/tests/utils.py | 3 +- cinder/tests/windows/windowsutils.py | 8 ++-- 41 files changed, 202 insertions(+), 174 deletions(-) diff --git a/cinder/tests/__init__.py b/cinder/tests/__init__.py index cb265b4aa..270711744 100644 --- a/cinder/tests/__init__.py +++ b/cinder/tests/__init__.py @@ -31,6 +31,7 @@ """ import eventlet + eventlet.monkey_patch() # See http://code.google.com/p/python-nose/issues/detail?id=373 @@ -40,23 +41,26 @@ setattr(__builtin__, '_', lambda x: x) import os import shutil +from oslo.config import cfg + from cinder.db.sqlalchemy.api import get_engine -from cinder import flags -FLAGS = flags.FLAGS _DB = None +CONF = cfg.CONF + def reset_db(): - if FLAGS.database.connection == "sqlite://": + if CONF.database.connection == "sqlite://": engine = get_engine() engine.dispose() conn = engine.connect() conn.connection.executescript(_DB) else: - shutil.copyfile(os.path.join(FLAGS.state_path, FLAGS.sqlite_clean_db), - os.path.join(FLAGS.state_path, FLAGS.sqlite_db)) + shutil.copyfile(os.path.join(CONF.state_path, + CONF.sqlite_clean_db), + os.path.join(CONF.state_path, CONF.sqlite_db)) def setup(): @@ -64,22 +68,22 @@ def setup(): from cinder.db import migration from cinder.tests import fake_flags - fake_flags.set_defaults(FLAGS) + fake_flags.set_defaults(CONF) - if FLAGS.database.connection == "sqlite://": + if CONF.database.connection == "sqlite://": if migration.db_version() > 1: return else: - testdb = os.path.join(FLAGS.state_path, FLAGS.sqlite_db) + testdb = os.path.join(CONF.state_path, CONF.sqlite_db) if os.path.exists(testdb): return migration.db_sync() - if FLAGS.database.connection == "sqlite://": + if CONF.database.connection == "sqlite://": global _DB engine = get_engine() conn = engine.connect() _DB = "".join(line for line in conn.connection.iterdump()) else: - cleandb = os.path.join(FLAGS.state_path, FLAGS.sqlite_clean_db) + cleandb = os.path.join(CONF.state_path, CONF.sqlite_clean_db) shutil.copyfile(testdb, cleandb) diff --git a/cinder/tests/api/contrib/test_extended_snapshot_attributes.py b/cinder/tests/api/contrib/test_extended_snapshot_attributes.py index 5937ac962..28236d01c 100644 --- a/cinder/tests/api/contrib/test_extended_snapshot_attributes.py +++ b/cinder/tests/api/contrib/test_extended_snapshot_attributes.py @@ -13,21 +13,18 @@ # License for the specific language governing permissions and limitations # under the License. + from lxml import etree import webob from cinder.api.contrib import extended_snapshot_attributes from cinder import exception -from cinder import flags from cinder.openstack.common import jsonutils from cinder import test from cinder.tests.api import fakes from cinder import volume -FLAGS = flags.FLAGS - - UUID1 = '00000000-0000-0000-0000-000000000001' UUID2 = '00000000-0000-0000-0000-000000000002' diff --git a/cinder/tests/api/contrib/test_hosts.py b/cinder/tests/api/contrib/test_hosts.py index 525f96305..3f9112736 100644 --- a/cinder/tests/api/contrib/test_hosts.py +++ b/cinder/tests/api/contrib/test_hosts.py @@ -23,13 +23,11 @@ import webob.exc from cinder.api.contrib import hosts as os_hosts from cinder import context from cinder import db -from cinder import flags from cinder.openstack.common import log as logging from cinder.openstack.common import timeutils from cinder import test -FLAGS = flags.FLAGS LOG = logging.getLogger(__name__) created_time = datetime.datetime(2012, 11, 14, 1, 20, 41, 95099) curr_time = timeutils.utcnow() diff --git a/cinder/tests/api/contrib/test_volume_actions.py b/cinder/tests/api/contrib/test_volume_actions.py index aed906985..38b747f75 100644 --- a/cinder/tests/api/contrib/test_volume_actions.py +++ b/cinder/tests/api/contrib/test_volume_actions.py @@ -20,7 +20,6 @@ import webob from cinder.api.contrib import volume_actions from cinder import exception -from cinder import flags from cinder.openstack.common import jsonutils from cinder.openstack.common.rpc import common as rpc_common from cinder import test @@ -30,9 +29,6 @@ from cinder import volume from cinder.volume import api as volume_api -FLAGS = flags.FLAGS - - def fake_volume_api(*args, **kwargs): return True diff --git a/cinder/tests/api/middleware/test_sizelimit.py b/cinder/tests/api/middleware/test_sizelimit.py index 3b87a2cd9..c955d386e 100644 --- a/cinder/tests/api/middleware/test_sizelimit.py +++ b/cinder/tests/api/middleware/test_sizelimit.py @@ -13,14 +13,17 @@ # under the License. import StringIO + +from oslo.config import cfg import webob from cinder.api.middleware import sizelimit -from cinder import flags from cinder import test -FLAGS = flags.FLAGS -MAX_REQUEST_BODY_SIZE = FLAGS.osapi_max_request_body_size + +CONF = cfg.CONF + +MAX_REQUEST_BODY_SIZE = CONF.osapi_max_request_body_size class TestLimitingReader(test.TestCase): diff --git a/cinder/tests/api/test_extensions.py b/cinder/tests/api/test_extensions.py index 9ad19f18e..d46dbcad5 100644 --- a/cinder/tests/api/test_extensions.py +++ b/cinder/tests/api/test_extensions.py @@ -18,22 +18,25 @@ import iso8601 from lxml import etree +from oslo.config import cfg import webob from cinder.api.v1 import router from cinder.api import xmlutil -from cinder import flags from cinder.openstack.common import jsonutils from cinder import test -FLAGS = flags.FLAGS + NS = "{http://docs.openstack.org/common/api/v1.0}" +CONF = cfg.CONF + + class ExtensionTestCase(test.TestCase): def setUp(self): super(ExtensionTestCase, self).setUp() - ext_list = FLAGS.osapi_volume_extension[:] + ext_list = CONF.osapi_volume_extension[:] fox = ('cinder.tests.api.extensions.foxinsocks.Foxinsocks') if fox not in ext_list: ext_list.append(fox) diff --git a/cinder/tests/api/test_router.py b/cinder/tests/api/test_router.py index 9a3f3da2a..f63c287f3 100644 --- a/cinder/tests/api/test_router.py +++ b/cinder/tests/api/test_router.py @@ -19,12 +19,10 @@ from cinder.api.v1 import router from cinder.api.v1 import snapshots from cinder.api.v1 import volumes from cinder.api import versions -from cinder import flags from cinder.openstack.common import log as logging from cinder import test from cinder.tests.api import fakes -FLAGS = flags.FLAGS LOG = logging.getLogger(__name__) diff --git a/cinder/tests/api/v1/test_snapshots.py b/cinder/tests/api/v1/test_snapshots.py index 6a13179ac..a0c0fa0b5 100644 --- a/cinder/tests/api/v1/test_snapshots.py +++ b/cinder/tests/api/v1/test_snapshots.py @@ -21,7 +21,6 @@ import webob from cinder.api.v1 import snapshots from cinder import db from cinder import exception -from cinder import flags from cinder.openstack.common import log as logging from cinder import test from cinder.tests.api import fakes @@ -29,7 +28,6 @@ from cinder.tests.api.v1 import stubs from cinder import volume -FLAGS = flags.FLAGS LOG = logging.getLogger(__name__) UUID = '00000000-0000-0000-0000-000000000001' diff --git a/cinder/tests/api/v1/test_volumes.py b/cinder/tests/api/v1/test_volumes.py index b199ca40e..3b0df4e71 100644 --- a/cinder/tests/api/v1/test_volumes.py +++ b/cinder/tests/api/v1/test_volumes.py @@ -16,6 +16,7 @@ import datetime from lxml import etree +from oslo.config import cfg import webob from cinder.api import extensions @@ -23,7 +24,6 @@ from cinder.api.v1 import volumes from cinder import context from cinder import db from cinder import exception -from cinder import flags from cinder import test from cinder.tests.api import fakes from cinder.tests.api.v2 import stubs @@ -31,11 +31,12 @@ from cinder.tests.image import fake as fake_image from cinder.volume import api as volume_api -FLAGS = flags.FLAGS NS = '{http://docs.openstack.org/volume/api/v1}' TEST_SNAPSHOT_UUID = '00000000-0000-0000-0000-000000000001' +CONF = cfg.CONF + def stub_snapshot_get(self, context, snapshot_id): if snapshot_id != TEST_SNAPSHOT_UUID: @@ -94,7 +95,7 @@ class VolumeApiTest(test.TestCase): self.assertEqual(res_dict, expected) def test_volume_create_with_type(self): - vol_type = FLAGS.default_volume_type + vol_type = CONF.default_volume_type db.volume_type_create(context.get_admin_context(), dict(name=vol_type, extra_specs={})) db_vol_type = db.volume_type_get_by_name(context.get_admin_context(), diff --git a/cinder/tests/api/v2/test_snapshots.py b/cinder/tests/api/v2/test_snapshots.py index f003cb0b3..5404ab102 100644 --- a/cinder/tests/api/v2/test_snapshots.py +++ b/cinder/tests/api/v2/test_snapshots.py @@ -21,7 +21,6 @@ import webob from cinder.api.v2 import snapshots from cinder import db from cinder import exception -from cinder import flags from cinder.openstack.common import log as logging from cinder import test from cinder.tests.api import fakes @@ -29,7 +28,6 @@ from cinder.tests.api.v2 import stubs from cinder import volume -FLAGS = flags.FLAGS LOG = logging.getLogger(__name__) UUID = '00000000-0000-0000-0000-000000000001' diff --git a/cinder/tests/api/v2/test_volumes.py b/cinder/tests/api/v2/test_volumes.py index 7264c30a4..377fb1ec5 100644 --- a/cinder/tests/api/v2/test_volumes.py +++ b/cinder/tests/api/v2/test_volumes.py @@ -13,9 +13,11 @@ # License for the specific language governing permissions and limitations # under the License. + import datetime from lxml import etree +from oslo.config import cfg import webob from cinder.api import extensions @@ -23,7 +25,6 @@ from cinder.api.v2 import volumes from cinder import context from cinder import db from cinder import exception -from cinder import flags from cinder import test from cinder.tests.api import fakes from cinder.tests.api.v2 import stubs @@ -31,7 +32,8 @@ from cinder.tests.image import fake as fake_image from cinder.volume import api as volume_api -FLAGS = flags.FLAGS +CONF = cfg.CONF + NS = '{http://docs.openstack.org/api/openstack-volume/2.0/content}' TEST_SNAPSHOT_UUID = '00000000-0000-0000-0000-000000000001' @@ -98,9 +100,10 @@ class VolumeApiTest(test.TestCase): self.assertEqual(res_dict, expected) def test_volume_create_with_type(self): - vol_type = db.volume_type_create(context.get_admin_context(), - dict(name=FLAGS.default_volume_type, - extra_specs={})) + vol_type = db.volume_type_create( + context.get_admin_context(), + dict(name=CONF.default_volume_type, extra_specs={}) + ) db_vol_type = db.volume_type_get(context.get_admin_context(), vol_type.id) diff --git a/cinder/tests/declare_flags.py b/cinder/tests/declare_flags.py index 4f569c026..0eacd85d9 100644 --- a/cinder/tests/declare_flags.py +++ b/cinder/tests/declare_flags.py @@ -16,9 +16,9 @@ # License for the specific language governing permissions and limitations # under the License. + from oslo.config import cfg -from cinder import flags -FLAGS = flags.FLAGS -FLAGS.register_opt(cfg.IntOpt('answer', default=42, help='test flag')) +CONF = cfg.CONF +CONF.register_opt(cfg.IntOpt('answer', default=42, help='test flag')) diff --git a/cinder/tests/image/fake.py b/cinder/tests/image/fake.py index e8feb2433..814b3bd82 100644 --- a/cinder/tests/image/fake.py +++ b/cinder/tests/image/fake.py @@ -23,7 +23,6 @@ import datetime import uuid from cinder import exception -from cinder import flags import cinder.image.glance from cinder.openstack.common import log as logging @@ -31,9 +30,6 @@ from cinder.openstack.common import log as logging LOG = logging.getLogger(__name__) -FLAGS = flags.FLAGS - - class _FakeImageService(object): """Mock (fake) image service for unit testing.""" diff --git a/cinder/tests/image/test_glance.py b/cinder/tests/image/test_glance.py index 745f8b654..9248d0f31 100644 --- a/cinder/tests/image/test_glance.py +++ b/cinder/tests/image/test_glance.py @@ -19,17 +19,17 @@ import datetime import glanceclient.exc +from glanceclient.v2.client import Client as glanceclient_v2 +from oslo.config import cfg from cinder import context from cinder import exception -from cinder import flags from cinder.image import glance from cinder import test from cinder.tests.glance import stubs as glance_stubs -from glanceclient.v2.client import Client as glanceclient_v2 -FLAGS = flags.FLAGS +CONF = cfg.CONF class NullWriter(object): @@ -575,7 +575,7 @@ class TestGlanceClientVersion(test.TestCase): 9292) self.assertEquals(client_wrapper_v2.client.__module__, 'glanceclient.v2.client') - FLAGS.reset() + CONF.reset() def test_glance_version_by_arg(self): """Test glance version set by arg to GlanceClientWrapper""" diff --git a/cinder/tests/integrated/test_extensions.py b/cinder/tests/integrated/test_extensions.py index 363baed66..039ecbe13 100644 --- a/cinder/tests/integrated/test_extensions.py +++ b/cinder/tests/integrated/test_extensions.py @@ -15,19 +15,22 @@ # License for the specific language governing permissions and limitations # under the License. -from cinder import flags + +from oslo.config import cfg + from cinder.openstack.common import log as logging from cinder.tests.integrated import integrated_helpers -FLAGS = flags.FLAGS +CONF = cfg.CONF + LOG = logging.getLogger(__name__) class ExtensionsTest(integrated_helpers._IntegratedTestBase): def _get_flags(self): f = super(ExtensionsTest, self)._get_flags() - f['osapi_volume_extension'] = FLAGS.osapi_volume_extension[:] + f['osapi_volume_extension'] = CONF.osapi_volume_extension[:] f['osapi_volume_extension'].append( 'cinder.tests.api.extensions.foxinsocks.Foxinsocks') return f diff --git a/cinder/tests/runtime_flags.py b/cinder/tests/runtime_flags.py index ad2994cde..ca90e2694 100644 --- a/cinder/tests/runtime_flags.py +++ b/cinder/tests/runtime_flags.py @@ -16,9 +16,9 @@ # License for the specific language governing permissions and limitations # under the License. + from oslo.config import cfg -from cinder import flags -FLAGS = flags.FLAGS -FLAGS.register_opt(cfg.IntOpt('runtime_answer', default=54, help='test flag')) +CONF = cfg.CONF +CONF.register_opt(cfg.IntOpt('runtime_answer', default=54, help='test flag')) diff --git a/cinder/tests/scheduler/test_host_manager.py b/cinder/tests/scheduler/test_host_manager.py index ca3a9f521..960d59bd6 100644 --- a/cinder/tests/scheduler/test_host_manager.py +++ b/cinder/tests/scheduler/test_host_manager.py @@ -16,10 +16,10 @@ Tests For HostManager """ +from oslo.config import cfg from cinder import db from cinder import exception -from cinder import flags from cinder.openstack.common.scheduler import filters from cinder.openstack.common import timeutils from cinder.scheduler import host_manager @@ -27,7 +27,7 @@ from cinder import test from cinder.tests.scheduler import fakes -FLAGS = flags.FLAGS +CONF = cfg.CONF class FakeFilterClass1(filters.BaseHostFilter): @@ -137,7 +137,7 @@ class HostManagerTestCase(test.TestCase): def test_get_all_host_states(self): context = 'fake_context' - topic = FLAGS.volume_topic + topic = CONF.volume_topic self.mox.StubOutWithMock(db, 'service_get_all_by_topic') self.mox.StubOutWithMock(host_manager.LOG, 'warn') diff --git a/cinder/tests/scheduler/test_rpcapi.py b/cinder/tests/scheduler/test_rpcapi.py index 52fbb18aa..ce2509c01 100644 --- a/cinder/tests/scheduler/test_rpcapi.py +++ b/cinder/tests/scheduler/test_rpcapi.py @@ -18,14 +18,16 @@ Unit Tests for cinder.scheduler.rpcapi """ + +from oslo.config import cfg + from cinder import context -from cinder import flags from cinder.openstack.common import rpc from cinder.scheduler import rpcapi as scheduler_rpcapi from cinder import test -FLAGS = flags.FLAGS +CONF = cfg.CONF class SchedulerRpcAPITestCase(test.TestCase): @@ -58,7 +60,7 @@ class SchedulerRpcAPITestCase(test.TestCase): retval = getattr(rpcapi, method)(ctxt, **kwargs) self.assertEqual(retval, expected_retval) - expected_args = [ctxt, FLAGS.scheduler_topic, expected_msg] + expected_args = [ctxt, CONF.scheduler_topic, expected_msg] for arg, expected_arg in zip(self.fake_args, expected_args): self.assertEqual(arg, expected_arg) diff --git a/cinder/tests/scheduler/test_scheduler.py b/cinder/tests/scheduler/test_scheduler.py index 5a954ad01..7cf279675 100644 --- a/cinder/tests/scheduler/test_scheduler.py +++ b/cinder/tests/scheduler/test_scheduler.py @@ -19,11 +19,9 @@ Tests For Scheduler """ - from cinder import context from cinder import db from cinder import exception -from cinder import flags from cinder.openstack.common import timeutils from cinder.scheduler import driver from cinder.scheduler import manager @@ -31,9 +29,6 @@ from cinder import test from cinder import utils -FLAGS = flags.FLAGS - - class SchedulerManagerTestCase(test.TestCase): """Test case for scheduler manager.""" diff --git a/cinder/tests/test_backup.py b/cinder/tests/test_backup.py index bffddb36c..9679ea8ae 100644 --- a/cinder/tests/test_backup.py +++ b/cinder/tests/test_backup.py @@ -19,16 +19,19 @@ Tests for Backup code. import tempfile +from oslo.config import cfg + from cinder import context from cinder import db from cinder import exception -from cinder import flags from cinder.openstack.common import importutils from cinder.openstack.common import log as logging from cinder.openstack.common import timeutils from cinder import test -FLAGS = flags.FLAGS + +CONF = cfg.CONF + LOG = logging.getLogger(__name__) @@ -45,7 +48,7 @@ class BackupTestCase(test.TestCase): self.flags(connection_type='fake', volumes_dir=vol_tmpdir) self.backup_mgr = \ - importutils.import_object(FLAGS.backup_manager) + importutils.import_object(CONF.backup_manager) self.backup_mgr.host = 'testhost' self.ctxt = context.get_admin_context() @@ -74,7 +77,7 @@ class BackupTestCase(test.TestCase): backup['container'] = container backup['status'] = status backup['fail_reason'] = '' - backup['service'] = FLAGS.backup_service + backup['service'] = CONF.backup_service backup['size'] = size backup['object_count'] = object_count return db.backup_create(self.ctxt, backup)['id'] diff --git a/cinder/tests/test_backup_swift.py b/cinder/tests/test_backup_swift.py index 013641729..2c5f97f97 100644 --- a/cinder/tests/test_backup_swift.py +++ b/cinder/tests/test_backup_swift.py @@ -23,18 +23,17 @@ import os import tempfile import zlib +from swiftclient import client as swift + from cinder.backup.services.swift import SwiftBackupService from cinder import context from cinder import db from cinder import exception -from cinder import flags from cinder.openstack.common import log as logging from cinder import test from cinder.tests.backup.fake_swift_client import FakeSwiftClient -from swiftclient import client as swift -FLAGS = flags.FLAGS LOG = logging.getLogger(__name__) diff --git a/cinder/tests/test_db_api.py b/cinder/tests/test_db_api.py index ef12e572d..92ca9ef98 100644 --- a/cinder/tests/test_db_api.py +++ b/cinder/tests/test_db_api.py @@ -13,17 +13,19 @@ """Unit tests for cinder.db.api.""" +import datetime + +from oslo.config import cfg + from cinder import context from cinder import db from cinder import exception -from cinder import flags from cinder.openstack.common import uuidutils from cinder.quota import ReservableResource from cinder import test -from datetime import datetime -from datetime import timedelta -FLAGS = flags.FLAGS + +CONF = cfg.CONF def _quota_reserve(context, project_id): @@ -49,9 +51,11 @@ def _quota_reserve(context, project_id): resource, get_sync(resource, i), 'quota_res_%d' % i) deltas[resource] = i - return db.quota_reserve(context, resources, quotas, deltas, - datetime.utcnow(), datetime.utcnow(), - timedelta(days=1), project_id) + return db.quota_reserve( + context, resources, quotas, deltas, + datetime.datetime.utcnow(), datetime.datetime.utcnow(), + datetime.timedelta(days=1), project_id + ) class ModelsObjectComparatorMixin(object): @@ -224,9 +228,12 @@ class DBAPIServiceTestCase(BaseTest): def test_service_get_all_volume_sorted(self): values = [ - ({'host': 'h1', 'binary': 'a', 'topic': FLAGS.volume_topic}, 100), - ({'host': 'h2', 'binary': 'b', 'topic': FLAGS.volume_topic}, 200), - ({'host': 'h3', 'binary': 'b', 'topic': FLAGS.volume_topic}, 300)] + ({'host': 'h1', 'binary': 'a', 'topic': CONF.volume_topic}, + 100), + ({'host': 'h2', 'binary': 'b', 'topic': CONF.volume_topic}, + 200), + ({'host': 'h3', 'binary': 'b', 'topic': CONF.volume_topic}, + 300)] services = [] for vals, size in values: services.append(self._create_service(vals)) @@ -386,12 +393,15 @@ class DBAPIReservationTestCase(BaseTest): def setUp(self): super(DBAPIReservationTestCase, self).setUp() - self.values = {'uuid': 'sample-uuid', - 'project_id': 'project1', - 'resource': 'resource', - 'delta': 42, - 'expire': datetime.utcnow() + timedelta(days=1), - 'usage': {'id': 1}} + self.values = { + 'uuid': 'sample-uuid', + 'project_id': 'project1', + 'resource': 'resource', + 'delta': 42, + 'expire': (datetime.datetime.utcnow() + + datetime.timedelta(days=1)), + 'usage': {'id': 1} + } def test_reservation_create(self): reservation = db.reservation_create(self.ctxt, **self.values) @@ -463,7 +473,8 @@ class DBAPIReservationTestCase(BaseTest): 'project1')) def test_reservation_expire(self): - self.values['expire'] = datetime.utcnow() + timedelta(days=1) + self.values['expire'] = datetime.datetime.utcnow() + \ + datetime.timedelta(days=1) reservations = _quota_reserve(self.ctxt, 'project1') db.reservation_expire(self.ctxt) diff --git a/cinder/tests/test_drivers_compatibility.py b/cinder/tests/test_drivers_compatibility.py index f69eb65ab..7dc6157de 100644 --- a/cinder/tests/test_drivers_compatibility.py +++ b/cinder/tests/test_drivers_compatibility.py @@ -12,13 +12,16 @@ # License for the specific language governing permissions and limitations # under the License. + +from oslo.config import cfg + from cinder import context -from cinder import flags from cinder.openstack.common import importutils from cinder import test from cinder.volume.drivers.solidfire import SolidFire -FLAGS = flags.FLAGS + +CONF = cfg.CONF RBD_MODULE = "cinder.volume.drivers.rbd.RBDDriver" SHEEPDOG_MODULE = "cinder.volume.drivers.sheepdog.SheepdogDriver" @@ -46,7 +49,7 @@ class VolumeDriverCompatibility(test.TestCase): def setUp(self): super(VolumeDriverCompatibility, self).setUp() - self.manager = importutils.import_object(FLAGS.volume_manager) + self.manager = importutils.import_object(CONF.volume_manager) self.context = context.get_admin_context() def tearDown(self): diff --git a/cinder/tests/test_emc.py b/cinder/tests/test_emc.py index e12a1a943..118434902 100644 --- a/cinder/tests/test_emc.py +++ b/cinder/tests/test_emc.py @@ -16,20 +16,21 @@ # License for the specific language governing permissions and limitations # under the License. -import mox import os import shutil import tempfile from xml.dom.minidom import Document +import mox + from cinder import exception -from cinder import flags from cinder.openstack.common import log as logging from cinder import test from cinder.volume import configuration as conf from cinder.volume.drivers.emc.emc_smis_common import EMCSMISCommon from cinder.volume.drivers.emc.emc_smis_iscsi import EMCSMISISCSIDriver + CINDER_EMC_CONFIG_FILE = '/etc/cinder/cinder_emc_config.xml' LOG = logging.getLogger(__name__) diff --git a/cinder/tests/test_glusterfs.py b/cinder/tests/test_glusterfs.py index 5b3790f5d..762b4a4cc 100644 --- a/cinder/tests/test_glusterfs.py +++ b/cinder/tests/test_glusterfs.py @@ -16,7 +16,7 @@ # under the License. """Unit tests for the GlusterFS driver module.""" -import __builtin__ + import errno import os @@ -29,7 +29,6 @@ from cinder import context from cinder import exception from cinder.exception import ProcessExecutionError from cinder import test - from cinder.volume import configuration as conf from cinder.volume.drivers import glusterfs diff --git a/cinder/tests/test_nexenta.py b/cinder/tests/test_nexenta.py index aadefc1ff..08f9e1d0a 100644 --- a/cinder/tests/test_nexenta.py +++ b/cinder/tests/test_nexenta.py @@ -22,13 +22,15 @@ Unit tests for OpenStack Cinder volume driver import base64 import urllib2 -import cinder.flags +from oslo.config import cfg + from cinder import test from cinder.volume.drivers import nexenta from cinder.volume.drivers.nexenta import jsonrpc from cinder.volume.drivers.nexenta import volume -FLAGS = cinder.flags.FLAGS + +CONF = cfg.CONF class TestNexentaDriver(test.TestCase): @@ -148,9 +150,9 @@ class TestNexentaDriver(test.TestCase): self.assertEquals( retval, {'provider_location': - '%s:%s,1 %s%s 0' % (FLAGS.nexenta_host, - FLAGS.nexenta_iscsi_target_portal_port, - FLAGS.nexenta_target_prefix, + '%s:%s,1 %s%s 0' % (CONF.nexenta_host, + CONF.nexenta_iscsi_target_portal_port, + CONF.nexenta_target_prefix, self.TEST_VOLUME_NAME)}) def __get_test(i): @@ -203,7 +205,7 @@ class TestNexentaDriver(test.TestCase): 'available': '5368709120G', 'health': 'ONLINE'} self.nms_mock.volume.get_child_props( - FLAGS.nexenta_volume, + CONF.nexenta_volume, 'health|size|used|available').AndReturn(stats) self.mox.ReplayAll() stats = self.drv.get_volume_stats(True) diff --git a/cinder/tests/test_policy.py b/cinder/tests/test_policy.py index 5d05273dc..a65fc66ad 100644 --- a/cinder/tests/test_policy.py +++ b/cinder/tests/test_policy.py @@ -21,16 +21,18 @@ import os.path import StringIO import urllib2 +from oslo.config import cfg + from cinder import context from cinder import exception -from cinder import flags import cinder.openstack.common.policy from cinder.openstack.common import policy as common_policy from cinder import policy from cinder import test from cinder import utils -FLAGS = flags.FLAGS + +CONF = cfg.CONF class PolicyFileTestCase(test.TestCase): @@ -209,7 +211,7 @@ class ContextIsAdminPolicyTestCase(test.TestCase): rules = { 'context_is_admin': [["role:administrator"], ["role:johnny-admin"]] } - brain = common_policy.Brain(rules, FLAGS.policy_default_rule) + brain = common_policy.Brain(rules, CONF.policy_default_rule) common_policy.set_brain(brain) ctx = context.RequestContext('fake', 'fake', roles=['johnny-admin']) self.assert_(ctx.is_admin) @@ -224,7 +226,7 @@ class ContextIsAdminPolicyTestCase(test.TestCase): "admin_or_owner": [["role:admin"], ["project_id:%(project_id)s"]], "default": [["rule:admin_or_owner"]], } - brain = common_policy.Brain(rules, FLAGS.policy_default_rule) + brain = common_policy.Brain(rules, CONF.policy_default_rule) common_policy.set_brain(brain) ctx = context.RequestContext('fake', 'fake') self.assertFalse(ctx.is_admin) diff --git a/cinder/tests/test_quota.py b/cinder/tests/test_quota.py index c31ed52c2..6639cd378 100644 --- a/cinder/tests/test_quota.py +++ b/cinder/tests/test_quota.py @@ -16,14 +16,16 @@ # License for the specific language governing permissions and limitations # under the License. + import datetime +from oslo.config import cfg + from cinder import context from cinder import db from cinder.db.sqlalchemy import api as sqa_api from cinder.db.sqlalchemy import models as sqa_models from cinder import exception -from cinder import flags from cinder.openstack.common import rpc from cinder.openstack.common import timeutils from cinder import quota @@ -32,7 +34,7 @@ import cinder.tests.image.fake from cinder import volume -FLAGS = flags.FLAGS +CONF = cfg.CONF class QuotaIntegrationTestCase(test.TestCase): @@ -82,7 +84,7 @@ class QuotaIntegrationTestCase(test.TestCase): def test_too_many_volumes(self): volume_ids = [] - for i in range(FLAGS.quota_volumes): + for i in range(CONF.quota_volumes): vol_ref = self._create_volume() volume_ids.append(vol_ref['id']) self.assertRaises(exception.QuotaError, @@ -130,7 +132,7 @@ class QuotaIntegrationTestCase(test.TestCase): # Make sure the snapshot volume_size isn't included in usage. vol_type = db.volume_type_create(self.context, - dict(name=FLAGS.default_volume_type)) + dict(name=CONF.default_volume_type)) vol_ref2 = volume.API().create(self.context, 10, '', '') usages = db.quota_usage_get_all_by_project(self.context, self.project_id) diff --git a/cinder/tests/test_service.py b/cinder/tests/test_service.py index 38bdff33e..1af498385 100644 --- a/cinder/tests/test_service.py +++ b/cinder/tests/test_service.py @@ -20,18 +20,19 @@ Unit Tests for remote procedure calls using queue """ + import mox from oslo.config import cfg from cinder import context from cinder import db from cinder import exception -from cinder import flags from cinder import manager from cinder import service from cinder import test from cinder import wsgi + test_service_opts = [ cfg.StrOpt("fake_manager", default="cinder.tests.test_service.FakeManager", @@ -43,7 +44,8 @@ test_service_opts = [ default=0, help="Port number to bind test service to"), ] -flags.FLAGS.register_opts(test_service_opts) +CONF = cfg.CONF +CONF.register_opts(test_service_opts) class FakeManager(manager.Manager): diff --git a/cinder/tests/test_utils.py b/cinder/tests/test_utils.py index 2e7b08629..2c807ed19 100644 --- a/cinder/tests/test_utils.py +++ b/cinder/tests/test_utils.py @@ -14,28 +14,27 @@ # License for the specific language governing permissions and limitations # under the License. + import __builtin__ import datetime import hashlib import os -import os.path import paramiko import StringIO import tempfile import uuid import mox +from oslo.config import cfg import cinder from cinder import exception -from cinder import flags -from cinder.openstack.common import strutils from cinder.openstack.common import timeutils from cinder import test from cinder import utils -FLAGS = flags.FLAGS +CONF = cfg.CONF class ExecuteTestCase(test.TestCase): @@ -302,7 +301,8 @@ class GenericUtilsTestCase(test.TestCase): def test_generate_glance_url(self): generated_url = utils.generate_glance_url() - actual_url = "http://%s:%d" % (FLAGS.glance_host, FLAGS.glance_port) + actual_url = "http://%s:%d" % (CONF.glance_host, + CONF.glance_port) self.assertEqual(generated_url, actual_url) def test_read_cached_file(self): diff --git a/cinder/tests/test_volume.py b/cinder/tests/test_volume.py index 39874c81d..64761e831 100644 --- a/cinder/tests/test_volume.py +++ b/cinder/tests/test_volume.py @@ -22,16 +22,16 @@ Tests for Volume Code. import datetime import os - -import mox import shutil import tempfile +import mox +from oslo.config import cfg + from cinder.brick.iscsi import iscsi from cinder import context from cinder import db from cinder import exception -from cinder import flags from cinder.image import image_utils from cinder.openstack.common import importutils from cinder.openstack.common.notifier import api as notifier_api @@ -45,8 +45,10 @@ from cinder.tests.image import fake as fake_image from cinder.volume import configuration as conf from cinder.volume import driver + QUOTAS = quota.QUOTAS -FLAGS = flags.FLAGS + +CONF = cfg.CONF class VolumeTestCase(test.TestCase): @@ -58,7 +60,7 @@ class VolumeTestCase(test.TestCase): self.flags(connection_type='fake', volumes_dir=vol_tmpdir, notification_driver=[test_notifier.__name__]) - self.volume = importutils.import_object(FLAGS.volume_manager) + self.volume = importutils.import_object(CONF.volume_manager) self.context = context.get_admin_context() self.stubs.Set(iscsi.TgtAdm, '_get_target', self.fake_get_target) fake_image.stub_out_image_service(self.stubs) @@ -66,7 +68,7 @@ class VolumeTestCase(test.TestCase): def tearDown(self): try: - shutil.rmtree(FLAGS.volumes_dir) + shutil.rmtree(CONF.volumes_dir) except OSError: pass notifier_api._reset_drivers() @@ -85,10 +87,10 @@ class VolumeTestCase(test.TestCase): vol['image_id'] = image_id vol['user_id'] = 'fake' vol['project_id'] = 'fake' - vol['availability_zone'] = FLAGS.storage_availability_zone + vol['availability_zone'] = CONF.storage_availability_zone vol['status'] = status vol['attach_status'] = "detached" - vol['host'] = FLAGS.host + vol['host'] = CONF.host if metadata is not None: vol['metadata'] = metadata return db.volume_create(context.get_admin_context(), vol) @@ -408,7 +410,7 @@ class VolumeTestCase(test.TestCase): self.assert_(iscsi_target not in targets) targets.append(iscsi_target) - total_slots = FLAGS.iscsi_num_targets + total_slots = CONF.iscsi_num_targets for _index in xrange(total_slots): self._create_volume() for volume_id in volume_ids: @@ -1184,7 +1186,7 @@ class DriverTestCase(test.TestCase): vol_tmpdir = tempfile.mkdtemp() self.flags(volume_driver=self.driver_name, volumes_dir=vol_tmpdir) - self.volume = importutils.import_object(FLAGS.volume_manager) + self.volume = importutils.import_object(CONF.volume_manager) self.context = context.get_admin_context() self.output = "" self.stubs.Set(iscsi.TgtAdm, '_get_target', self.fake_get_target) @@ -1196,7 +1198,7 @@ class DriverTestCase(test.TestCase): def tearDown(self): try: - shutil.rmtree(FLAGS.volumes_dir) + shutil.rmtree(CONF.volumes_dir) except OSError: pass super(DriverTestCase, self).tearDown() @@ -1267,7 +1269,7 @@ class ISCSITestCase(DriverTestCase): iscsi_driver = driver.ISCSIDriver(configuration=configuration) iscsi_driver._execute = lambda *a, **kw: \ - ("%s dummy" % FLAGS.iscsi_ip_address, '') + ("%s dummy" % CONF.iscsi_ip_address, '') volume = {"name": "dummy", "host": "0.0.0.0"} iscsi_driver._do_iscsi_discovery(volume) diff --git a/cinder/tests/test_volume_configuration.py b/cinder/tests/test_volume_configuration.py index d2751c1d9..07da34b7d 100644 --- a/cinder/tests/test_volume_configuration.py +++ b/cinder/tests/test_volume_configuration.py @@ -18,17 +18,15 @@ """Tests for the configuration wrapper in volume drivers.""" + from oslo.config import cfg -from cinder import flags from cinder.openstack.common import log as logging from cinder import test from cinder.volume import configuration -from cinder.volume import driver LOG = logging.getLogger(__name__) -FLAGS = flags.FLAGS volume_opts = [ @@ -39,8 +37,9 @@ more_volume_opts = [ cfg.IntOpt('int_opt', default=1), ] -FLAGS.register_opts(volume_opts) -FLAGS.register_opts(more_volume_opts) +CONF = cfg.CONF +CONF.register_opts(volume_opts) +CONF.register_opts(more_volume_opts) class VolumeConfigurationTest(test.TestCase): @@ -52,20 +51,20 @@ class VolumeConfigurationTest(test.TestCase): def test_group_grafts_opts(self): c = configuration.Configuration(volume_opts, config_group='foo') - self.assertEquals(c.str_opt, FLAGS.foo.str_opt) - self.assertEquals(c.bool_opt, FLAGS.foo.bool_opt) + self.assertEquals(c.str_opt, CONF.foo.str_opt) + self.assertEquals(c.bool_opt, CONF.foo.bool_opt) def test_opts_no_group(self): c = configuration.Configuration(volume_opts) - self.assertEquals(c.str_opt, FLAGS.str_opt) - self.assertEquals(c.bool_opt, FLAGS.bool_opt) + self.assertEquals(c.str_opt, CONF.str_opt) + self.assertEquals(c.bool_opt, CONF.bool_opt) def test_grafting_multiple_opts(self): c = configuration.Configuration(volume_opts, config_group='foo') c.append_config_values(more_volume_opts) - self.assertEquals(c.str_opt, FLAGS.foo.str_opt) - self.assertEquals(c.bool_opt, FLAGS.foo.bool_opt) - self.assertEquals(c.int_opt, FLAGS.foo.int_opt) + self.assertEquals(c.str_opt, CONF.foo.str_opt) + self.assertEquals(c.bool_opt, CONF.foo.bool_opt) + self.assertEquals(c.int_opt, CONF.foo.int_opt) def test_safe_get(self): c = configuration.Configuration(volume_opts, config_group='foo') diff --git a/cinder/tests/test_volume_rpcapi.py b/cinder/tests/test_volume_rpcapi.py index 70735243d..8bf68c7c3 100644 --- a/cinder/tests/test_volume_rpcapi.py +++ b/cinder/tests/test_volume_rpcapi.py @@ -19,16 +19,17 @@ Unit Tests for cinder.volume.rpcapi """ +from oslo.config import cfg + from cinder import context from cinder import db -from cinder import flags from cinder.openstack.common import jsonutils from cinder.openstack.common import rpc from cinder import test from cinder.volume import rpcapi as volume_rpcapi -FLAGS = flags.FLAGS +CONF = cfg.CONF class VolumeRpcAPITestCase(test.TestCase): @@ -37,7 +38,7 @@ class VolumeRpcAPITestCase(test.TestCase): self.context = context.get_admin_context() vol = {} vol['host'] = 'fake_host' - vol['availability_zone'] = FLAGS.storage_availability_zone + vol['availability_zone'] = CONF.storage_availability_zone vol['status'] = "available" vol['attach_status'] = "detached" volume = db.volume_create(self.context, vol) @@ -87,7 +88,7 @@ class VolumeRpcAPITestCase(test.TestCase): host = kwargs['host'] else: host = kwargs['volume']['host'] - expected_topic = '%s.%s' % (FLAGS.volume_topic, host) + expected_topic = '%s.%s' % (CONF.volume_topic, host) self.fake_args = None self.fake_kwargs = None diff --git a/cinder/tests/test_volume_transfer.py b/cinder/tests/test_volume_transfer.py index 1e091117f..034fe51d6 100644 --- a/cinder/tests/test_volume_transfer.py +++ b/cinder/tests/test_volume_transfer.py @@ -13,16 +13,17 @@ # License for the specific language governing permissions and limitations # under the License. """Unit Tests for volume transfers.""" + + import datetime from cinder import context from cinder import db from cinder import exception -from cinder import flags from cinder.openstack.common import log as logging from cinder import test from cinder.transfer import api as transfer_api -from cinder.volume import api as cinder_api + LOG = logging.getLogger(__name__) diff --git a/cinder/tests/test_volume_types.py b/cinder/tests/test_volume_types.py index 0d162d80f..b11fa12ef 100644 --- a/cinder/tests/test_volume_types.py +++ b/cinder/tests/test_volume_types.py @@ -16,19 +16,20 @@ """ Unit Tests for volume types code """ + + import time from cinder import context from cinder.db.sqlalchemy import api as db_api from cinder.db.sqlalchemy import models from cinder import exception -from cinder import flags from cinder.openstack.common import log as logging from cinder import test from cinder.tests import fake_flags from cinder.volume import volume_types -FLAGS = flags.FLAGS + LOG = logging.getLogger(__name__) diff --git a/cinder/tests/test_volume_utils.py b/cinder/tests/test_volume_utils.py index 1521149ac..929397e5e 100644 --- a/cinder/tests/test_volume_utils.py +++ b/cinder/tests/test_volume_utils.py @@ -17,9 +17,11 @@ """Tests For miscellaneous util methods used with volume.""" + +from oslo.config import cfg + from cinder import context from cinder import db -from cinder import flags from cinder.openstack.common import importutils from cinder.openstack.common import log as logging from cinder.openstack.common.notifier import api as notifier_api @@ -29,7 +31,8 @@ from cinder.volume import utils as volume_utils LOG = logging.getLogger(__name__) -FLAGS = flags.FLAGS + +CONF = cfg.CONF class UsageInfoTestCase(test.TestCase): @@ -45,7 +48,7 @@ class UsageInfoTestCase(test.TestCase): self.flags(connection_type='fake', host='fake', notification_driver=[test_notifier.__name__]) - self.volume = importutils.import_object(FLAGS.volume_manager) + self.volume = importutils.import_object(CONF.volume_manager) self.user_id = 'fake' self.project_id = 'fake' self.snapshot_id = 'fake' @@ -63,8 +66,8 @@ class UsageInfoTestCase(test.TestCase): vol['snapshot_id'] = self.snapshot_id vol['user_id'] = self.user_id vol['project_id'] = self.project_id - vol['host'] = FLAGS.host - vol['availability_zone'] = FLAGS.storage_availability_zone + vol['host'] = CONF.host + vol['availability_zone'] = CONF.storage_availability_zone vol['status'] = "creating" vol['attach_status'] = "detached" vol['size'] = self.volume_size diff --git a/cinder/tests/test_windows.py b/cinder/tests/test_windows.py index 709e2f5f2..05b1907ae 100644 --- a/cinder/tests/test_windows.py +++ b/cinder/tests/test_windows.py @@ -18,6 +18,8 @@ """ Unit tests for Windows Server 2012 OpenStack Cinder volume driver """ + + import sys from oslo.config import cfg @@ -27,6 +29,7 @@ from cinder.tests.windows import db_fakes from cinder.tests.windows import windowsutils from cinder.volume.drivers import windows + CONF = cfg.CONF diff --git a/cinder/tests/test_xenapi_sm.py b/cinder/tests/test_xenapi_sm.py index 950bdca9d..4253cf0b0 100644 --- a/cinder/tests/test_xenapi_sm.py +++ b/cinder/tests/test_xenapi_sm.py @@ -16,18 +16,17 @@ # License for the specific language governing permissions and limitations # under the License. + import contextlib import StringIO import mock import mox -from oslo.config import cfg from cinder.db import api as db_api from cinder import exception from cinder import test from cinder.volume import configuration as conf -from cinder.volume import driver as parent_driver from cinder.volume.drivers.xenapi import lib from cinder.volume.drivers.xenapi import sm as driver from cinder.volume.drivers.xenapi import tools diff --git a/cinder/tests/test_xiv.py b/cinder/tests/test_xiv.py index 8db11a0ca..fbb45b14b 100644 --- a/cinder/tests/test_xiv.py +++ b/cinder/tests/test_xiv.py @@ -20,17 +20,16 @@ # Erik Zaadi # Avishay Traeger + import mox +from oslo.config import cfg from cinder import exception -from cinder import flags from cinder import test from cinder.volume import configuration as conf from cinder.volume.drivers import xiv -FLAGS = flags.FLAGS - FAKE = "fake" VOLUME = {'size': 16, 'name': FAKE, @@ -38,6 +37,8 @@ VOLUME = {'size': 16, CONNECTOR = {'initiator': "iqn.2012-07.org.fake:01:948f189c4695", } +CONF = cfg.CONF + class XIVFakeProxyDriver(object): """Fake XIV Proxy Driver.""" @@ -56,10 +57,10 @@ class XIVFakeProxyDriver(object): self.volumes = {} def setup(self, context): - if self.xiv_info['xiv_user'] != FLAGS.san_login: + if self.xiv_info['xiv_user'] != CONF.san_login: raise self.exception.NotAuthorized() - if self.xiv_info['xiv_address'] != FLAGS.san_ip: + if self.xiv_info['xiv_address'] != CONF.san_ip: raise self.exception.HostNotFound(host='fake') def create_volume(self, volume): @@ -127,13 +128,13 @@ class XIVVolumeDriverTest(test.TestCase): """Test that the san flags are passed to the XIV proxy.""" self.assertEquals(self.driver.xiv_proxy.xiv_info['xiv_user'], - FLAGS.san_login) + CONF.san_login) self.assertEquals(self.driver.xiv_proxy.xiv_info['xiv_pass'], - FLAGS.san_password) + CONF.san_password) self.assertEquals(self.driver.xiv_proxy.xiv_info['xiv_address'], - FLAGS.san_ip) + CONF.san_ip) self.assertEquals(self.driver.xiv_proxy.xiv_info['xiv_vol_pool'], - FLAGS.san_clustername) + CONF.san_clustername) def test_setup_should_fail_if_credentials_are_invalid(self): """Test that the xiv_proxy validates credentials.""" diff --git a/cinder/tests/utils.py b/cinder/tests/utils.py index 221e6b097..5b775f723 100644 --- a/cinder/tests/utils.py +++ b/cinder/tests/utils.py @@ -14,12 +14,11 @@ # License for the specific language governing permissions and limitations # + import os import cinder.context -FLAGS = cinder.flags.FLAGS - def get_test_admin_context(): return cinder.context.get_admin_context() diff --git a/cinder/tests/windows/windowsutils.py b/cinder/tests/windows/windowsutils.py index 4ef3212eb..4a35a5b4e 100644 --- a/cinder/tests/windows/windowsutils.py +++ b/cinder/tests/windows/windowsutils.py @@ -19,15 +19,15 @@ Windows storage classes to be used in testing. """ import os -import sys -from cinder import flags +from oslo.config import cfg # Check needed for unit testing on Unix if os.name == 'nt': import wmi -FLAGS = flags.FLAGS + +CONF = cfg.CONF class WindowsUtils(object): @@ -89,7 +89,7 @@ class WindowsUtils(object): def _get_vhd_path(self, volume_name): '''Gets the path disk of the volume.''' - base_vhd_folder = FLAGS.windows_iscsi_lun_path + base_vhd_folder = CONF.windows_iscsi_lun_path return os.path.join(base_vhd_folder, volume_name + ".vhd") def delete_snapshot(self, name): -- 2.45.2