Hi Folks,

Now we have explicit control to limit the version of rpc methods that can be 
sent, but I'm wondering what I need to do now to make the next version of a 
call adding an additional parameter.

It looks like the current code is really focused on the data types being 
passed, rather that the signature of the call (i.e do we pass an old or new 
style instance object).   So taking terminate_instance() as an example:


    def terminate_instance(self, ctxt, instance, bdms, reservations=None):
        if self.can_send_version('2.35'):
            version = '2.35'
        else:
            version = '2.27'
            instance = jsonutils.to_primitive(instance)
        bdms_p = jsonutils.to_primitive(bdms)
        self.cast(ctxt, self.make_msg('terminate_instance',
                instance=instance, bdms=bdms_p,
                reservations=reservations),
                topic=_compute_topic(self.topic, ctxt, None, instance),
                version=version)

If I want to add a parameter and bump this to version 2.36, do I just change 
the version checked in can_send_version - or should there now be specific 
handling for each new version:

    def terminate_instance(self, ctxt, instance, bdms, reservations=None, 
clean_shutdown=False):

        bdms_p = jsonutils.to_primitive(bdms)

        if self.can_send_version('2.36'):
            version = '2.36'
           msg = self.make_msg('terminate_instance',
                             instance=instance, bdms=bdms_p,
                             reservations=reservations,
                             clean_shutdown=clean_shutdown)
        elif self.can_send_version('2.35'):
            version = '2.35'
           msg = self.make_msg('terminate_instance',
                             instance=instance, bdms=bdms_p,
                             reservations=reservations)
        else:
            version = '2.27'
            instance = jsonutils.to_primitive(instance)
            msg = self.make_msg('terminate_instance',
                             instance=instance, bdms=bdms_p,
                             reservations=reservations)

        self.cast(ctxt, msg,
                    topic=_compute_topic(self.topic, ctxt, None, instance),
                    version=version)
_______________________________________________
OpenStack-dev mailing list
[email protected]
http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev

Reply via email to