~ubuntu-branches/ubuntu/raring/quantum/raring-proposed

« back to all changes in this revision

Viewing changes to quantum/plugins/metaplugin/meta_quantum_plugin.py

  • Committer: Package Import Robot
  • Author(s): Chuck Short, Chuck Short, Yolanda Robla, James Page, Maru Newby
  • Date: 2013-01-11 09:14:35 UTC
  • mfrom: (2.1.17)
  • Revision ID: package-import@ubuntu.com-20130111091435-vaup7dwmtmajy5oe
Tags: 2013.1~g2-0ubuntu1
[ Chuck Short ]
* New upstream version. 
* debian/patches/fix-quantum-configuration.patch: Refreshed.

[ Yolanda Robla ]
* debian/quantum-l3-agent.quantum-metadata-agent.upstart: Add
  upstart configuration for Metadata Agent.
* debian/quantum-l3-agent.install: Added quantum-ns-metadata-proxy,
  quantum-metadata-agent and metadata_agent.ini.
* debian/patches/fix-quantum-configuration.patch: Update rootwrap
  configuration in metadata_agent.ini file.
* debian/changelog: Updated package version
* d/p/fix-quantum-configuration.patch: refresh patches

[ James Page ]
* d/*.install: Install entry points from bin directory instead
  of easy-install ones generated during the package build process
  (LP: #1085038).
* d/control: Drop BD on python-dev-all; its not required.
* d/rules: Install multiple upstart configurations for quantum-l3-agent.
* d/control: Tidy package descriptions.
* d/*.postrm: Drop as debhelper will generate update-rc.d calls in
  maintainer scripts if required.
* d/quantum-common.postinst: Tweak permissions setting so that /etc/quantum
  is not owned/writable by the quantum user, ensure that /etc/quantum/rootwrap*
  is owned by root:root.
* d/*agent*.postinst: Dropped as permissions now correctly set in
  quantum-common.
* d/patches/fix-quantum-configuration.patch: Re-add dropped fixes rootwrap and
  sqlite defaults for all plugins.
* d/control: Added new BD on alembic (>= 0.4.1~), version python-mock >= 1.0b1.

[ Maru Newby ]
* debian/control: Remove unnecessary openvswitch-vswitch dependency
  from quantum-plugin-openvswitch (LP: #1076747).

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
# vim: tabstop=4 shiftwidth=4 softtabstop=4
2
 
#
 
2
 
3
3
# Copyright 2012, Nachi Ueno, NTT MCL, Inc.
4
4
# All Rights Reserved.
5
5
#
15
15
#    License for the specific language governing permissions and limitations
16
16
#    under the License.
17
17
 
18
 
import logging
19
 
 
20
18
from quantum.api.v2 import attributes
21
19
from quantum.common import exceptions as exc
22
20
from quantum.common.utils import find_config_file
27
25
from quantum.extensions.flavor import (FLAVOR_NETWORK, FLAVOR_ROUTER)
28
26
from quantum.openstack.common import cfg
29
27
from quantum.openstack.common import importutils
 
28
from quantum.openstack.common import log as logging
30
29
from quantum.plugins.metaplugin.common import config
31
30
from quantum.plugins.metaplugin import meta_db_v2
32
31
from quantum.plugins.metaplugin.meta_models_v2 import (NetworkFlavor,
33
32
                                                       RouterFlavor)
34
33
from quantum import policy
35
34
 
36
 
LOG = logging.getLogger("metaplugin")
 
35
 
 
36
LOG = logging.getLogger(__name__)
37
37
 
38
38
 
39
39
# Metaplugin  Exceptions
49
49
                   l3_db.L3_NAT_db_mixin):
50
50
 
51
51
    def __init__(self, configfile=None):
52
 
        LOG.debug("Start initializing metaplugin")
53
 
        options = {"sql_connection": cfg.CONF.DATABASE.sql_connection}
54
 
        options.update({'base': models_v2.model_base.BASEV2})
55
 
        sql_max_retries = cfg.CONF.DATABASE.sql_max_retries
56
 
        options.update({"sql_max_retries": sql_max_retries})
57
 
        reconnect_interval = cfg.CONF.DATABASE.reconnect_interval
58
 
        options.update({"reconnect_interval": reconnect_interval})
 
52
        LOG.debug(_("Start initializing metaplugin"))
59
53
        self.supported_extension_aliases = \
60
54
            cfg.CONF.META.supported_extension_aliases.split(',')
61
55
        self.supported_extension_aliases += ['flavor', 'router']
96
90
 
97
91
        self.default_flavor = cfg.CONF.META.default_flavor
98
92
        if not self.default_flavor in self.plugins:
99
 
            raise exc.Invalid('default_flavor %s is not plugin list' %
 
93
            raise exc.Invalid(_('default_flavor %s is not plugin list') %
100
94
                              self.default_flavor)
101
95
 
102
96
        self.default_l3_flavor = cfg.CONF.META.default_l3_flavor
103
97
        if not self.default_l3_flavor in self.l3_plugins:
104
 
            raise exc.Invalid('default_l3_flavor %s is not plugin list' %
 
98
            raise exc.Invalid(_('default_l3_flavor %s is not plugin list') %
105
99
                              self.default_l3_flavor)
106
100
 
107
 
        db.configure_db(options)
 
101
        db.configure_db()
108
102
 
109
103
        self.extension_map = {}
110
104
        if not cfg.CONF.META.extension_map == '':
117
111
        self.default_flavor = cfg.CONF.META.default_flavor
118
112
 
119
113
    def _load_plugin(self, plugin_provider):
120
 
        LOG.debug("Plugin location:%s", plugin_provider)
 
114
        LOG.debug(_("Plugin location: %s"), plugin_provider)
121
115
        plugin_klass = importutils.import_class(plugin_provider)
122
116
        return plugin_klass()
123
117
 
168
162
            if not self._is_l3_plugin(plugin):
169
163
                self._process_l3_create(context, network['network'], net['id'])
170
164
                self._extend_network_dict_l3(context, net)
171
 
            LOG.debug("Created network: %s with flavor %s " % (net['id'],
172
 
                                                               flavor))
 
165
            LOG.debug(_("Created network: %(net_id)s with flavor "
 
166
                        "%(flavor)s"), {'net_id': net['id'], 'flavor': flavor})
173
167
            try:
174
168
                meta_db_v2.add_network_flavor_binding(context.session,
175
169
                                                      flavor, str(net['id']))
176
170
            except:
177
 
                LOG.exception('failed to add flavor bindings')
 
171
                LOG.exception(_('Failed to add flavor bindings'))
178
172
                plugin.delete_network(context, net['id'])
179
173
                raise FaildToAddFlavorBinding()
180
174
 
181
 
        LOG.debug("Created network: %s" % net['id'])
 
175
        LOG.debug(_("Created network: %s"), net['id'])
182
176
        self._extend_network_dict(context, net)
183
177
        return net
184
178
 
298
292
        plugin = self._get_l3_plugin(flavor)
299
293
        with context.session.begin(subtransactions=True):
300
294
            r_in_db = plugin.create_router(context, router)
301
 
            LOG.debug("Created router: %s with flavor %s " % (r_in_db['id'],
302
 
                                                              flavor))
 
295
            LOG.debug(_("Created router: %(router_id)s with flavor "
 
296
                        "%(flavor)s"),
 
297
                      {'router_id': r_in_db['id'], 'flavor': flavor})
303
298
            meta_db_v2.add_router_flavor_binding(context.session,
304
299
                                                 flavor, str(r_in_db['id']))
305
300
 
306
 
        LOG.debug("Created router: %s" % r_in_db['id'])
 
301
        LOG.debug(_("Created router: %s"), r_in_db['id'])
307
302
        self._extend_router_dict(context, r_in_db)
308
303
        return r_in_db
309
304