aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--vicn/core/task.py6
-rw-r--r--vicn/resource/linux/link.py12
-rw-r--r--vicn/resource/lxd/lxc_container.py6
3 files changed, 13 insertions, 11 deletions
diff --git a/vicn/core/task.py b/vicn/core/task.py
index 9c92ef4d..53321972 100644
--- a/vicn/core/task.py
+++ b/vicn/core/task.py
@@ -68,7 +68,7 @@ class ConcurrentMixin:
try:
for t in self._elements:
await t.execute()
- rets = await asyncio.gather(*[t.get_future()
+ rets = await asyncio.gather(*[t.get_future()
for t in self._elements])
# The result value is the "union" of all result values
@@ -116,7 +116,7 @@ class CompositionMixin:
print('we need to cancel tasks not executed...')
self.get_future().set_exception(e)
-Task, EmptyTask = SchedulingAlgebra(BaseTask, ConcurrentMixin,
+Task, EmptyTask = SchedulingAlgebra(BaseTask, ConcurrentMixin,
CompositionMixin, SequentialMixin)
def task(fn):
@@ -287,7 +287,7 @@ class BashTask(Task):
try:
rv = fut.result()
if self._parse is None and rv.return_value != 0:
- raise Exception('Bash command failed', self.get_full_cmd(), rv)
+ raise Exception('Bash command failed on node {}'.format(self._node.name), self.get_full_cmd(), rv)
if self._post:
self._post()
if self._parse:
diff --git a/vicn/resource/linux/link.py b/vicn/resource/linux/link.py
index b3ba4e07..a930b8a3 100644
--- a/vicn/resource/linux/link.py
+++ b/vicn/resource/linux/link.py
@@ -118,17 +118,17 @@ class Link(Channel):
#XXX VPP
if hasattr(self.src_node, 'vpp') and not self.src_node.vpp is None:
- vpp_src = VPPInterface(parent = self.src,
+ vpp_src = VPPInterface(parent = self._src,
vpp = self.src_node.vpp,
- ip_address = Reference(self.src, 'ip_address'),
- device_name = 'vpp' + self.src.device_name)
+ ip_address = Reference(self._src, 'ip_address'),
+ device_name = 'vpp' + self._src.device_name)
manager.commit_resource(vpp_src)
if hasattr(self.dst_node, 'vpp') and not self.dst_node.vpp is None:
- vpp_dst = VPPInterface(parent = self.dst,
+ vpp_dst = VPPInterface(parent = self._dst,
vpp = self.dst_node.vpp,
- ip_address = Reference(self.dst, 'ip_address'),
- device_name = 'vpp' + self.dst.device_name)
+ ip_address = Reference(self._dst, 'ip_address'),
+ device_name = 'vpp' + self._dst.device_name)
manager.commit_resource(vpp_dst)
#--------------------------------------------------------------------------
diff --git a/vicn/resource/lxd/lxc_container.py b/vicn/resource/lxd/lxc_container.py
index afa64aba..7c678e57 100644
--- a/vicn/resource/lxd/lxc_container.py
+++ b/vicn/resource/lxd/lxc_container.py
@@ -33,7 +33,7 @@ from vicn.core.commands import ReturnValue
from vicn.core.exception import ResourceNotFound
from vicn.core.requirement import Requirement
from vicn.core.resource_mgr import wait_resource_task
-from vicn.core.task import task, inline_task, BashTask
+from vicn.core.task import task, inline_task, BashTask, EmptyTask
from vicn.resource.linux.net_device import NetDevice
from vicn.resource.node import Node
from vicn.resource.vpp.scripts import APPARMOR_VPP_PROFILE
@@ -140,7 +140,9 @@ class LxcContainer(Node):
"""
Make sure vpp_host is instanciated before starting the container.
"""
- wait_vpp_host = wait_resource_task(self.node.vpp_host)
+ wait_vpp_host = EmptyTask()
+ if 'vpp' in self.profiles:
+ wait_vpp_host = wait_resource_task(self.node.vpp_host)
create = self._create_container()
start = self.__method_start__()
return wait_vpp_host > (create > start)