← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 887828] Re: nova.db.sqlalchemy.models.NovaBase#save() didn't raise exception.Duplicate when we use sqlite

 

** Changed in: nova
       Status: Confirmed => Fix Released

** Changed in: openstack-qa
       Status: In Progress => Fix Released

-- 
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to OpenStack Compute (nova).
https://bugs.launchpad.net/bugs/887828

Title:
  nova.db.sqlalchemy.models.NovaBase#save() didn't raise
  exception.Duplicate when we use sqlite

Status in OpenStack Compute (Nova):
  Fix Released
Status in OpenStack QA:
  Fix Released

Bug description:
  Beucase the implementation is based on mysql specific error message,
  this method didn't throw correct exception with sqlite.

  https://github.com/openstack/nova/blob/stable/diablo/nova/db/sqlalchemy/models.py#L61

  
  - sqlite error for duplication

  (nova.exception): TRACE: IntegrityError: (IntegrityError) PRIMARY KEY
  must be unique u'INSERT INTO instances (created_at, updated_at,
  deleted_at, deleted, id, user_id, project_id, image_ref, kernel_id,
  ramdisk_id, server_name, launch_index, key_name, key_data,
  power_state, vm_state, task_state, memory_mb,

  - Mysql error (primary key duplication)
  sqlalchemy.exc.IntegrityError: (IntegrityError) (1062, "Duplicate entry '1' for key 'PRIMARY'") 'INSERT INTO names (id, text, date_time) VALUES (%s, %s, %s)' (1, 'world', datetime.date(2011, 11, 9))

  -Mysql error (unique key duplication)
  sqlalchemy.exc.IntegrityError: (IntegrityError) (1062, "Duplicate entry 'hello' for key 'text'") 'INSERT INTO names (id, text, date_time) VALUES (%s, %s, %s)' (2, 'hello', datetime.date(2011, 11, 9))

To manage notifications about this bug go to:
https://bugs.launchpad.net/nova/+bug/887828/+subscriptions