Hi Robie

Thank you so much for your reply.  I don't know whether it is a bug for
the lxc of ubuntu . But I will try to describe the issue I met in
detail.

My Lxc version is: 
lxc version: 0.7.5

My Operation system  information as following
Distributor ID: Ubuntu
Description:    Ubuntu 12.04.3 LTS

My purpose is to create the container and execute the command remotely
on the new container. I think the lxclite is just the wrapper for the
standard lxc tool . I currently write a simple demo to show the issue .

The following is the test case 1

#!/usr/bin/python

import commands
from fabric.api import settings
from fabric.operations import run
import sys

def main():
    result = commands.getstatusoutput("lxc-create -t ubuntu -n test")
    if result[0] != 0:
        sys.exit(1)
    result = commands.getstatusoutput("lxc-start -d -n test")
    if result[0] != 0:
        sys.exit(1)

    result = commands.getstatusoutput("awk '{ print $4,$3 }'
/var/lib/misc/dnsmasq.leases | column -t | grep test |awk '{print $2}'")

    ip = result[1]
    print ip

    with settings(host_string=ip,user="ubuntu",password="ubuntu"):
        print run("whoami",shell=True)

if __name__ == "__main__":
    main()

The above test code just use python module to call the standard lxc tool
, and then using the fabric to execute the command on the new container.

The IP address for the new container could be extract correctly , but
the remote command execution will not work due to the low level socket
error as following

fabric.exceptions.NetworkError: Low level socket error connecting to
host 10.0.3.223 on port 22: No route to host (tried 1 time)

I check the info for the container 
> lxc-info -n test
state:   RUNNING
pid:     14646

The test case 2 is that I keep the container running , and just run the
code  for remote command execution

#!/usr/bin/python

from fabric.api import settings
from fabric.operations import run

import commands

result = commands.getstatusoutput("awk '{ print $4,$3 }'
/var/lib/misc/dnsmasq.leases | column -t | grep test |awk '{print $2}'")

ip = result[1]

print ip
with settings(host_string=ip,user="ubuntu",password="ubuntu"):
        print run("whoami",shell=True)
~                                       
And it will work  , the output is :
[10.0.3.223] run: whoami
[10.0.3.223] out: ubuntu
[10.0.3.223] out: 

ubuntu

My personal opinion is that after the lxc-create and lxc-start , the lxc
tool may have update some network information on the system so that the
system can route the ip to the right place .

In test case 1, all the steps on in one process , so the process may not
know the update information for the network . Maybe I need some code to
reimport the network information into the process .

Due to I am a new guy in lxc , I don't have any concept about it . So
hope you can help me , thanks .

-- 
You received this bug notification because you are a member of Ubuntu
Server Team, which is subscribed to lxc in Ubuntu.
https://bugs.launchpad.net/bugs/1264338

Title:
  could not route the host for container

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/lxc/+bug/1264338/+subscriptions

-- 
Ubuntu-server-bugs mailing list
Ubuntu-server-bugs@lists.ubuntu.com
Modify settings or unsubscribe at: 
https://lists.ubuntu.com/mailman/listinfo/ubuntu-server-bugs

Reply via email to