[openstack-dev] [Containers][Magnum] Questions on dbapi

Adrian Otto adrian.otto at rackspace.com
Wed Dec 31 21:10:56 UTC 2014

I would welcome any patches to true this code up to be more appropriate for our needs. We might as well trim cruft out now if we notice it. Our milestone-2 will add a lot of tests, so it would be great to get a clean start.


-------- Original message --------
From: Steven Dake
Date:12/31/2014 11:46 AM (GMT-08:00)
To: "OpenStack Development Mailing List (not for usage questions)"
Subject: Re: [openstack-dev] [Containers][Magnum] Questions on dbapi

On 12/31/2014 10:54 AM, Hongbin Lu wrote:
Hi all,

I am writing tests for the Magnum dbapi. I have several questions about its implementation and appreciate if someone could comment on them.

* Exceptions: The exceptions below were ported from Ironic but don't seem to make sense in Magnum. I think we should purge them from the code except InstanceAssociated and NodeAssociated. Do everyone agree?


Agree we should remove any exceptions that were from Ironic that don't make any sense in Magnum.

The only reason I copied alot of Ironic code base was to pull in the versioned objects support which should be heading to oslo at some point.

class InstanceAssociated(Conflict):
    message = _("Instance %(instance_uuid)s is already associated with a node,"
                " it cannot be associated with this other node %(node)s")

class BayAssociated(InvalidState):
    message = _("Bay %(bay)s is associated with instance %(instance)s.")

class ContainerAssociated(InvalidState):
    message = _("Container %(container)s is associated with "
                "instance %(instance)s.")

class PodAssociated(InvalidState):
    message = _("Pod %(pod)s is associated with instance %(instance)s.")

class ServiceAssociated(InvalidState):
    message = _("Service %(service)s is associated with "
                "instance %(instance)s.")

NodeAssociated: it is used but definition missing

BayModelAssociated: it is used but definition missing

* APIs: the APIs below seem to be ported from Ironic Node, but it seems we won't need them all. Again, I think we should purge some of them that does not make sense. In addition, these APIs are defined without being call. Does it make sense remove them for now, and add them one by one later when they are actually needed.

Agree they should be removed now and added as needed later.

def reserve_bay(self, tag, bay_id):
    """Reserve a bay.

def release_bay(self, tag, bay_id):
    """Release the reservation on a bay.

def reserve_baymodel(self, tag, baymodel_id):
    """Reserve a baymodel.

def release_baymodel(self, tag, baymodel_id):
    """Release the reservation on a baymodel.

def reserve_container(self, tag, container_id):
    """Reserve a container.

def reserve_node(self, tag, node_id):
    """Reserve a node.

def release_node(self, tag, node_id):
    """Release the reservation on a node.

def reserve_pod(self, tag, pod_id):
    """Reserve a pod.

def release_pod(self, tag, pod_id):
    """Release the reservation on a pod.

def reserve_service(self, tag, service_id):
    """Reserve a service.

def release_service(self, tag, service_id):
    """Release the reservation on a service.

OpenStack-dev mailing list
OpenStack-dev at lists.openstack.org<mailto:OpenStack-dev at lists.openstack.org>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstack.org/pipermail/openstack-dev/attachments/20141231/d6ca027e/attachment.html>

More information about the OpenStack-dev mailing list