[Lxc-users] How to start the network services so as to get the IP address using lxc-execute???

Greg Kurz gkurz at fr.ibm.com
Tue Dec 13 09:36:30 UTC 2011


On Tue, 2011-12-13 at 14:42 +0530, nishant mungse wrote:
> Hi,
> 
> My basic need::
> 
> I am writing a simple socket programme and as input to programme I
> want to give the IP address of containers. Now I have IP address in
> sequential order, but to make my socket programme running I need the
> networking service of the containers to start.
> 

Hmmm... not enough context again. Where does the program run: container
or host ? What does it do ?

> I am able to do this using lxc-start as it call lxc-init where upstart
                            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Are you sure this is what you want to say ? AFAIK lxc-start doesn't call
lxc-init by default but /sbin/init (upstart in your case).

>  which handles the starting of service during booting, but I don't

Right.

>  want to use this lxc-start, but want to start only networking service

Why don't you want to use lxc-start ? Is it because you want to defer
the starting of some services to a later time ?

>  so that my socket programme works.
> 
> Can I start only networking service using lxc-execute or not????
> 

No you can't.

> 
> Is there any other solution to this?????
> 

If your need is to defer the startup of some services, then it's an
upstart story... I don't know upstart but I guess it's possible to
configure it so that when you do lxc-start, a minimal set of services
will be started to provide network.

> Regards,
> Nishant 
> 

Cheers.

--
Greg

> On Mon, Dec 12, 2011 at 3:31 PM, Greg Kurz <gkurz at fr.ibm.com> wrote:
>         On Mon, 2011-12-12 at 11:54 +0530, nishant mungse wrote:
>         > Hi Geordy,
>         >
>         
>         Hi Nishant,
>         
>         I removed Cc: to containers@ as your troubles are about using
>         the lxc
>         userspace tool: lxc-users@ is THE place for seeking help.
>         
>         > This script gives the IP address of running system, but what
>         I want is
>         > to get the IP address of the containers that are not started
>         using
>         > lxc-start, lxc-start will call /sbin/init to init all the
>         system, but
>         > I want to use lxc-execute that will no init the system.
>         >
>         
>         
>         I still don't understand what you intend to do... All I can
>         say is that
>         using lxc-execute to partially start a container (that's what
>         you're
>         doing when you want do lxc-execute /etc/init.d/networking) is
>         a total
>         nonsense. Sorry.
>         
>         >
>         > Hey Greg you said that, it is possible to get the IP address
>         without
>         > starting the containers how can we do this????
>         >
>         
>         
>         Your containers don't get their IP addresses in a vacuum...
>         Either the
>         addresses are statically configured is some distro specific
>         file, either
>         they are assigned by an external service (DHCP most of the
>         time).
>         In the first case, you can probably find the address by
>         parsing the
>         appropriate file from your container's filesystem
>         (/etc/sysconfig/network-scripts/ifcfg-eth0 for example on
>         redhat). In
>         the second case, it depends on the DHCP server setup... please
>         see that
>         with your sysadmin.
>         
>         > And one more question how to start the network services
>         using
>         > lxc-execute
>         >
>         
>         
>         As told before, nonsense.
>         
>         >
>         > Please help me ASAP.
>         >
>         >
>         
>         That's what several people on the list are trying to do... If
>         you really
>         need help, stop asking about how to misuse lxc-execute and
>         give some
>         hints about your network setup... Do your containers use
>         static
>         addresses ? Do they rely on a DHCP server ? Are you sysadmin
>         for the
>         DHCP server ?
>         
>         Unless you provide more context, I'm afraid nobody will be
>         able to help
>         you...
>         
>         Cheers.
>         
>         --
>         Gregory Kurz
>         gkurz at fr.ibm.com
>         Software Engineer @ IBM/Meiosys
>          http://www.ibm.com
>         Tel +33 (0)534 638 479                           Fax +33
>         (0)561 400 420
>         
>         "Anarchy is about taking complete responsibility for
>         yourself."
>                Alan Moore.
>         
>         
> 






More information about the lxc-users mailing list