aboutsummaryrefslogtreecommitdiffstats
path: root/vicn/resource/lxd/lxc_container.py
diff options
context:
space:
mode:
authorMarcel Enguehard <mengueha+fdio@cisco.com>2017-05-29 13:13:32 +0200
committerMarcel Enguehard <mengueha+fdio@cisco.com>2017-05-29 13:13:32 +0200
commita836e5c16ea7df38646c46f2e9ffc6163ab05f06 (patch)
treed5cf3b799af7e9a328db245647a5cdce0ba744f4 /vicn/resource/lxd/lxc_container.py
parentbe0b435d307173598c30fcacc421b17112137099 (diff)
Misc bug fixes
*IP assignment *Node is a key attribute *Up-to-date packages *Trailing whitespaces ... Change-Id: Id8e2a5f7b2c4506f326b3c4bc991fa65f53fca5c Signed-off-by: Marcel Enguehard <mengueha+fdio@cisco.com>
Diffstat (limited to 'vicn/resource/lxd/lxc_container.py')
-rw-r--r--vicn/resource/lxd/lxc_container.py26
1 files changed, 4 insertions, 22 deletions
diff --git a/vicn/resource/lxd/lxc_container.py b/vicn/resource/lxd/lxc_container.py
index 5670d1a2..654b3bc5 100644
--- a/vicn/resource/lxd/lxc_container.py
+++ b/vicn/resource/lxd/lxc_container.py
@@ -128,9 +128,6 @@ class LxcContainer(Node):
if iface.get_type() == "dpdkdevice":
self.node.vpp_host.dpdk_devices.append(iface.pci_address)
- if 'vpp' in self.profiles:
- dummy = self.node.vpp_host.uio_devices
-
@task
def __get__(self):
client = self.node.lxd_hypervisor.client
@@ -158,7 +155,6 @@ class LxcContainer(Node):
log.debug('Container description: {}'.format(container))
client = self.node.lxd_hypervisor.client
self._container = client.containers.create(container, wait=True)
- #self._container.start(wait = True)
def _get_container_description(self):
# Base configuration
@@ -188,23 +184,6 @@ class LxcContainer(Node):
'path' : '/dev/{}'.format(device),
'type' : 'unix-char' }
-# # NETWORK (not for images)
-#
-# if not self.is_image:
-# container['config']['user.network_mode'] = 'link-local'
-# device = {
-# 'type' : 'nic',
-# 'name' : self.host_interface.device_name,
-# 'nictype' : 'bridged',
-# 'parent' : self.node.bridge.device_name,
-# }
-# device['hwaddr'] = AddressManager().get_mac(self)
-# prefix = 'veth-{}'.format(self.container_name)
-# device['host_name'] = AddressManager().get('device_name', self,
-# prefix = prefix, scope = prefix)
-#
-# container['devices'][device['name']] = device
-
# SOURCE
image_names = [alias['name'] for alias in self.node.lxd_hypervisor.aliases]
@@ -231,7 +210,6 @@ class LxcContainer(Node):
@task
def __delete__(self):
log.info("Delete container {}".format(self.container_name))
- import pdb; pdb.set_trace()
self.node.lxd_hypervisor.client.containers.remove(self.name)
#--------------------------------------------------------------------------
@@ -308,6 +286,10 @@ class LxcContainer(Node):
We don't currently use an eventually available SSH connection.
"""
+ if not self._container:
+ log.error("Executing command on uninitialized container", self, command)
+ import os; os._exit(1)
+
ret = self._container.execute(shlex.split(command))
# NOTE: pylxd documents the return value as a tuple, while it is in