Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Gyuricska Milán
/
cloud
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
bd497c80
authored
Sep 03, 2013
by
tarokkk
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
vm serializer for deploy
parent
6e8e3ebb
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
26 additions
and
42 deletions
+26
-42
vm/models.py
+26
-42
No files found.
vm/models.py
View file @
bd497c80
...
...
@@ -380,48 +380,32 @@ class Instance(BaseResourceConfigModel, TimeStampedModel):
except
:
return
def
deploy
(
self
,
extra
=
""
):
# TODO implement
pass
# """Submit a new instance to OpenNebula."""
# inst = Instance(pw=pwgen(), template=template, owner=owner,
# share=share, state='PENDING', waiting=True)
# inst.save()
# hostname = u"%d" % (inst.id, )
# token = signing.dumps(inst.id, salt='activate')
# try:
# details = owner.cloud_details
# except:
# details = UserCloudDetails(user=owner)
# details.save()
#
# ctx = create_context(inst.pw, hostname, details.smb_password,
# details.ssh_private_key, owner.username,
# token, extra)
# try:
# from .tasks import CreateInstanceTask
# x = CreateInstanceTask.delay(
# name=u"%s %d" % (owner.username, inst.id),
# instance_type=template.instance_type.name,
# disk_id=int(template.disk.id),
# network_id=int(template.network.id),
# ctx=ctx,
# )
# 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
deploy
(
self
):
''' Launch celery task to handle asyncron jobs.
'''
manager
.
deploy
.
apply_async
(
self
)
def
deploy_task
(
self
):
''' Deploy virtual machine on remote node
'''
instance
=
{
'name'
:
'cloud-'
+
self
.
id
,
'vcpu'
:
self
.
num_cores
,
'memory'
:
self
.
ram_size
,
'memory_max'
:
self
.
max_ram_size
,
'cpu_share'
:
self
.
priority
,
'arch'
:
self
.
arch
,
'boot_menu'
:
self
.
boot_menu
,
'network_list'
:
[
n
.
get_vmnetwork_desc
()
for
n
in
self
.
interface_set
.
all
()],
'disk_list'
:
[
n
.
get_vmdisk_desc
()
for
n
in
self
.
disks
.
all
()],
'graphics'
:
{
'type'
:
'vnc'
,
'listen'
:
'0.0.0.0'
,
'passwd'
:
''
,
'port'
:
self
.
get_vnc_port
()},
'raw_data'
:
self
.
raw_data
}
tasks
.
create
.
apply_async
(
instance
,
queue
=
self
.
node
+
".vm"
)
.
get
()
def
stop
(
self
):
# TODO implement
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment