Hi Ramon,

Before starting coding again, let's clarify some points:

1) You are going to change the way a Template is created.
    So we are adding a new parameter "source_media"

    Question 1: Will this source_media parameter replace cdrom and base disk or user will continue be able to use cdrom and base disk instead of source_media?
    I prefer to have a single way to create a template, ie, when addind 'source_media', cdrom and base disk parameters will be removed.

2) VMTemplate does not rely on Model or libvirt or anything else rather than get the default values on osinfo.py and merge data in a data structure (dict).

3) To avoid scan 'source_media' multiple times, VMTemplate has a 'scan' parameter.
     When set to 'true', source_media will be scanned to get OS and OS version. Otherwise, VMTemplate will only merge data.

4) Always take a look in the existing functions. There are some useful functions to identify a URL path or local path.

Hope it helps! =)

Let me know if you need any help to do that.

Regards,
Aline Manera

On 03/22/2016 04:20 PM, Ramon Medeiros wrote:
Instead of specify if the media is cdrom or disk, use source_media to create a template

Ramon Medeiros (6):
  Create a single field to pass the installation media
  Method to retrieve stored templates at  object store
  Fix checking duplicate template before  creating it
  Identify installation media while creating template
  Only use source_media as boot media
  Update tests

 API.json                    |   5 ++
 i18n.py                     |   2 +-
 model/templates.py          |  13 ++--
 tests/test_authorization.py |   4 +-
 tests/test_livemigration.py |   7 +-
 tests/test_mockmodel.py     |  14 ++--
 tests/test_model.py         |  69 ++++++++++++--------
 tests/test_rest.py          |  32 ++++------
 tests/test_template.py      |  39 +++++-------
 tests/test_vmtemplate.py    |  24 +++----
 utils.py                    |  30 +++++++++
 vmtemplate.py               | 152 ++++++++++++++++++++++++++++++++++++++++----
 12 files changed, 279 insertions(+), 112 deletions(-)