~gandelman-a/ubuntu/precise/nova/UCA_2012.2.1

« back to all changes in this revision

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

  • Committer: Package Import Robot
  • Author(s): Chuck Short, Chuck Short, Adam Gandelman
  • Date: 2012-08-16 14:04:11 UTC
  • mfrom: (1.1.59)
  • Revision ID: package-import@ubuntu.com-20120816140411-8dvudjblnx1w0mwx
Tags: 2012.2~f3-0ubuntu1
[ Chuck Short ]
* New upstream version.
* debian/rules: Re-enable testsuite.
* debian/control:
  - Add python-quantumclient as a build depends.
  - Bump standards to 3.9.3
  - Fix lintian warnings.
  - Recommend python-glanceclient and python-keystoneclient.
  - Add dependency of iptables for nova-network.
* debian/watch: Update
* debian/rules: Do not run pep8 tests since upstream is still using an
  older pep8.
* debian/patches/0001-Update-tools-hacking-for-pep8-1.2-and-
  beyond.patch: Get the testsuite running again.
* debian/nova-volume.install, debian/nova_tgt: Add support for
  persistent volumes.

[ Adam Gandelman ]
* debian/{nova-api.install, nova-api-metadata.install}: Install
  api-metadata.filters. (LP: #1002111)
* debian/control: Added python-glanceclient.

Show diffs side-by-side

added added

removed removed

Lines of Context:
40
40
server side of the API at the same time.  However, as the code stands today,
41
41
there can be both versioned and unversioned APIs implemented in the same code
42
42
base.
 
43
 
 
44
 
 
45
EXAMPLES:
 
46
 
 
47
Nova was the first project to use versioned rpc APIs.  Consider the compute rpc
 
48
API as an example.  The client side is in nova/compute/rpcapi.py and the server
 
49
side is in nova/compute/manager.py.
 
50
 
 
51
 
 
52
Example 1) Adding a new method.
 
53
 
 
54
Adding a new method is a backwards compatible change.  It should be added to
 
55
nova/compute/manager.py, and RPC_API_VERSION should be bumped from X.Y to
 
56
X.Y+1.  On the client side, the new method in nova/compute/rpcapi.py should
 
57
have a specific version specified to indicate the minimum API version that must
 
58
be implemented for the method to be supported.  For example:
 
59
 
 
60
    def get_host_uptime(self, ctxt, host):
 
61
        topic = _compute_topic(self.topic, ctxt, host, None)
 
62
        return self.call(ctxt, self.make_msg('get_host_uptime'), topic,
 
63
                version='1.1')
 
64
 
 
65
In this case, version '1.1' is the first version that supported the
 
66
get_host_uptime() method.
 
67
 
 
68
 
 
69
Example 2) Adding a new parameter.
 
70
 
 
71
Adding a new parameter to an rpc method can be made backwards compatible.  The
 
72
RPC_API_VERSION on the server side (nova/compute/manager.py) should be bumped.
 
73
The implementation of the method must not expect the parameter to be present.
 
74
 
 
75
    def some_remote_method(self, arg1, arg2, newarg=None):
 
76
        # The code needs to deal with newarg=None for cases
 
77
        # where an older client sends a message without it.
 
78
        pass
 
79
 
 
80
On the client side, the same changes should be made as in example 1.  The
 
81
minimum version that supports the new parameter should be specified.
43
82
"""
44
83
 
45
84
from nova.openstack.common.rpc import common as rpc_common