[Bug 1264338] [NEW] could not route the host for container

2013-12-26 Thread markshao
Public bug reported:

Create the container using lxclite python package and try to use the
Fabric to execute the command remotely.

All of the above steps are done in on process.

Always get the exception Low level socket error connecting to host
10.0.3.181 on port 22: , could not route the host.

My guess is that whether after create the lxc container , the network
related infomation has been update by the system , but the process
hasn't detected the update infomation , so it could not route to the
host.

I don't know whether it is a bug , bug I need more information about the
network issues for the new creation of the container.

** Affects: lxc (Ubuntu)
 Importance: Undecided
 Status: New

-- 
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


[Bug 1264338] Re: could not route the host for container

2013-12-26 Thread markshao
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