Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
CIRCLE
/
cloud
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
94
Merge Requests
10
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
Hide 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):
...
@@ -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
...
...
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