From 30a591616687f41af4cfa2605078a436b2bd795d Mon Sep 17 00:00:00 2001 From: Zhiteng Huang Date: Thu, 9 Aug 2012 00:41:28 +0800 Subject: [PATCH] Remove redundant 'availability_zone' config options. There are two availability_zone related config options now: node_availability_zone and storage_availability_zone While volume API uses node_availability_zone, the scheduler uses the other, which causes failure in scheduler when these two options have different values. This patch removes 'node_availability_zone' so that end user can specify 'availability zone' when create volumes using Simple scheduler. Partially implement blueprint implement-availability-zones Change-Id: Ia2f0710908495ec64dacd2ee9bd10d7f8cd415df --- cinder/flags.py | 2 +- cinder/scheduler/simple.py | 2 +- cinder/service.py | 4 ++-- cinder/volume/api.py | 1 - cinder/volume/manager.py | 4 ---- etc/cinder/cinder.conf.sample | 4 +--- 6 files changed, 5 insertions(+), 12 deletions(-) diff --git a/cinder/flags.py b/cinder/flags.py index c47175d8b..515e93d8a 100644 --- a/cinder/flags.py +++ b/cinder/flags.py @@ -218,7 +218,7 @@ global_opts = [ default=socket.gethostname(), help='Name of this node. This can be an opaque identifier. ' 'It is not necessarily a hostname, FQDN, or IP address.'), - cfg.StrOpt('node_availability_zone', + cfg.StrOpt('storage_availability_zone', default='cinder', help='availability zone of this node'), cfg.StrOpt('notification_driver', diff --git a/cinder/scheduler/simple.py b/cinder/scheduler/simple.py index 54fe3a0ac..d7c832894 100644 --- a/cinder/scheduler/simple.py +++ b/cinder/scheduler/simple.py @@ -43,7 +43,7 @@ FLAGS.register_opts(simple_scheduler_opts) class SimpleScheduler(chance.ChanceScheduler): """Implements Naive Scheduler that tries to find least loaded host.""" - def schedule_create_volume(self, context, volume_id, *_args, **_kwargs): + def schedule_create_volume(self, context, volume_id, **_kwargs): """Picks a host that is up and has the fewest volumes.""" elevated = context.elevated() diff --git a/cinder/service.py b/cinder/service.py index 55ee25c9d..ecbea86e5 100644 --- a/cinder/service.py +++ b/cinder/service.py @@ -202,7 +202,7 @@ class Service(object): self.timers.append(periodic) def _create_service_ref(self, context): - zone = FLAGS.node_availability_zone + zone = FLAGS.storage_availability_zone service_ref = db.service_create(context, {'host': self.host, 'binary': self.binary, @@ -289,7 +289,7 @@ class Service(object): def report_state(self): """Update the state of this service in the datastore.""" ctxt = context.get_admin_context() - zone = FLAGS.node_availability_zone + zone = FLAGS.storage_availability_zone state_catalog = {} try: try: diff --git a/cinder/volume/api.py b/cinder/volume/api.py index 852d214fc..e66147afb 100644 --- a/cinder/volume/api.py +++ b/cinder/volume/api.py @@ -41,7 +41,6 @@ volume_host_opt = cfg.BoolOpt('snapshot_same_host', FLAGS = flags.FLAGS FLAGS.register_opt(volume_host_opt) -flags.DECLARE('storage_availability_zone', 'cinder.volume.manager') LOG = logging.getLogger(__name__) diff --git a/cinder/volume/manager.py b/cinder/volume/manager.py index 28b55cf67..7346a7559 100644 --- a/cinder/volume/manager.py +++ b/cinder/volume/manager.py @@ -29,7 +29,6 @@ intact. :volume_manager: The module name of a class derived from :class:`manager.Manager` (default: :class:`cinder.volume.manager.Manager`). -:storage_availability_zone: Defaults to `cinder`. :volume_driver: Used by :class:`Manager`. Defaults to :class:`cinder.volume.driver.ISCSIDriver`. :volume_group: Name of the group that will contain exported volumes (default: @@ -55,9 +54,6 @@ from cinder.volume import volume_types LOG = logging.getLogger(__name__) volume_manager_opts = [ - cfg.StrOpt('storage_availability_zone', - default='cinder', - help='availability zone of this service'), cfg.StrOpt('volume_driver', default='cinder.volume.driver.ISCSIDriver', help='Driver to use for volume creation'), diff --git a/etc/cinder/cinder.conf.sample b/etc/cinder/cinder.conf.sample index 3491e9375..803ccb1fc 100644 --- a/etc/cinder/cinder.conf.sample +++ b/etc/cinder/cinder.conf.sample @@ -122,7 +122,7 @@ ###### (StrOpt) ip address of this host # my_ip="10.0.0.1" ###### (StrOpt) availability zone of this node -# node_availability_zone="cinder" +# storage_availability_zone="cinder" ###### (StrOpt) Default driver for sending notifications # notification_driver="cinder.notifier.no_op_notifier" ###### (StrOpt) kernel image that indicates not to use a kernel, but to use a raw disk image instead @@ -353,8 +353,6 @@ # rpc_thread_pool_size=1024 ###### (StrOpt) File name of clean sqlite db # sqlite_clean_db="clean.sqlite" -###### (StrOpt) availability zone of this service -# storage_availability_zone="cinder" ###### (BoolOpt) if True, will not discover local volumes # use_local_volumes=true ###### (StrOpt) Driver to use for volume creation -- 2.45.2