cloudstack-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From David Nalley <da...@gnsa.us>
Subject Re: devs looking to get involved?
Date Sat, 08 Feb 2014 02:37:27 GMT
- Users:

Regardless of whether someone takes you up on the offer or not, I'd
still love to see these patches hit RB or the mailing list, or Jira
perhaps.

--David

On Fri, Feb 7, 2014 at 8:06 PM, Marcus <shadowsor@gmail.com> wrote:
> I occasionally have some minor improvement that I need to make to
> whatever version of cloudstack we're currently running. This is almost
> always behind what is currently being developed, and I don't always
> feel like I have time to rebase/refactor it for master. I'm wondering
> if there are any individuals out there who are looking for ways to
> contribute that I can hand off these little projects to and mentor a
> bit. You get an easy project to get your feet wet and I get the
> improvements into master without using up time. :-) Maybe this sounds
> like laziness on my part, but it seemed like a good idea.
>
> I can post a patch that works for one version, and you can rework it
> and test against master. Respond if you're interested, there may be
> others who have easy work to farm off as well.
>
> An example, I've made some improvements to the template downloader,
> when the first 1M of the template is pulled we attempt to verify that
> the image is actually what we think it is (qcow2 or vmdk or whatever)
> by looking at the data. Up until now we just check file extension. It
> also contains a new TemplateUtils class that has:
>
> +    public static boolean isCorrectExtension(String path, String ext) {
> +        if (path.toLowerCase().endsWith(ext)
> +            || path.toLowerCase().endsWith(ext + ".gz")
> +            || path.toLowerCase().endsWith(ext + ".bz2")
> +            || path.toLowerCase().endsWith(ext + ".zip")) {
> +            return true;
> +        }
> +        return false;
> +    }
>
> Which can be used to clean up the likes of:
>
>     private void checkFormat(String format, String url) {
>         if((!url.toLowerCase().endsWith("vhd"))&&(!url.toLowerCase().endsWith("vhd.zip"))
>
> &&(!url.toLowerCase().endsWith("vhd.bz2"))&&(!url.toLowerCase().endsWith("vhd.gz"))
>
> &&(!url.toLowerCase().endsWith("qcow2"))&&(!url.toLowerCase().endsWith("qcow2.zip"))
>
> &&(!url.toLowerCase().endsWith("qcow2.bz2"))&&(!url.toLowerCase().endsWith("qcow2.gz"))
>
> &&(!url.toLowerCase().endsWith("ova"))&&(!url.toLowerCase().endsWith("ova.zip"))
>
> &&(!url.toLowerCase().endsWith("ova.bz2"))&&(!url.toLowerCase().endsWith("ova.gz"))
>
> &&(!url.toLowerCase().endsWith("tar"))&&(!url.toLowerCase().endsWith("tar.zip"))
>
> &&(!url.toLowerCase().endsWith("tar.bz2"))&&(!url.toLowerCase().endsWith("tar.gz"))
>                 &&(!url.toLowerCase().endsWith("vmdk")) &&
> (!url.toLowerCase().endsWith("vmdk.gz"))
>                 &&(!url.toLowerCase().endsWith("vmdk.zip")) &&
> (!url.toLowerCase().endsWith("vmdk.bz2")) &&
> (!url.toLowerCase().endsWith("img"))
>                 &&(!url.toLowerCase().endsWith("img.gz")) &&
> (!url.toLowerCase().endsWith("img.zip")) &&
> (!url.toLowerCase().endsWith("img.bz2"))
>                 &&(!url.toLowerCase().endsWith("raw")) &&
> (!url.toLowerCase().endsWith("raw.gz")) &&
> (!url.toLowerCase().endsWith("raw.bz2"))
>                 &&(!url.toLowerCase().endsWith("raw.zip"))){
>             throw new InvalidParameterValueException("Please specify a
> valid " + format.toLowerCase());
>         }
>         if ((format.equalsIgnoreCase("vhd")
>                  && (!url.toLowerCase().endsWith("vhd")
>                          && !url.toLowerCase().endsWith("vhd.zip")
>                          && !url.toLowerCase().endsWith("vhd.bz2")
>                          && !url.toLowerCase().endsWith("vhd.gz")))
>             || (format.equalsIgnoreCase("vhdx")
>                  && (!url.toLowerCase().endsWith("vhdx")
>                          && !url.toLowerCase().endsWith("vhdx.zip")
>                          && !url.toLowerCase().endsWith("vhdx.bz2")
>                          && !url.toLowerCase().endsWith("vhdx.gz")))
>             || (format.equalsIgnoreCase("qcow2")
>                  && (!url.toLowerCase().endsWith("qcow2")
>                          && !url.toLowerCase().endsWith("qcow2.zip")
>                          && !url.toLowerCase().endsWith("qcow2.bz2")
>                          && !url.toLowerCase().endsWith("qcow2.gz")))
>             || (format.equalsIgnoreCase("ova")
>                  && (!url.toLowerCase().endsWith("ova")
>                          && !url.toLowerCase().endsWith("ova.zip")
>                          && !url.toLowerCase().endsWith("ova.bz2")
>                          && !url.toLowerCase().endsWith("ova.gz")))
>             || (format.equalsIgnoreCase("tar")
>                  && (!url.toLowerCase().endsWith("tar")
>                          && !url.toLowerCase().endsWith("tar.zip")
>                          && !url.toLowerCase().endsWith("tar.bz2")
>                          && !url.toLowerCase().endsWith("tar.gz")))
>             || (format.equalsIgnoreCase("raw")
>                  && (!url.toLowerCase().endsWith("img")
>                          && !url.toLowerCase().endsWith("img.zip")
>                          && !url.toLowerCase().endsWith("img.bz2")
>                          && !url.toLowerCase().endsWith("img.gz")
>                          && !url.toLowerCase().endsWith("raw")
>                          && !url.toLowerCase().endsWith("raw.bz2")
>                          && !url.toLowerCase().endsWith("raw.zip")
>                          && !url.toLowerCase().endsWith("raw.gz")))
>             || (format.equalsIgnoreCase("vmdk")
>                  && (!url.toLowerCase().endsWith("vmdk")
>                          && !url.toLowerCase().endsWith("vmdk.zip")
>                          && !url.toLowerCase().endsWith("vmdk.bz2")
>                          && !url.toLowerCase().endsWith("vmdk.gz")))
>            ) {
>               throw new InvalidParameterValueException("Please specify
> a valid URL. URL:" + url
>                     + " is an invalid for the format " + format.toLowerCase());
>         }
>
>
>     }

Mime
View raw message