[Lxc-users] lxc-clone
Serge E. Hallyn
serge.hallyn at ubuntu.com
Wed Apr 6 14:05:51 UTC 2011
Quoting Daniel Lezcano (daniel.lezcano at free.fr):
> >What do you think is the best way to do this? We could allow the user
> >to specify a 'firstboot' script, which gets copied into root directory
> >of the container. Maybe boot the container when it's done, run
> >/firstboot.sh, and shut down. Or just let that happen when the user
> >first boots. We could use a /etc/init.d/lxc-firstboot script, but
> >that will only work if the container's init system actually looks at
> >sysvinit scripts. Obviously sysvinit and upstart do, and I must
> >assume that systemd does. lxc-init I assume doesn't.
>
> Mmh, that's look a bit complicate for the user. I was thinking about
> something simpler like:
>
> grep -q "lxc.utsname" $lxc_path/$lxc_new/config
> if [ $? == 0 ]; then
> sed -e "s/lxc.utsname/lxc.utsname=$hostname" $lxc_path/$lxc_new/config
> else
> echo "lxc.utsname = $hostname">> $lxc_path/$lxc_new/config
> fi
>
> and so for the rest of the configuration variables.
Ok, yeah, that'll be necessary and independent of the distro. But I
do think a firstboot option will be useful both for -clone and -create.
It can be totally optional so as not to confuse those who don't want
it.
> I suspect the configuration tweaks will be more complicated than that..
>
> For example:
>
> lxc.network.veth.peer = veth1234
>
> should be removed or replaced by a random name.
Sigh, yeah.
> But we can improve the different configuration tweaks later.
Phes :)
> >Thanks for looking it over, Daniel. I'm using this heavily every day,
> >so am really keen on polishing it :)
>
> Thanks for this command, I think it is very useful.
>
> By the way, did the lxc.rootfs=<lvm_image> worked ?
Yup!
Now, to do btrfs (I got sidetracked and won't be able to get to it this
week probably), we will probably want to be able to specify a bind
mount source. That way we can mount a btrfs somewhere like /opt/lxc.
Otherwise IIRC the way btrfs works we won't be able to create a snapshot
from /var/lib/lxc/natty/rootfs for /var/lib/lxc/n2/rootfs, because the
snapshots are are created as sibling directories.
Can you think of a clean way to do that or add that to the current config
format?
thanks,
-serge
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 490 bytes
Desc: Digital signature
URL: <http://lists.linuxcontainers.org/pipermail/lxc-users/attachments/20110406/24af0438/attachment.pgp>
More information about the lxc-users
mailing list