summaryrefslogtreecommitdiffstats
path: root/nova/vsa
diff options
context:
space:
mode:
authorMark McLoughlin <markmc@redhat.com>2012-01-23 11:51:14 +0000
committerMark McLoughlin <markmc@redhat.com>2012-01-28 12:37:16 +0000
commit82049af90e86380043c59741fa4e1cd2cf24aaa7 (patch)
treefd5a35b7a373de888ece003929f8c499b34ce83c /nova/vsa
parent02b872625b94c3c63674d8c64b23f80215b04a15 (diff)
Refactor away the flags.DEFINE_* helpers
The next obvious step in porting to cfg is to define all options using cfg schemas directly rather than using the flags.DEFINE_* helpers. This is a large change, but it is almost entirely pure refactoring and does not result in any functional changes. The only change to note is that the default values for glance_host, glance_api_servers and default_publisher_id options are now using opt value interpolation i.e. -glance_host=_get_my_ip() +glance_host='$my_ip' -glance_api_servers=['%s:%d' % (FLAGS.glance_host, FLAGS.glance_port)] +glance_api_servers=['$glance_host:$glance_port'] -default_publisher_id=FLAGS.host +default_publisher_id='$host' Also note that the lower_bound check on the {report,periodic}_interval options are no more, but this has been true since cfg was first added. Change-Id: Ia58c8f0aaf61628bb55b1b8485118a2a9852ed17
Diffstat (limited to 'nova/vsa')
-rw-r--r--nova/vsa/api.py25
-rw-r--r--nova/vsa/manager.py9
2 files changed, 24 insertions, 10 deletions
diff --git a/nova/vsa/api.py b/nova/vsa/api.py
index 27baff151..9c2bc0ce2 100644
--- a/nova/vsa/api.py
+++ b/nova/vsa/api.py
@@ -25,6 +25,7 @@ For assistance and guidelines pls contact
import sys
+from nova.common import cfg
from nova import compute
from nova import exception
from nova import flags
@@ -45,15 +46,23 @@ class VsaState:
DELETING = 'deleting' # VSA started the deletion procedure
+vsa_opts = [
+ cfg.StrOpt('vsa_ec2_access_key',
+ default=None,
+ help='EC2 access key used by VSA for accessing nova'),
+ cfg.StrOpt('vsa_ec2_user_id',
+ default=None,
+ help='User ID used by VSA for accessing nova'),
+ cfg.BoolOpt('vsa_multi_vol_creation',
+ default=True,
+ help='Ask scheduler to create multiple volumes in one call'),
+ cfg.StrOpt('vsa_volume_type_name',
+ default='VSA volume type',
+ help='Name of volume type associated with FE VSA volumes'),
+ ]
+
FLAGS = flags.FLAGS
-flags.DEFINE_string('vsa_ec2_access_key', None,
- 'EC2 access key used by VSA for accessing nova')
-flags.DEFINE_string('vsa_ec2_user_id', None,
- 'User ID used by VSA for accessing nova')
-flags.DEFINE_boolean('vsa_multi_vol_creation', True,
- 'Ask scheduler to create multiple volumes in one call')
-flags.DEFINE_string('vsa_volume_type_name', 'VSA volume type',
- 'Name of volume type associated with FE VSA volumes')
+FLAGS.add_options(vsa_opts)
LOG = logging.getLogger('nova.vsa')
diff --git a/nova/vsa/manager.py b/nova/vsa/manager.py
index 850d99581..42b5b1032 100644
--- a/nova/vsa/manager.py
+++ b/nova/vsa/manager.py
@@ -22,6 +22,7 @@ Handles all processes relating to Virtual Storage Arrays (VSA).
"""
+from nova.common import cfg
from nova import compute
from nova import exception
from nova import flags
@@ -34,9 +35,13 @@ from nova.compute import instance_types
from nova.vsa import utils as vsa_utils
from nova.vsa.api import VsaState
+vsa_driver_opt = \
+ cfg.StrOpt('vsa_driver',
+ default='nova.vsa.connection.get_connection',
+ help='Driver to use for controlling VSAs')
+
FLAGS = flags.FLAGS
-flags.DEFINE_string('vsa_driver', 'nova.vsa.connection.get_connection',
- 'Driver to use for controlling VSAs')
+FLAGS.add_option(vsa_driver_opt)
LOG = logging.getLogger('nova.vsa.manager')