nova-manage delete / create can't replace instance types.

Bug #745320 reported by Vish Ishaya
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Compute (nova)
Fix Released
Medium
Ken Pepple

Bug Description

When using nova-manage instance_type, it is difficult to change existing instance types. Delete / Create leads to the following issue:

(nova.instance_types): TRACE: Traceback (most recent call last):
(nova.instance_types): TRACE: File "/home/vishvananda/trunk/nova/compute/instance_types.py", line 60, in create
(nova.instance_types): TRACE: rxtx_cap=rxtx_cap))
(nova.instance_types): TRACE: File "/home/vishvananda/trunk/nova/db/api.py", line 1119, in instance_type_create
(nova.instance_types): TRACE: return IMPL.instance_type_create(context, values)
(nova.instance_types): TRACE: File "/home/vishvananda/trunk/nova/db/sqlalchemy/api.py", line 98, in wrapper
(nova.instance_types): TRACE: return f(*args, **kwargs)
(nova.instance_types): TRACE: File "/home/vishvananda/trunk/nova/db/sqlalchemy/api.py", line 2343, in instance_type_create
(nova.instance_types): TRACE: raise exception.DBError(e)
(nova.instance_types): TRACE: DBError: (IntegrityError) (1062, "Duplicate entry 'm1.tiny' for key 'name'") 'INSERT INTO instance_types (created_at, updated_at, deleted_at, deleted, name, memory_mb, vcpus, local_gb, flavorid, swap, rxtx_quota, rxtx_cap) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)' (datetime.datetime(2011, 3, 29, 22, 17, 58, 491739), None, None, False, 'm1.tiny', '512', '1', '0', '9', 0, 0, 0)
(nova.instance_types): TRACE:

The problem is that delete instance type just marks the field deleted, and flavor_id and name are both marked unique. They should either be changed to not unique, or there should be some logic in delete to actaully permanently remove the record instead of just marking it deleted.

Related branches

Revision history for this message
Ken Pepple (ken-pepple) wrote :

there is a way to permanently delete (use the --purge option with $ nova-manage instance_type delete) but it shouldn't stack trace and there should be better output to alert admins to the problem.

I will correct this.

Changed in nova:
assignee: nobody → Ken Pepple (ken-pepple)
Ken Pepple (ken-pepple)
Changed in nova:
status: New → In Progress
Thierry Carrez (ttx)
Changed in nova:
importance: Undecided → Medium
Revision history for this message
Ken Pepple (ken-pepple) wrote :
Download full text (5.6 KiB)

vishy -- is this a better output ? It tells you probable problem at bottom with full list of current instance_types ...

(nova)k-2:lp745320 kpepple$ bin/nova-manage instance_type create x1.gigantic 256 2 10 10
2011-04-07 15:05:09,259 ERROR nova.exception [-] DB exception wrapped
(nova.exception): TRACE: Traceback (most recent call last):
(nova.exception): TRACE: File "/Users/kpepple/Documents/dev/openstack/src/nova/lp745320/nova/exception.py", line 109, in _wrap
(nova.exception): TRACE: return f(*args, **kwargs)
(nova.exception): TRACE: File "/Users/kpepple/.virtualenvs/nova/lib/python2.6/site-packages/sqlalchemy/orm/session.py", line 1346, in flush
(nova.exception): TRACE: self._flush(objects)
(nova.exception): TRACE: File "/Users/kpepple/.virtualenvs/nova/lib/python2.6/site-packages/sqlalchemy/orm/session.py", line 1427, in _flush
(nova.exception): TRACE: flush_context.execute()
(nova.exception): TRACE: File "/Users/kpepple/.virtualenvs/nova/lib/python2.6/site-packages/sqlalchemy/orm/unitofwork.py", line 299, in execute
(nova.exception): TRACE: rec.execute(self)
(nova.exception): TRACE: File "/Users/kpepple/.virtualenvs/nova/lib/python2.6/site-packages/sqlalchemy/orm/unitofwork.py", line 443, in execute
(nova.exception): TRACE: uow
(nova.exception): TRACE: File "/Users/kpepple/.virtualenvs/nova/lib/python2.6/site-packages/sqlalchemy/orm/mapper.py", line 1833, in _save_obj
(nova.exception): TRACE: execute(statement, params)
(nova.exception): TRACE: File "/Users/kpepple/.virtualenvs/nova/lib/python2.6/site-packages/sqlalchemy/engine/base.py", line 1157, in execute
(nova.exception): TRACE: params)
(nova.exception): TRACE: File "/Users/kpepple/.virtualenvs/nova/lib/python2.6/site-packages/sqlalchemy/engine/base.py", line 1237, in _execute_clauseelement
(nova.exception): TRACE: return self.__execute_context(context)
(nova.exception): TRACE: File "/Users/kpepple/.virtualenvs/nova/lib/python2.6/site-packages/sqlalchemy/engine/base.py", line 1268, in __execute_context
(nova.exception): TRACE: context.parameters[0], context=context)
(nova.exception): TRACE: File "/Users/kpepple/.virtualenvs/nova/lib/python2.6/site-packages/sqlalchemy/engine/base.py", line 1367, in _cursor_execute
(nova.exception): TRACE: context)
(nova.exception): TRACE: File "/Users/kpepple/.virtualenvs/nova/lib/python2.6/site-packages/sqlalchemy/engine/base.py", line 1360, in _cursor_execute
(nova.exception): TRACE: context)
(nova.exception): TRACE: File "/Users/kpepple/.virtualenvs/nova/lib/python2.6/site-packages/sqlalchemy/engine/default.py", line 288, in do_execute
(nova.exception): TRACE: cursor.execute(statement, parameters)
(nova.exception): TRACE: IntegrityError: (IntegrityError) column name is not unique u'INSERT INTO instance_types (created_at, updated_at, deleted_at, deleted, name, memory_mb, vcpus, local_gb, flavorid, swap, rxtx_quota, rxtx_cap) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)' ('2011-04-07 22:05:09.256953', None, None, False, 'x1.gigantic', '256', '2', '10', '10', 0, 0, 0)
(nova.exception): TRACE:
2011-04-07 15:05:09,264 ERROR nova.instance_types [-] DB error: (IntegrityError) column ...

Read more...

Revision history for this message
Vish Ishaya (vishvananda) wrote : Re: [Bug 745320] Re: nova-manage delete / create can't replace instance types.
Download full text (8.0 KiB)

Seems like it might be nice to mention the --purge option somewhere if it is needed to change an existing type.

Vish

On Apr 7, 2011, at 3:07 PM, Ken Pepple wrote:

> vishy -- is this a better output ? It tells you probable problem at
> bottom with full list of current instance_types ...
>
> (nova)k-2:lp745320 kpepple$ bin/nova-manage instance_type create x1.gigantic 256 2 10 10
> 2011-04-07 15:05:09,259 ERROR nova.exception [-] DB exception wrapped
> (nova.exception): TRACE: Traceback (most recent call last):
> (nova.exception): TRACE: File "/Users/kpepple/Documents/dev/openstack/src/nova/lp745320/nova/exception.py", line 109, in _wrap
> (nova.exception): TRACE: return f(*args, **kwargs)
> (nova.exception): TRACE: File "/Users/kpepple/.virtualenvs/nova/lib/python2.6/site-packages/sqlalchemy/orm/session.py", line 1346, in flush
> (nova.exception): TRACE: self._flush(objects)
> (nova.exception): TRACE: File "/Users/kpepple/.virtualenvs/nova/lib/python2.6/site-packages/sqlalchemy/orm/session.py", line 1427, in _flush
> (nova.exception): TRACE: flush_context.execute()
> (nova.exception): TRACE: File "/Users/kpepple/.virtualenvs/nova/lib/python2.6/site-packages/sqlalchemy/orm/unitofwork.py", line 299, in execute
> (nova.exception): TRACE: rec.execute(self)
> (nova.exception): TRACE: File "/Users/kpepple/.virtualenvs/nova/lib/python2.6/site-packages/sqlalchemy/orm/unitofwork.py", line 443, in execute
> (nova.exception): TRACE: uow
> (nova.exception): TRACE: File "/Users/kpepple/.virtualenvs/nova/lib/python2.6/site-packages/sqlalchemy/orm/mapper.py", line 1833, in _save_obj
> (nova.exception): TRACE: execute(statement, params)
> (nova.exception): TRACE: File "/Users/kpepple/.virtualenvs/nova/lib/python2.6/site-packages/sqlalchemy/engine/base.py", line 1157, in execute
> (nova.exception): TRACE: params)
> (nova.exception): TRACE: File "/Users/kpepple/.virtualenvs/nova/lib/python2.6/site-packages/sqlalchemy/engine/base.py", line 1237, in _execute_clauseelement
> (nova.exception): TRACE: return self.__execute_context(context)
> (nova.exception): TRACE: File "/Users/kpepple/.virtualenvs/nova/lib/python2.6/site-packages/sqlalchemy/engine/base.py", line 1268, in __execute_context
> (nova.exception): TRACE: context.parameters[0], context=context)
> (nova.exception): TRACE: File "/Users/kpepple/.virtualenvs/nova/lib/python2.6/site-packages/sqlalchemy/engine/base.py", line 1367, in _cursor_execute
> (nova.exception): TRACE: context)
> (nova.exception): TRACE: File "/Users/kpepple/.virtualenvs/nova/lib/python2.6/site-packages/sqlalchemy/engine/base.py", line 1360, in _cursor_execute
> (nova.exception): TRACE: context)
> (nova.exception): TRACE: File "/Users/kpepple/.virtualenvs/nova/lib/python2.6/site-packages/sqlalchemy/engine/default.py", line 288, in do_execute
> (nova.exception): TRACE: cursor.execute(statement, parameters)
> (nova.exception): TRACE: IntegrityError: (IntegrityError) column name is not unique u'INSERT INTO instance_types (created_at, updated_at, deleted_at, deleted, name, memory_mb, vcpus, local_gb, flavorid, swap, rxtx_quota, rxtx_cap) VALUES (?, ?, ?, ?, ?, ?, ?, ...

Read more...

Revision history for this message
Ken Pepple (ken-pepple) wrote :

now we are just coddling our admins ... :)

changed and re-pushed.

Thierry Carrez (ttx)
Changed in nova:
status: In Progress → Fix Committed
Thierry Carrez (ttx)
Changed in nova:
milestone: none → diablo-1
Thierry Carrez (ttx)
Changed in nova:
milestone: diablo-1 → 2011.3
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.