[libvirt] Bringing up LXC container from virsh command prompt.

Kumar L Srikanth-B22348 B22348 at freescale.com
Thu Mar 4 06:24:18 UTC 2010

I am new to libvirt virsh console.
Currently I am working on Linux Containers(LXC). After lot of
exploration, I am able to create a Linux Container(fedora12) with the
help of 
lxc-tools(lxc-create, lxc-start, ...etc). I am able to start that
container and use it's console. I am able to assign an IP address to the
by creating a bridge in the host machine and assigning it to the
Here, my goal is to bring up this container(fedora12) through libvirt
virsh command prompt. For that I created a domain with the following XML
<domain type='lxc' id='1'>
      <clock offset='utc'/>
        <filesystem type='mount'>
          <source dir='/root/lxc/fedora12'/>    /*This is the rootfs
directory for my linux container(fedora12)*/
          <target dir='/'/>  /* I mounted it to '/' directory in the
Domain. */
<console type='pty' />
I executed the following virsh commands:
# virsh --connect lxc:/// define vm1_fedora_container.xml
Domain vm1_fedora defined from /root/lxc_devel/fedora.xml
# virsh --connect lxc:/// list --all
 Id Name                 State
  - vm1_fedora           shut off
# virsh --connect lxc:/// start vm1_fedora
Domain vm1_fedora started
# virsh --connect lxc:/// list --all
 Id Name                 State
7805 vm1_fedora           running
# virsh --connect lxc:/// console vm1_fedora
Connected to domain vm1_fedora
Escape character is ^]
[root at localhost /]#

I am able to view the console of my container(fedora12), but when I
execute 'ifconfig' in that console, I am getting the following error:
bash: ifconfig: command not found
When I execute the same 'ifconfig' command through lxc-tools (like
lxc_start -n fedora12 /bin/bash), I am able to get the assigned IP
Can you please suggest me where did I go wrong?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20100304/1acf1a36/attachment-0001.htm>

More information about the libvir-list mailing list