[
https://issues.apache.org/jira/browse/CLOUDSTACK-8186?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Wei Zhou closed CLOUDSTACK-8186.
--------------------------------
Resolution: Won't Fix
> setRemoved(null) does not work as expected
> ------------------------------------------
>
> Key: CLOUDSTACK-8186
> URL: https://issues.apache.org/jira/browse/CLOUDSTACK-8186
> Project: CloudStack
> Issue Type: Bug
> Security Level: Public(Anyone can view this level - this is the
> default.)
> Reporter: Wei Zhou
> Assignee: Wei Zhou
> Priority: Critical
>
> in cloudstack 4.5, there are two locations where set the removed field as
> null.
> [root@localhost cloudstack.git(4.5)]# grep -r "setRemoved(null)" *
> engine/schema/src/com/cloud/storage/dao/VMTemplateDaoImpl.java:
> tmpltZoneVO.setRemoved(null);
> framework/cluster/src/com/cloud/cluster/ClusterManagerImpl.java:
> mshost.setRemoved(null);
> As far as I think, the proposal is to clean the removed field in the database.
> However, it does not work as expected.
> The removed field will be set the current date.
> After investigating for a long time, I find it is because the following part
> in ./framework/db/src/com/cloud/utils/db/GenericDaoBase.java
> @DB()
> protected void prepareAttribute(final int j, final PreparedStatement
> pstmt, final Attribute attr, Object value) throws SQLException {
> if (attr.is(Attribute.Flag.DaoGenerated) && value == null) {
> value = generateValue(attr);
> if (attr.field == null) {
> pstmt.setObject(j, value);
> return;
> }
> }
> ......
> @DB()
> protected Object generateValue(final Attribute attr) {
> if (attr.is(Attribute.Flag.Created) ||
> attr.is(Attribute.Flag.Removed)) {
> return new Date();
> ......
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)