Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Fukász Rómeó Ervin
/
cloud
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
A prog2-höz tartozó friss repo anyagok itt elérhetőek:
https://git.iit.bme.hu/
Commit
0caef6e0
authored
Sep 25, 2014
by
Őry Máté
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
vm: add remote operation classes
parent
613c590c
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
28 additions
and
1 deletions
+28
-1
circle/vm/operations.py
+28
-1
No files found.
circle/vm/operations.py
View file @
0caef6e0
...
...
@@ -42,13 +42,28 @@ from .models import (
Instance
,
InstanceActivity
,
InstanceTemplate
,
Interface
,
Node
,
NodeActivity
,
pwgen
)
from
.tasks
import
agent_tasks
,
local_agent_tasks
from
.tasks
import
agent_tasks
,
local_agent_tasks
,
vm_tasks
from
dashboard.store_api
import
Store
,
NoStoreException
logger
=
getLogger
(
__name__
)
class
RemoteOperationMixin
(
object
):
remote_timeout
=
30
def
_operation
(
self
,
**
kwargs
):
args
=
self
.
_get_remote_args
(
**
kwargs
),
return
self
.
task
.
apply_async
(
args
=
args
,
queue
=
self
.
_get_remote_queue
()
)
.
get
(
timeout
=
self
.
remote_timeout
)
def
check_precond
(
self
):
super
(
RemoteOperationMixin
,
self
)
.
check_precond
()
self
.
_get_remote_queue
()
class
InstanceOperation
(
Operation
):
acl_level
=
'owner'
async_operation
=
abortable_async_instance_operation
...
...
@@ -116,6 +131,18 @@ class InstanceOperation(Operation):
return
False
class
RemoteInstanceOperation
(
RemoteOperationMixin
,
InstanceOperation
):
remote_queue
=
(
'vm'
,
'fast'
)
# activity_code_suffix = property(lambda self: self.id or self.task.name)
def
_get_remote_queue
(
self
):
return
self
.
instance
.
get_remote_queue_name
(
*
self
.
remote_queue
)
def
_get_remote_args
(
self
,
**
kwargs
):
return
[
self
.
instance
.
vm_name
]
@register_operation
class
AddInterfaceOperation
(
InstanceOperation
):
activity_code_suffix
=
'add_interface'
...
...
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