Mike,

Checkout StringUtils might be a potential utility class for handling the tags 
comparison. 

cloud-utils/src/com/cloud/utils/StringUtils.java

Prachi

-----Original Message-----
From: Mike Tutkowski [mailto:mike.tutkow...@solidfire.com] 
Sent: Monday, July 14, 2014 3:27 PM
To: dev@cloudstack.apache.org
Subject: Re: Comparing storage tags

It looks like similar logic is employed in NetworkServiceImpl - except the 
comparison is performed in a case-insensitive manner (versus in 
VolumeApiServiceImpl, where it's done with case sensitivity).

Do we have a general utility class where code like this can be placed? It would 
also be nice to place logic like this (size = size << 30) in such a class (so 
conversions from GB to bytes or whatever would be able to use the same logic 
all over the place).


On Mon, Jul 14, 2014 at 4:20 PM, Mike Tutkowski < mike.tutkow...@solidfire.com> 
wrote:

> Hi,
>
> Am I missing something here or does this seem like a really frail way 
> to compare storage tags?
>
> if (newDiskOffering.getTags() == null ||
> !newDiskOffering.getTags().equals(diskOffering.getTags())) {
>
> Unless the tags happen to be in the same order and have the same 
> casing, this seems like it would return that they are not equal when, 
> in fact, they could be equal.
>
> This came up while looking at the resize-volume logic.
>
> I guess I'll write a function to build up a list of strings for a 
> given storage tag and compare them in a case-insensitive fashion 
> against the incoming storage tags as a list of strings.
>
> Talk to you later,
>
> --
> *Mike Tutkowski*
> *Senior CloudStack Developer, SolidFire Inc.*
> e: mike.tutkow...@solidfire.com
> o: 303.746.7302
> Advancing the way the world uses the cloud
> <http://solidfire.com/solution/overview/?video=play>*™*
>



--
*Mike Tutkowski*
*Senior CloudStack Developer, SolidFire Inc.*
e: mike.tutkow...@solidfire.com
o: 303.746.7302
Advancing the way the world uses the cloud
<http://solidfire.com/solution/overview/?video=play>*™*

Reply via email to