network interface of a container if no network is
specified manually.
Change-Id: I8f206c8def1cd19084860e7d8a3fa4b0b37c2a5d
Signed-off-by: peusterm <manuel.peuster@uni-paderborn.de>
:return:
"""
assert name is not None
:return:
"""
assert name is not None
+ default_net = {"id": "emu0"}
# no duplications
if name in [c.name for c in self.net.getAllContainers()]:
raise Exception("Container with name %s already exists." % name)
# no duplications
if name in [c.name for c in self.net.getAllContainers()]:
raise Exception("Container with name %s already exists." % name)
if image is None:
image = "ubuntu:trusty"
if network is None:
if image is None:
image = "ubuntu:trusty"
if network is None:
- network = {} # {"ip": "10.0.0.254/8"}
if isinstance(network, dict):
if isinstance(network, dict):
+ if len(network) < 1:
+ # create at least one default interface
+ network = default_net
# if we have only one network, put it in a list
network = [network]
if isinstance(network, list):
if len(network) < 1:
# if we have only one network, put it in a list
network = [network]
if isinstance(network, list):
if len(network) < 1:
+ # create at least one default interface
+ network.append(default_net)
# apply hard-set resource limits=0
cpu_percentage = params.get('cpu_percent')
# apply hard-set resource limits=0
cpu_percentage = params.get('cpu_percent')