weizhouapache commented on pull request #4399:
URL: https://github.com/apache/cloudstack/pull/4399#issuecomment-886665291


   > > @DK101010 yes, I agree it should not be allowed. but, since it is 
allowed in 4.15 and previous versions, it might already exists in some/few user 
environments that a host have a same tag multiple times (who knows...).
   > > IMHO options are
   > > (1) check and throw an exception (as you said) or silently ignoring the 
duplicated tags, and remove duplications in host_tags in next cloudstack 
upgrade, or
   > > (2) change your sql to take the scenario into consideration.
   > > I would go for (1), but it looks (2) is much easier to you.
   > 
   > @weizhouapache I'm also for (1), it is cleaner. But we need also checks in 
the frontend for future actions to prevent doubles. Also I think a DB upgrade 
is not necessary. In my opinion it is for a user a small thing to fix this 
mistake. Especially as I can't imagine that there are so many duplicate tags in 
use.
   
   @DK101010 
   if we choose (1), we should fix it in api/java code as well as gui.
   
   IMHO DB upgrade is also required, as we need to remove the duplications in 
cloudstack upgrade (otherwise it needs user intervention to remove them from DB 
manually ). for example, we need to remove record with id=62 from below
   ```
   mysql> select * from host_tags;
   +----+---------+------+
   | id | host_id | tag  |
   +----+---------+------+
   | 61 |       4 | tag1 |
   | 62 |       4 | tag1 |
   +----+---------+------+
   2 rows in set (0.00 sec)
   ```
   
   it is not a small change. I confirm that we can set same storage tag two 
times on a primary storage as well.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to