예제 #1
0
    def get_all(self, resource_class_id):
        """Retrieve a list of all flavors."""
        flavors = []
        for flavor in pecan.request.dbapi.get_flavors(resource_class_id):
            flavors.append(Flavor.add_capacities(resource_class_id, flavor))

        return flavors
예제 #2
0
    def get_all(self, resource_class_id):
        """Retrieve a list of all flavors."""
        flavors = []
        for flavor in pecan.request.dbapi.get_flavors(resource_class_id):
            flavors.append(Flavor.add_capacities(resource_class_id, flavor))

        return flavors
예제 #3
0
 def put(self, resource_class_id, flavor_id, flavor):
     """Update an existing ResourceClass Flavor"""
     try:
         flavor = pecan.request.dbapi.update_resource_class_flavor(
             resource_class_id, flavor_id, flavor)
     except Exception as e:
         LOG.exception(e)
         raise wsme.exc.ClientSideError(_("Invalid data"))
     return Flavor.add_capacities(resource_class_id, flavor)
예제 #4
0
 def put(self, resource_class_id, flavor_id, flavor):
     """Update an existing ResourceClass Flavor"""
     try:
         flavor = pecan.request.dbapi.update_resource_class_flavor(
                 resource_class_id, flavor_id, flavor)
     except Exception as e:
         LOG.exception(e)
         raise wsme.exc.ClientSideError(_("Invalid data"))
     return Flavor.add_capacities(resource_class_id, flavor)
예제 #5
0
 def post(self, resource_class_id, flavor):
     """Create a new Flavor for a ResourceClass."""
     try:
         flavor = pecan.request.dbapi.create_resource_class_flavor(
                                         resource_class_id,flavor)
         #nova_flavor_uuid =  self.nova.create_flavor(flavor,
             #pecan.request.dbapi.get_resource_class(resource_class_id).name)
         #pecan.request.dbapi.update_flavor_nova_uuid(flavor.id, nova_flavor_uuid)
     except Exception as e:
         LOG.exception(e)
         raise wsme.exc.ClientSideError(_("Invalid data"))
     pecan.response.status_code = 201
     return Flavor.add_capacities(resource_class_id, flavor)
예제 #6
0
 def post(self, resource_class_id, flavor):
     """Create a new Flavor for a ResourceClass."""
     try:
         flavor = pecan.request.dbapi.create_resource_class_flavor(
             resource_class_id, flavor)
         #nova_flavor_uuid = self.nova.create_flavor(
         #    flavor,
         #    pecan.request.dbapi.get_resource_class(resource_class_id)
         #    .name
         #)
         #pecan.request.dbapi.update_flavor_nova_uuid(flavor.id,
         #                                            nova_flavor_uuid)
     except Exception as e:
         LOG.exception(e)
         raise wsme.exc.ClientSideError(_("Invalid data"))
     pecan.response.status_code = 201
     return Flavor.add_capacities(resource_class_id, flavor)
예제 #7
0
 def get_one(self, resource_id, flavor_id):
     """Retrieve a specific flavor."""
     flavor = pecan.request.dbapi.get_flavor(flavor_id)
     return Flavor.add_capacities(resource_id, flavor)
예제 #8
0
 def get_one(self, resource_id, flavor_id):
     """Retrieve a specific flavor."""
     flavor = pecan.request.dbapi.get_flavor(flavor_id)
     return Flavor.add_capacities(resource_id, flavor)