]> review.fuel-infra Code Review - openstack-build/cinder-build.git/commitdiff
Remove redundant 'availability_zone' config options.
authorZhiteng Huang <zhiteng.huang@intel.com>
Wed, 8 Aug 2012 16:41:28 +0000 (00:41 +0800)
committerZhiteng Huang <zhiteng.huang@intel.com>
Thu, 9 Aug 2012 01:56:32 +0000 (09:56 +0800)
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
cinder/scheduler/simple.py
cinder/service.py
cinder/volume/api.py
cinder/volume/manager.py
etc/cinder/cinder.conf.sample

index c47175d8b249d37699c7c4e7f6036e6762677fc1..515e93d8a0719f922bce64de36246bb38edc1a33 100644 (file)
@@ -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',
index 54fe3a0ac127fc631b17ba7f2982112c32dfbbb7..d7c8328944d10c4e42edf826acca4c1cda5084e3 100644 (file)
@@ -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()
 
index 55ee25c9d040c177d36af34d13170edb5d4a1e00..ecbea86e5c3efbe113d37cfcaf2f742a2d5827d1 100644 (file)
@@ -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:
index 852d214fc4d6c5073ff149fa9aec5c383f762f0c..e66147afb389b49d183901f159cc7f2295c16f7c 100644 (file)
@@ -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__)
 
index 28b55cf67e176333cb945316db5553a4780e2950..7346a7559512f59c86a46db6bd58b8c01a842dde 100644 (file)
@@ -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'),
index 3491e9375cbeca551faefd9162a9d76c6f3cbebd..803ccb1fc0a8671fe8dc0cd8358e889302866a78 100644 (file)
 ###### (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
 # 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