[openstack-dev] [Nova] questions on object/db usage

Chen CH Ji jichenjc at cn.ibm.com
Thu Oct 23 15:36:34 UTC 2014


Hi
           When I fix some bugs, I found that some code in
nova/compute/api.py

          sometimes we use db ,sometimes we use objects.... do we have any
criteria for it? I knew we can't access db in compute layer code, how about
others ? prefer object or db direct access? thanks

def service_delete(self, context, service_id):
        """Deletes the specified service."""
        objects.Service.get_by_id(context, service_id).destroy()

    def instance_get_all_by_host(self, context, host_name):
        """Return all instances on the given host."""
        return self.db.instance_get_all_by_host(context, host_name)

    def compute_node_get_all(self, context):
        return self.db.compute_node_get_all(context)

Best Regards!

Kevin (Chen) Ji 纪 晨

Engineer, zVM Development, CSTL
Notes: Chen CH Ji/China/IBM at IBMCN   Internet: jichenjc at cn.ibm.com
Phone: +86-10-82454158
Address: 3/F Ring Building, ZhongGuanCun Software Park, Haidian District,
Beijing 100193, PRC
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstack.org/pipermail/openstack-dev/attachments/20141023/0ad6445f/attachment.html>


More information about the OpenStack-dev mailing list