Fix typo and add function description

This commit is contained in:
Modulos 2017-05-10 02:49:03 +02:00
parent b052507134
commit f2a7ac258d

View file

@ -67,12 +67,12 @@ class OpenNebulaManager():
except WrongNameError as wrong_name_err:
opennebula_user = self.oneadmin_client.call(oca.User.METHODS['allocate'], email,
password, 'core')
return opennebula_user
except ConnectionRefusedError:
print('Could not connect to host: {host} via protocol {protocol}'.format(
host=settings.OPENNEBULA_DOMAIN,
protocol=settings.OPENNEBULA_PROTOCOL)
)
return opennebula_user
def _get_user_pool(self):
try:
user_pool = oca.UserPool(self.oneadmin_client)
@ -84,6 +84,13 @@ class OpenNebulaManager():
)
return user_pool
def create_template(self, name, cores, memory, disk_size):
"""Create and add a new template to opennebula.
:param name: A string representation describing the template.
Used as label in view.
:param cores: Amount of virtual cpu cores for the VM.
:param memory: Amount of RAM for the VM (MB)
:param disk_size: Amount of disk space for VM (MB)
"""
template_string_formatter = """<TEMPLATE>
<NAME>{name}</NAME>
<MEMORY>{memory}</MEMORY>