~ubuntu-cloud-archive/ubuntu/precise/nova/trunk

« back to all changes in this revision

Viewing changes to nova/openstack/common/rpc/impl_zmq.py

  • Committer: Package Import Robot
  • Author(s): Chuck Short, Adam Gandelman, Chuck Short
  • Date: 2012-07-06 10:18:33 UTC
  • mfrom: (1.1.58)
  • Revision ID: package-import@ubuntu.com-20120706101833-wp2nv392mpe9re8p
Tags: 2012.2~f2-0ubuntu1
[ Adam Gandelman ]
* Use new rootwrap configuration structure:
  - debian/nova-{compute, network, volume}.{pyinstall, pyremove}: Dropped.
  - debian/nova-common.dirs: Add /etc/nova/rootwrap.d/.
  - debian/nova-common.install: Install /etc/nova/rootwrap.conf.
  - debian/debian/nova.conf: Reference rootwrap.conf in calls to
    nova-rootwrap.
  - debian/nova-{compute, network, volume}.install: Install corresponding
    filter in /etc/nova/rootwrap.d/
* debian/rules: Install logging_sample.conf to /etc/nova/logging.conf
  as part of nova-common.
* debian/pydist-overrides: Add setuptools-git.
* debian/control: Add python-setuptools-git as a Build-Depends.
* debian/rules: Do not remove nova.egg-info during auto_clean.  Now that
  upstream has moved to setuptools-git, doing so results in missing files
  from built package.

[ Chuck Short ]
* New upstream release.

Show diffs side-by-side

added added

removed removed

Lines of Context:
40
40
 
41
41
zmq_opts = [
42
42
    cfg.StrOpt('rpc_zmq_bind_address', default='*',
43
 
        help='ZeroMQ bind address. Should be a wildcard (*), '
44
 
             'an ethernet interface, or IP. '
45
 
             'The "host" option should point or resolve to this address.'),
 
43
               help='ZeroMQ bind address. Should be a wildcard (*), '
 
44
                    'an ethernet interface, or IP. '
 
45
                    'The "host" option should point or resolve to this '
 
46
                    'address.'),
46
47
 
47
48
    # The module.Class to use for matchmaking.
48
49
    cfg.StrOpt('rpc_zmq_matchmaker',
49
 
        default='openstack.common.rpc.matchmaker.MatchMakerLocalhost',
 
50
        default='nova.openstack.common.rpc.matchmaker.MatchMakerLocalhost',
50
51
        help='MatchMaker driver'),
51
52
 
52
53
    # The following port is unassigned by IANA as of 2012-05-21
53
54
    cfg.IntOpt('rpc_zmq_port', default=9501,
54
 
        help='ZeroMQ receiver listening port'),
 
55
               help='ZeroMQ receiver listening port'),
55
56
 
56
57
    cfg.IntOpt('rpc_zmq_contexts', default=1,
57
 
        help='Number of ZeroMQ contexts, defaults to 1'),
 
58
               help='Number of ZeroMQ contexts, defaults to 1'),
58
59
 
59
60
    cfg.StrOpt('rpc_zmq_ipc_dir', default='/var/run/openstack',
60
 
        help='Directory for holding IPC sockets'),
61
 
    ]
 
61
               help='Directory for holding IPC sockets'),
 
62
]
62
63
 
63
64
 
64
65
# These globals are defined in register_opts(conf),
119
120
            self.subscribe(f)
120
121
 
121
122
        LOG.debug(_("Connecting to %{addr}s with %{type}s"
122
 
                   "\n-> Subscribed to %{subscribe}s"
123
 
                   "\n-> bind: %{bind}s"),
124
 
                   {'addr': addr, 'type': self.socket_s(),
125
 
                    'subscribe': subscribe, 'bind': bind})
 
123
                    "\n-> Subscribed to %{subscribe}s"
 
124
                    "\n-> bind: %{bind}s"),
 
125
                  {'addr': addr, 'type': self.socket_s(),
 
126
                   'subscribe': subscribe, 'bind': bind})
126
127
 
127
128
        try:
128
129
            if bind:
197
198
 
198
199
    def cast(self, msg_id, topic, data):
199
200
        self.outq.send([str(msg_id), str(topic), str('cast'),
200
 
            _serialize(data)])
 
201
                        _serialize(data)])
201
202
 
202
203
    def close(self):
203
204
        self.outq.close()
306
307
        data.setdefault('version', None)
307
308
        data.setdefault('args', [])
308
309
        proxy.dispatch(ctx, data['version'],
309
 
            data['method'], **data['args'])
 
310
                       data['method'], **data['args'])
310
311
 
311
312
 
312
313
class ZmqBaseReactor(ConsumerBase):
339
340
 
340
341
        # Items push in.
341
342
        inq = ZmqSocket(in_addr, zmq_type_in, bind=in_bind,
342
 
                          subscribe=subscribe)
 
343
                        subscribe=subscribe)
343
344
 
344
345
        self.proxies[inq] = proxy
345
346
        self.sockets.append(inq)
353
354
            raise RPCException("Bad output socktype")
354
355
 
355
356
        # Items push out.
356
 
        outq = ZmqSocket(out_addr, zmq_type_out,
357
 
                           bind=out_bind)
 
357
        outq = ZmqSocket(out_addr, zmq_type_out, bind=out_bind)
358
358
 
359
359
        self.mapping[inq] = outq
360
360
        self.mapping[outq] = inq
428
428
 
429
429
        if not topic in self.topic_proxy:
430
430
            outq = ZmqSocket("ipc://%s/zmq_topic_%s" % (ipc_dir, topic),
431
 
                               sock_type, bind=True)
 
431
                             sock_type, bind=True)
432
432
            self.topic_proxy[topic] = outq
433
433
            self.sockets.append(outq)
434
434
            LOG.info(_("Created topic proxy: %s"), topic)
486
486
        topic = topic.split('.', 1)[0]
487
487
 
488
488
        LOG.info(_("Create Consumer for topic (%(topic)s)") %
489
 
            {'topic': topic})
 
489
                 {'topic': topic})
490
490
 
491
491
        # Subscription scenarios
492
492
        if fanout:
502
502
            (self.conf.rpc_zmq_ipc_dir, topic)
503
503
 
504
504
        LOG.debug(_("Consumer is a zmq.%s"),
505
 
            ['PULL', 'SUB'][sock_type == zmq.SUB])
 
505
                  ['PULL', 'SUB'][sock_type == zmq.SUB])
506
506
 
507
507
        self.reactor.register(proxy, inaddr, sock_type,
508
508
                              subscribe=subscribe, in_bind=False)