commit 767fb98b885327d1ad1cd380682ae4745aa78387
Author: Roman Podolyaka <email address hidden>
Date: Mon Aug 12 14:46:53 2013 +0300
Fix instance_group_delete() DB API method
Table 'instance_groups' has two columns that can be used to
unambigously identify the specific row:
- 'id' (Integer, primary_key=True, autoincrement=True)
- 'uuid' (String)
The former is used internally to bind related instances by FKs
(InstanceGroupMember, InstanceGroupPolicy and InstanceGroupMetadata),
and the latter is accepted by public methods of DB API. This must
be a miss in DB schema design, because 'uuid' could be used for both
use cases.
instance_group_delete() deletes the instance group (and all related
instances) given its UUID value. When related entities are deleted
they are filtered by the FK value - the 'group_id' column, however,
the 'group_uuid' value is passed.
Such DELETE statement is executed successfully (though WHERE clause never
evaluates to True, so the query is logically incorrect) on MySQL and SQLite,
which are often too 'soft' when checking data types of passed values.
This patch fixes the instance_group_delete() method and renames the 'group_uuid'
argument of _instance_group_model_get_query() to 'group_id', because this one
is actually always called with id value rather than with uuid.
Reviewed: https:/ /review. openstack. org/41408 github. com/openstack/ nova/commit/ 767fb98b885327d 1ad1cd380682ae4 745aa78387
Committed: http://
Submitter: Jenkins
Branch: master
commit 767fb98b885327d 1ad1cd380682ae4 745aa78387
Author: Roman Podolyaka <email address hidden>
Date: Mon Aug 12 14:46:53 2013 +0300
Fix instance_ group_delete( ) DB API method
Table 'instance_groups' has two columns that can be used to
unambigously identify the specific row:
- 'id' (Integer, primary_key=True, autoincrement=True)
- 'uuid' (String)
The former is used internally to bind related instances by FKs oupMember, InstanceGroupPolicy and InstanceGroupMe tadata) ,
(InstanceGr
and the latter is accepted by public methods of DB API. This must
be a miss in DB schema design, because 'uuid' could be used for both
use cases.
instance_ group_delete( ) deletes the instance group (and all related
instances) given its UUID value. When related entities are deleted
they are filtered by the FK value - the 'group_id' column, however,
the 'group_uuid' value is passed.
Such DELETE statement is executed successfully (though WHERE clause never
evaluates to True, so the query is logically incorrect) on MySQL and SQLite,
which are often too 'soft' when checking data types of passed values.
This patch fixes the instance_ group_delete( ) method and renames the 'group_uuid' group_model_ get_query( ) to 'group_id', because this one
argument of _instance_
is actually always called with id value rather than with uuid.
Closes-Bug: #1211307
Change-Id: Ic8bcb4b218f570 f26420904aeb74e b14567235fb