コード例 #1
0
    def test_instance_type_get_by_flavor_id_with_extra_specs(self):
        instance_type = db.instance_type_get_by_flavor_id(
                            self.context,
                            105)
        self.assertEquals(instance_type['extra_specs'],
                          dict(cpu_arch="x86_64",
                               cpu_model="Nehalem",
                               xpu_arch="fermi",
                               xpus="2",
                               xpu_model="Tesla 2050"))

        instance_type = db.instance_type_get_by_flavor_id(
                            self.context,
                            2)
        self.assertEquals(instance_type['extra_specs'], {})
コード例 #2
0
def get_instance_type_by_flavor_id(flavorid):
    """Retrieve instance type by flavorid."""
    ctxt = context.get_admin_context()
    try:
        return db.instance_type_get_by_flavor_id(ctxt, flavorid)
    except exception.DBError:
        raise exception.ApiError(_("Unknown instance type: %s") % flavorid)
コード例 #3
0
def get_instance_type_by_flavor_id(flavorid):
    """Retrieve instance type by flavorid."""
    ctxt = context.get_admin_context()
    try:
        return db.instance_type_get_by_flavor_id(ctxt, flavorid)
    except exception.DBError:
        raise exception.ApiError(_("Unknown instance type: %s") % flavorid)