def test_instance_type_extra_specs_delete(self): expected_specs = dict(cpu_arch="x86_64", cpu_model="Nehalem", xpu_arch="fermi", xpus="2") db.flavor_extra_specs_delete(self.context, self.flavorid, "xpu_model") actual_specs = db.flavor_extra_specs_get(self.context, self.flavorid) self.assertEquals(expected_specs, actual_specs)
def delete(self, req, flavor_id, id): """Deletes an existing extra spec.""" context = req.environ['nova.context'] authorize(context, action='delete') try: db.flavor_extra_specs_delete(context, flavor_id, id) except exception.InstanceTypeExtraSpecsNotFound as e: raise exc.HTTPNotFound(explanation=e.format_message())
def test_flavor_extra_specs_delete(self): del self.specs["xpu_model"] db.flavor_extra_specs_delete(self.context, self.flavorid, "xpu_model") actual_specs = db.flavor_extra_specs_get( self.context, self.flavorid) self.assertEqual(self.specs, actual_specs)
def test_instance_type_extra_specs_delete(self): expected_specs = dict(cpu_arch="x86_64", cpu_model="Nehalem", xpu_arch="fermi", xpus="2") db.flavor_extra_specs_delete(self.context, self.flavorid, "xpu_model") actual_specs = db.flavor_extra_specs_get( self.context, self.flavorid) self.assertEquals(expected_specs, actual_specs)
def save_extra_specs(self, context, to_add=None, to_delete=None): """Add or delete extra_specs. :param:to_add: A dict of new keys to add/update :param:to_delete: A list of keys to remove """ to_add = to_add if to_add is not None else [] to_delete = to_delete if to_delete is not None else [] db.flavor_extra_specs_update_or_create(context, self.flavorid, to_add) for key in to_delete: db.flavor_extra_specs_delete(context, self.flavorid, key) self.obj_reset_changes(["extra_specs"])
def save_extra_specs(self, context, to_add=None, to_delete=None): """Add or delete extra_specs. :param:to_add: A dict of new keys to add/update :param:to_delete: A list of keys to remove """ to_add = to_add if to_add is not None else [] to_delete = to_delete if to_delete is not None else [] db.flavor_extra_specs_update_or_create(context, self.flavorid, to_add) for key in to_delete: db.flavor_extra_specs_delete(context, self.flavorid, key) self.obj_reset_changes(['extra_specs'])
def delete(self, req, flavor_id, id): """Deletes an existing extra spec.""" context = req.environ['nova.context'] authorize(context, action='delete') db.flavor_extra_specs_delete(context, flavor_id, id)