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
1767d22c
authored
Sep 02, 2014
by
Bach Dániel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
agent: call send_networking_commands() in AddInterfaceOperation
parent
05b07694
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
12 deletions
+18
-12
circle/vm/operations.py
+2
-1
circle/vm/tasks/local_agent_tasks.py
+16
-11
No files found.
circle/vm/operations.py
View file @
1767d22c
...
@@ -41,7 +41,7 @@ from .models import (
...
@@ -41,7 +41,7 @@ from .models import (
Instance
,
InstanceActivity
,
InstanceTemplate
,
Interface
,
Node
,
Instance
,
InstanceActivity
,
InstanceTemplate
,
Interface
,
Node
,
NodeActivity
,
pwgen
NodeActivity
,
pwgen
)
)
from
.tasks
import
agent_tasks
from
.tasks
import
agent_tasks
,
local_agent_tasks
from
dashboard.store_api
import
Store
,
NoStoreException
from
dashboard.store_api
import
Store
,
NoStoreException
...
@@ -153,6 +153,7 @@ class AddInterfaceOperation(InstanceOperation):
...
@@ -153,6 +153,7 @@ class AddInterfaceOperation(InstanceOperation):
self
.
rollback
(
net
,
activity
)
self
.
rollback
(
net
,
activity
)
raise
raise
net
.
deploy
()
net
.
deploy
()
local_agent_tasks
.
send_networking_commands
(
self
.
instance
,
activity
)
def
get_activity_name
(
self
,
kwargs
):
def
get_activity_name
(
self
,
kwargs
):
return
create_readable
(
ugettext_noop
(
"add
%(vlan)
s interface"
),
return
create_readable
(
ugettext_noop
(
"add
%(vlan)
s interface"
),
...
...
circle/vm/tasks/local_agent_tasks.py
View file @
1767d22c
...
@@ -33,7 +33,8 @@ from celery.result import TimeoutError
...
@@ -33,7 +33,8 @@ from celery.result import TimeoutError
from
monitor.client
import
Client
from
monitor.client
import
Client
def
send_init_commands
(
instance
,
act
,
vm
):
def
send_init_commands
(
instance
,
act
):
vm
=
instance
.
vm_name
queue
=
instance
.
get_remote_queue_name
(
"agent"
)
queue
=
instance
.
get_remote_queue_name
(
"agent"
)
with
act
.
sub_activity
(
'cleanup'
,
readable_name
=
ugettext_noop
(
'cleanup'
)):
with
act
.
sub_activity
(
'cleanup'
,
readable_name
=
ugettext_noop
(
'cleanup'
)):
cleanup
.
apply_async
(
queue
=
queue
,
args
=
(
vm
,
))
cleanup
.
apply_async
(
queue
=
queue
,
args
=
(
vm
,
))
...
@@ -48,6 +49,17 @@ def send_init_commands(instance, act, vm):
...
@@ -48,6 +49,17 @@ def send_init_commands(instance, act, vm):
queue
=
queue
,
args
=
(
vm
,
instance
.
primary_host
.
hostname
))
queue
=
queue
,
args
=
(
vm
,
instance
.
primary_host
.
hostname
))
def
send_networking_commands
(
instance
,
act
):
queue
=
instance
.
get_remote_queue_name
(
"agent"
)
with
act
.
sub_activity
(
'change_ip'
,
readable_name
=
ugettext_noop
(
'change ip'
)):
change_ip
.
apply_async
(
queue
=
queue
,
args
=
(
instance
.
vm_name
,
)
+
get_network_configs
(
instance
))
with
act
.
sub_activity
(
'restart_networking'
,
readable_name
=
ugettext_noop
(
'restart networking'
)):
restart_networking
.
apply_async
(
queue
=
queue
,
args
=
(
instance
.
vm_name
,
))
def
create_agent_tar
():
def
create_agent_tar
():
def
exclude
(
tarinfo
):
def
exclude
(
tarinfo
):
if
tarinfo
.
name
.
startswith
(
'./.git'
):
if
tarinfo
.
name
.
startswith
(
'./.git'
):
...
@@ -93,16 +105,9 @@ def agent_started(vm, version=None):
...
@@ -93,16 +105,9 @@ def agent_started(vm, version=None):
if
not
initialized
:
if
not
initialized
:
measure_boot_time
(
instance
)
measure_boot_time
(
instance
)
send_init_commands
(
instance
,
act
,
vm
)
send_init_commands
(
instance
,
act
)
with
act
.
sub_activity
(
'change_ip'
,
send_networking_commands
(
instance
,
act
)
readable_name
=
ugettext_noop
(
'change ip'
)):
change_ip
.
apply_async
(
queue
=
queue
,
args
=
(
vm
,
)
+
get_network_configs
(
instance
))
with
act
.
sub_activity
(
'restart_networking'
,
readable_name
=
ugettext_noop
(
'restart networking'
)):
restart_networking
.
apply_async
(
queue
=
queue
,
args
=
(
vm
,
))
with
act
.
sub_activity
(
with
act
.
sub_activity
(
'start_access_server'
,
'start_access_server'
,
readable_name
=
ugettext_noop
(
'start access server'
)
readable_name
=
ugettext_noop
(
'start access server'
)
...
...
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