Commit bd497c80 by tarokkk

vm serializer for deploy

parent 6e8e3ebb
...@@ -380,48 +380,32 @@ class Instance(BaseResourceConfigModel, TimeStampedModel): ...@@ -380,48 +380,32 @@ class Instance(BaseResourceConfigModel, TimeStampedModel):
except: except:
return return
def deploy(self, extra=""): def deploy(self):
# TODO implement ''' Launch celery task to handle asyncron jobs.
pass '''
# """Submit a new instance to OpenNebula.""" manager.deploy.apply_async(self)
# inst = Instance(pw=pwgen(), template=template, owner=owner,
# share=share, state='PENDING', waiting=True) def deploy_task(self):
# inst.save() ''' Deploy virtual machine on remote node
# hostname = u"%d" % (inst.id, ) '''
# token = signing.dumps(inst.id, salt='activate') instance = {
# try: 'name': 'cloud-' + self.id,
# details = owner.cloud_details 'vcpu': self.num_cores,
# except: 'memory': self.ram_size,
# details = UserCloudDetails(user=owner) 'memory_max': self.max_ram_size,
# details.save() 'cpu_share': self.priority,
# 'arch': self.arch,
# ctx = create_context(inst.pw, hostname, details.smb_password, 'boot_menu': self.boot_menu,
# details.ssh_private_key, owner.username, 'network_list': [n.get_vmnetwork_desc()
# token, extra) for n in self.interface_set.all()],
# try: 'disk_list': [n.get_vmdisk_desc() for n in self.disks.all()],
# from .tasks import CreateInstanceTask 'graphics': {'type': 'vnc',
# x = CreateInstanceTask.delay( 'listen': '0.0.0.0',
# name=u"%s %d" % (owner.username, inst.id), 'passwd': '',
# instance_type=template.instance_type.name, 'port': self.get_vnc_port()},
# disk_id=int(template.disk.id), 'raw_data': self.raw_data
# network_id=int(template.network.id), }
# ctx=ctx, tasks.create.apply_async(instance, queue=self.node + ".vm").get()
# )
# res = x.get(timeout=10)
# res['one_id']
# except:
# inst.delete()
# raise Exception("Unable to create VM instance.")
#
# inst.one_id = res['one_id']
# inst.ip = res['interfaces'][0]['ip']
# inst.name = ("%(neptun)s %(template)s (%(id)d)" %
# {'neptun': owner.username, 'template': template.name,
# 'id': inst.one_id})
# inst.save()
#
# inst._create_host(hostname, res)
# return inst
def stop(self): def stop(self):
# TODO implement # TODO implement
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment