Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Gutyán Gábor
/
circlestack
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
0dd197ec
authored
Mar 31, 2014
by
Dudás Ádám
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
vm: remove default value for user param of operations
parent
57bfd4cf
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
14 deletions
+14
-14
circle/vm/models/operation.py
+14
-14
No files found.
circle/vm/models/operation.py
View file @
0dd197ec
...
...
@@ -45,14 +45,14 @@ class Operation:
self
.
check_precond
()
return
self
.
create_activity
(
user
=
user
)
def
_exec_op
(
self
,
activity
,
user
=
None
,
**
kwargs
):
def
_exec_op
(
self
,
activity
,
user
,
**
kwargs
):
"""Execute the operation inside the specified activity's context.
"""
with
activity_context
(
activity
,
on_abort
=
self
.
on_abort
,
on_commit
=
self
.
on_commit
):
return
self
.
_operation
(
activity
,
user
,
**
kwargs
)
def
_operation
(
self
,
activity
,
user
=
None
,
**
kwargs
):
def
_operation
(
self
,
activity
,
user
,
**
kwargs
):
"""This method is the operation's particular implementation.
Deriving classes should implement this method.
...
...
@@ -88,7 +88,7 @@ class Operation:
raise
PermissionDenied
(
"
%
s doesn't have the required permissions."
%
user
)
def
create_activity
(
self
,
user
=
None
):
def
create_activity
(
self
,
user
):
return
InstanceActivity
.
create
(
code_suffix
=
self
.
activity_code_suffix
,
instance
=
self
.
instance
,
user
=
user
)
...
...
@@ -133,7 +133,7 @@ class DeployOperation(Operation):
def
on_commit
(
self
,
activity
):
activity
.
resultant_state
=
'RUNNING'
def
_operation
(
self
,
activity
,
user
=
None
):
def
_operation
(
self
,
activity
,
user
):
if
self
.
instance
.
destroyed_at
:
raise
self
.
instance
.
InstanceDestroyedError
(
self
.
instance
)
...
...
@@ -182,7 +182,7 @@ class DestroyOperation(Operation):
def
on_commit
(
self
,
activity
):
activity
.
resultant_state
=
'DESTROYED'
def
_operation
(
self
,
activity
,
user
=
None
):
def
_operation
(
self
,
activity
,
user
):
if
self
.
instance
.
node
:
self
.
instance
.
_destroy_vm
(
activity
)
...
...
@@ -206,7 +206,7 @@ class MigrateOperation(Operation):
name
=
_
(
"migrate"
)
description
=
_
(
"""Live migrate running vm to another node."""
)
def
_operation
(
self
,
activity
,
to_node
=
None
,
user
=
None
,
timeout
=
120
):
def
_operation
(
self
,
activity
,
user
,
to_node
=
None
,
timeout
=
120
):
if
not
to_node
:
with
activity
.
sub_activity
(
'scheduling'
)
as
sa
:
to_node
=
self
.
instance
.
select_node
()
...
...
@@ -240,7 +240,7 @@ class RebootOperation(Operation):
name
=
_
(
"reboot"
)
description
=
_
(
"""Reboot virtual machine with Ctrl+Alt+Del signal."""
)
def
_operation
(
self
,
activity
,
user
=
None
,
timeout
=
5
):
def
_operation
(
self
,
activity
,
user
,
timeout
=
5
):
queue_name
=
self
.
instance
.
get_remote_queue_name
(
'vm'
)
vm_tasks
.
reboot
.
apply_async
(
args
=
[
self
.
instance
.
vm_name
],
queue
=
queue_name
)
.
get
(
timeout
=
timeout
)
...
...
@@ -265,7 +265,7 @@ class RedeployOperation(Operation):
:type task_uuid: str
"""
)
def
_operation
(
self
,
activity
,
user
=
None
):
def
_operation
(
self
,
activity
,
user
):
# Destroy VM
if
self
.
instance
.
node
:
self
.
instance
.
_destroy_vm
(
activity
)
...
...
@@ -287,7 +287,7 @@ class ResetOperation(Operation):
name
=
_
(
"reset"
)
description
=
_
(
"""Reset virtual machine (reset button)"""
)
def
_operation
(
self
,
activity
,
user
=
None
,
timeout
=
5
):
def
_operation
(
self
,
activity
,
user
,
timeout
=
5
):
queue_name
=
self
.
instance
.
get_remote_queue_name
(
'vm'
)
vm_tasks
.
reset
.
apply_async
(
args
=
[
self
.
instance
.
vm_name
],
queue
=
queue_name
)
.
get
(
timeout
=
timeout
)
...
...
@@ -306,7 +306,7 @@ class SaveAsTemplateOperation(Operation):
Users can instantiate Virtual Machines from Templates.
"""
)
def
_operation
(
self
,
activity
,
name
,
user
=
None
,
timeout
=
300
,
**
kwargs
):
def
_operation
(
self
,
activity
,
name
,
user
,
timeout
=
300
,
**
kwargs
):
# prepare parameters
params
=
{
'access_method'
:
self
.
instance
.
access_method
,
...
...
@@ -368,7 +368,7 @@ class ShutdownOperation(Operation):
def
on_commit
(
self
,
activity
):
activity
.
resultant_state
=
'STOPPED'
def
_operation
(
self
,
activity
,
user
=
None
,
timeout
=
120
):
def
_operation
(
self
,
activity
,
user
,
timeout
=
120
):
queue_name
=
self
.
instance
.
get_remote_queue_name
(
'vm'
)
logger
.
debug
(
"RPC Shutdown at queue:
%
s, for vm:
%
s."
,
self
.
instance
.
vm_name
,
queue_name
)
# TODO param order ok?
...
...
@@ -391,7 +391,7 @@ class ShutOffOperation(Operation):
def
on_commit
(
activity
):
activity
.
resultant_state
=
'STOPPED'
def
_operation
(
self
,
activity
,
user
=
None
):
def
_operation
(
self
,
activity
,
user
):
# Destroy VM
if
self
.
instance
.
node
:
self
.
instance
.
_destroy_vm
(
activity
)
...
...
@@ -422,7 +422,7 @@ class SleepOperation(Operation):
def
on_commit
(
self
,
activity
):
activity
.
resultant_state
=
'SUSPENDED'
def
_operation
(
self
,
activity
,
user
=
None
,
timeout
=
60
):
def
_operation
(
self
,
activity
,
user
,
timeout
=
60
):
# Destroy networks
with
activity
.
sub_activity
(
'destroying_net'
):
for
net
in
self
.
instance
.
interface_set
.
all
():
...
...
@@ -460,7 +460,7 @@ class WakeUpOperation(Operation):
def
on_commit
(
self
,
activity
):
activity
.
resultant_state
=
'RUNNING'
def
_operation
(
self
,
activity
,
user
=
None
,
timeout
=
60
):
def
_operation
(
self
,
activity
,
user
,
timeout
=
60
):
# Schedule vm
self
.
instance
.
_schedule_vm
(
activity
)
queue_name
=
self
.
instance
.
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