diff options
| author | Mark McLoughlin <markmc@redhat.com> | 2012-01-23 11:51:14 +0000 |
|---|---|---|
| committer | Mark McLoughlin <markmc@redhat.com> | 2012-01-28 12:37:16 +0000 |
| commit | 82049af90e86380043c59741fa4e1cd2cf24aaa7 (patch) | |
| tree | fd5a35b7a373de888ece003929f8c499b34ce83c /nova/cloudpipe | |
| parent | 02b872625b94c3c63674d8c64b23f80215b04a15 (diff) | |
| download | nova-82049af90e86380043c59741fa4e1cd2cf24aaa7.tar.gz nova-82049af90e86380043c59741fa4e1cd2cf24aaa7.tar.xz nova-82049af90e86380043c59741fa4e1cd2cf24aaa7.zip | |
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/cloudpipe')
| -rw-r--r-- | nova/cloudpipe/pipelib.py | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/nova/cloudpipe/pipelib.py b/nova/cloudpipe/pipelib.py index 0e86f89b1..3c92f72b1 100644 --- a/nova/cloudpipe/pipelib.py +++ b/nova/cloudpipe/pipelib.py @@ -27,6 +27,7 @@ import string import tempfile import zipfile +from nova.common import cfg from nova import context from nova import crypto from nova import db @@ -39,16 +40,20 @@ from nova.api.ec2 import cloud from nova.api.ec2 import ec2utils +cloudpipe_opts = [ + cfg.StrOpt('boot_script_template', + default=utils.abspath('cloudpipe/bootscript.template'), + help=_('Template for cloudpipe instance boot script')), + cfg.StrOpt('dmz_net', + default='10.0.0.0', + help=_('Network to push into openvpn config')), + cfg.StrOpt('dmz_mask', + default='255.255.255.0', + help=_('Netmask to push into openvpn config')), + ] + FLAGS = flags.FLAGS -flags.DEFINE_string('boot_script_template', - utils.abspath('cloudpipe/bootscript.template'), - _('Template for script to run on cloudpipe instance boot')) -flags.DEFINE_string('dmz_net', - '10.0.0.0', - _('Network to push into openvpn config')) -flags.DEFINE_string('dmz_mask', - '255.255.255.0', - _('Netmask to push into openvpn config')) +FLAGS.add_options(cloudpipe_opts) LOG = logging.getLogger('nova.cloudpipe') |
