Exemple #1
0
    def start(cls, container_id, veths, gateway):
        """start eths and continer"""
        try:
            cls.docker_cli.start(
                container=container_id,
                #extra_hosts={'ldap.xxx.com.cn':'172.16.11.3'},
                privileged=True)
        except dockerpy.errors.APIError as e:
            logger.error(traceback.format_exc())
            raise ContainerActionError(str(e))

        for index, (veth, link_to, ip_netmask) in enumerate(veths):
            macvlan_eth = MacvlanEth(veth, ip_netmask, link_to).create()
            if index == 0:
                macvlan_eth.attach_to_container(container_id,
                                                is_route=True,
                                                gateway=gateway)
            else:
                macvlan_eth.attach_to_container(container_id)
Exemple #2
0
 def setUp(self):
     self._veth_name = 'testMacvlan'
     self._ip_mask = '192.168.16.10/24'
     self._macvlan = MacvlanEth(self._veth_name, self._ip_mask, TEST_MOTHER_ETH_NAME)
Exemple #3
0
 def setUp(self):
     self._veth_name = 'testMacvlan'
     self._ip_mask = '192.168.16.10/24'
     self._macvlan = MacvlanEth(self._veth_name, self._ip_mask, 'eth0')