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
e58b4331
authored
May 09, 2014
by
cloud
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix
parent
cf92ed49
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
9 deletions
+11
-9
circle/dashboard/views.py
+1
-4
circle/vm/models/instance.py
+10
-5
No files found.
circle/dashboard/views.py
View file @
e58b4331
...
...
@@ -241,7 +241,7 @@ class VmDetailView(CheckedDetailView):
'new_name'
:
self
.
__set_name
,
'new_description'
:
self
.
__set_description
,
'new_tag'
:
self
.
__add_tag
,
'deploy_local
l'
:
self
.
donothing
,
'deploy_local
'
:
self
.
__deploy_local
,
'to_remove'
:
self
.
__remove_tag
,
'port'
:
self
.
__add_port
,
'new_network_vlan'
:
self
.
__new_network
,
...
...
@@ -250,9 +250,6 @@ class VmDetailView(CheckedDetailView):
if
request
.
POST
.
get
(
k
)
is
not
None
:
return
v
(
request
)
def
donothing
(
self
,
request
):
pass
def
__deploy_local
(
self
,
request
):
self
.
object
=
self
.
get_object
()
if
not
self
.
object
.
has_level
(
request
.
user
,
'owner'
):
...
...
circle/vm/models/instance.py
View file @
e58b4331
...
...
@@ -31,6 +31,7 @@ from .node import Node, Trait
import
random
import
string
import
socket
logger
=
getLogger
(
__name__
)
pre_state_changed
=
Signal
(
providing_args
=
[
"new_state"
])
...
...
@@ -792,7 +793,7 @@ class Instance(AclBase, VirtualMachineDescModel, StatusModel, OperatedMixin,
queue
=
queue_name
)
.
get
(
timeout
=
timeout
)
def
__deploy
ii
_local_vm
(
self
,
act
,
timeout
=
15
):
def
__deploy_local_vm
(
self
,
act
,
timeout
=
15
):
"""Local deploy the virtual machine.
:param self: The virtual machine.
...
...
@@ -803,10 +804,15 @@ class Instance(AclBase, VirtualMachineDescModel, StatusModel, OperatedMixin,
# create hardlink
hlinkname
=
''
.
join
(
random
.
choice
(
string
.
ascii_uppercase
+
string
.
digits
)
for
_
in
range
(
20
))
remotedest
=
'/home/gergo/vmdisks/'
+
hlinkname
remotedest
=
hlinkname
localsrc
=
descriptor
[
'disk_list'
][
0
][
'source'
]
descriptor
[
'disk_list'
][
0
][
'source'
]
=
remotedest
return
""
originalname
=
localsrc
.
split
(
"/"
)
originalname
=
originalname
[
len
(
originalname
)
-
1
]
hlmakersocket
=
socket
.
socket
(
socket
.
AF_INET
,
socket
.
SOCK_STREAM
)
hlmakersocket
.
connect
((
'localhost'
,
40000
))
hlmakersocket
.
send
(
originalname
+
"/"
+
hlinkname
)
return
descriptor
def
deploy_local
(
self
,
user
=
None
,
task_uuid
=
None
):
"""Deploy new virtual machine with network
...
...
@@ -831,8 +837,7 @@ ecuted
with
instance_activity
(
code_suffix
=
'local_deploy'
,
instance
=
self
,
on_commit
=
__on_commit
,
task_uuid
=
task_uuid
,
user
=
user
)
as
act
:
return
""
# return self.__deploy_local_vm(act)
return
self
.
__deploy_local_vm
(
act
)
def
migrate_vm
(
self
,
to_node
,
timeout
=
120
):
queue_name
=
self
.
get_remote_queue_name
(
'vm'
)
...
...
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