Updated Branches: refs/heads/marvin_refactor 4abd92922 -> dd838d725
register is the real create createTemplateCmd does a template of a VM while registerTemplateCmd does the actual creation of the template in CS Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/a936b9f4 Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/a936b9f4 Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/a936b9f4 Branch: refs/heads/marvin_refactor Commit: a936b9f419c4d62643e39dbc4a52162cef71fead Parents: 4abd929 Author: Prasanna Santhanam <[email protected]> Authored: Sun Apr 21 12:15:07 2013 +0530 Committer: Prasanna Santhanam <[email protected]> Committed: Sun Apr 21 12:15:07 2013 +0530 ---------------------------------------------------------------------- .../marvin/marvin/integration/lib/base/Template.py | 20 ++++++--------- .../integration/lib/factory/TemplateFactory.py | 8 +++++- 2 files changed, 15 insertions(+), 13 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/a936b9f4/tools/marvin/marvin/integration/lib/base/Template.py ---------------------------------------------------------------------- diff --git a/tools/marvin/marvin/integration/lib/base/Template.py b/tools/marvin/marvin/integration/lib/base/Template.py index 36f6bf4..0e7d794 100644 --- a/tools/marvin/marvin/integration/lib/base/Template.py +++ b/tools/marvin/marvin/integration/lib/base/Template.py @@ -41,25 +41,21 @@ class Template(CloudStackEntity.CloudStackEntity): return template - @classmethod - def create(cls, apiclient, factory, **kwargs): + def template_of_vm(self, apiclient, name, displaytext, ostypeid, **kwargs): cmd = createTemplate.createTemplateCmd() - [setattr(cmd, factoryKey, factoryValue) for factoryKey, factoryValue in factory.__dict__.iteritems()] + cmd.id = self.id + cmd.name = name + cmd.displaytext = displaytext + cmd.ostypeid = ostypeid [setattr(cmd, key, value) for key,value in kwargs.iteritems()] template = apiclient.createTemplate(cmd) return Template(template.__dict__) - def register(self, apiclient, name, format, url, hypervisor, zoneid, displaytext, ostypeid, **kwargs): + @classmethod + def create(self, apiclient, factory, **kwargs): cmd = registerTemplate.registerTemplateCmd() - cmd.id = self.id - cmd.displaytext = displaytext - cmd.format = format - cmd.hypervisor = hypervisor - cmd.name = name - cmd.ostypeid = ostypeid - cmd.url = url - cmd.zoneid = zoneid + [setattr(cmd, factoryKey, factoryValue) for factoryKey, factoryValue in factory.__dict__.iteritems()] [setattr(cmd, key, value) for key,value in kwargs.iteritems()] template = apiclient.registerTemplate(cmd) return template http://git-wip-us.apache.org/repos/asf/cloudstack/blob/a936b9f4/tools/marvin/marvin/integration/lib/factory/TemplateFactory.py ---------------------------------------------------------------------- diff --git a/tools/marvin/marvin/integration/lib/factory/TemplateFactory.py b/tools/marvin/marvin/integration/lib/factory/TemplateFactory.py index e2bb023..47d1035 100644 --- a/tools/marvin/marvin/integration/lib/factory/TemplateFactory.py +++ b/tools/marvin/marvin/integration/lib/factory/TemplateFactory.py @@ -22,11 +22,17 @@ class TemplateFactory(CloudStackBaseFactory): FACTORY_FOR = Template.Template - displaytext = None name = None + displaytext = None + format = None + url = None + hypervisor = None + zoneid = None ostypeid = None class DefaultBuiltInTemplateFactory(TemplateFactory): ostype = 'CentOS 5.3 (64-bit)' displaytext = 'CentOS 5.3 (64-bit)' name = 'CentOS 5.3 (64-bit)' + format = 'VHD' + hypervisor = 'XenServer'
