Re: [libvirt] How to execute an initial script in a container to start the network interface automatically

2014-01-02 Thread Laine Stump
On 01/02/2014 05:16 AM, WANG Cheng D wrote:

 Dear All,

  

 Happy new year to you.

  

 I have a similar question which had been replied by Daniel in the
 following post:

  

 http://www.redhat.com/archives/libvir-list/2010-March/msg00296.html

  

 I also want to assign a static IP to the container.

  

 As Daniel said, I can successfully assign a static IP to the container
 manually using  # ifconfig eth0 192.168.122.3 netmask 255.255.255.0 up.

  

 Daniel also said that we can use the regular distro initscripts to
 automatically start the network interface, but this doesn't work on my
 system.

  

 My host is fedora16.


I haven't played with lxc enough to answer your question, but you
*definitely* need to upgrade your Fedora installation - Fedora 16 has
been out of support (i.e. no new updates, not even for security holes)
for almost a year now. Even if you're building your own libvirt from
source (the 1.0.3 libvirt you're using is newer than the last update of
libvirt for F16, but still several months out of date), the other
packages on the system will be extremely out of date and likely to cause
problems that will never be fixed (because no F16 package will ever
again be updated).

  

 My libvirtd and virsh version is 1.0.3.

  



--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

[libvirt] How to execute an initial script in a container to start the network interface automatically

2014-01-01 Thread WANG Cheng D
Dear All,

Happy new year to you.

I have a similar question which had been replied by Daniel in the following 
post:

http://www.redhat.com/archives/libvir-list/2010-March/msg00296.html

I also want to assign a static IP to the container.

As Daniel said, I can successfully assign a static IP to the container manually 
using  # ifconfig eth0 192.168.122.3 netmask 255.255.255.0 up.

Daniel also said that we can use the regular distro initscripts to 
automatically start the network interface, but this doesn't work on my system.

My host is fedora16. I used the command yum --installroot=/root/fedora16lxc 
--releasever=16 install -y openssh, bridge-utils to setup the rootfs for my 
container, but I am not sure if it is a right way.

After rootfs installation, there is no sub-directory named network-scripts in 
/etc/sysconfig . So, I created this directory manually and added a file named 
ifcfg-eth0.

In my container's XML script, I use init/bin/sh/init. If I use 
init/bin/init/init,  it seems that the container doesn't boot correctly 
because there are strings keeping rolling in the console.

My libvirtd and virsh version is 1.0.3.

I tried to add files .bash_profile and .bashrc in which I revised the shell 
environment variable such as PATH, I also added the ifconfig in the script to 
try to configure eth0 automatically, but it doesn't work.

I wonder if there is a .bashrc for the root of a container? If there is, 
where should this file be located?

In summary, I have two questions


1)   How to setup rootfs for a container?



2)   If a container can automatically execute an initial script when 
booting?

Your reply is highly appreciated.

With my warmest regards,

Cheng

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list