[libvirt] Regarding lxc driver for libvirt.

Hi, I am new to libvirt. I want to create a Domain using libvirt XML. In order to mount the host's '/home/srikanth' directory to the new container's '/' directory, my XML format is shown below: <domain type='lxc' id='1'> <name>container1_vm</name> <memory>500000</memory> <os> <type>exe</type> <init>/bin/sh</init> </os> <vcpu>1</vcpu> <clock offset='utc'/> <on_poweroff>destroy</on_poweroff> <on_reboot>restart</on_reboot> <on_crash>destroy</on_crash> <devices> <emulator>/usr/libexec/libvirt_lxc</emulator> <filesystem type='mount'> <source dir='/home/srikanth'/> <target dir='/'/> </filesystem> <console type='pty' /> </devices> </domain> With the above libvirt XML, Domain is defining, but not starting. When I issue the start command it's saying "Domain started", but showing "shut off" status. If I changed the target directory(<traget dir='/'/>) from '/' to '/home/container1'(<traget dir='/home/container1'/>), the domain is starting normally and I am able to see the contents in the target directory. Can you please let me know, how can I set the target directory to '/'? By the way, I am using libvirt version o.7.6. Regards, Srikanth.

On Fri, Feb 05, 2010 at 04:01:34PM +0530, Kumar L Srikanth-B22348 wrote:
Hi, I am new to libvirt. I want to create a Domain using libvirt XML. In order to mount the host's '/home/srikanth' directory to the new container's '/' directory, my XML format is shown below:
<domain type='lxc' id='1'> <name>container1_vm</name> <memory>500000</memory> <os> <type>exe</type> <init>/bin/sh</init> </os> <vcpu>1</vcpu> <clock offset='utc'/> <on_poweroff>destroy</on_poweroff> <on_reboot>restart</on_reboot> <on_crash>destroy</on_crash> <devices> <emulator>/usr/libexec/libvirt_lxc</emulator> <filesystem type='mount'> <source dir='/home/srikanth'/> <target dir='/'/> </filesystem> <console type='pty' /> </devices> </domain>
With the above libvirt XML, Domain is defining, but not starting. When I issue the start command it's saying "Domain started", but showing "shut off" status. If I changed the target directory(<traget dir='/'/>) from '/' to '/home/container1'(<traget dir='/home/container1'/>), the domain is starting normally and I am able to see the contents in the target directory.
Can you please let me know, how can I set the target directory to '/'?
The path specified in the <init> element must be visible from within the container's virtual root filesystem. Since you are trying to make '/home/srikanth' the root of the container, this implies that the <init> element you give will expect a file /home/srikanth/bin/sh in the host, which will be accessed as /bin/sh within the container. Daniel -- |: Red Hat, Engineering, London -o- http://people.redhat.com/berrange/ :| |: http://libvirt.org -o- http://virt-manager.org -o- http://ovirt.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: GnuPG: 7D3B9505 -o- F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|
participants (2)
-
Daniel P. Berrange
-
Kumar L Srikanth-B22348