Re: [Lxc-users] Converting an LXC container into a bootable OS?

2011-10-11 Thread Iliyan ilf Stoyanov
Hi Ivan,

On Tue, 2011-10-11 at 18:32 -0600, Ivan Fetch wrote:
 Hello,
 
 Along with some other troubleshooting we are doing (separate thread), we are 
 investigating turning some LXC containers into virtual machines. Does anyone 
 have experience, or perhaps some write-ups, on going in the other direction? 
 E.G start with a base Ubuntu 10.04 installation, copy the LXC contianer's 
 filesystem into that installation, then adjust fstab, rebuilt initrd image, 
 Etc?

It shouldn't be that hard doing that. All you need to take into account
is the 'hardware' inside your virtual machine. I always assume people
use KVM/Qemu so basically you should probably take into account the
appropriate vda/hda drivers, the virtio drivers for the network
interfaces, etc. 

Once upon a time I used to install server by booting from NFS and
effectively copying the live NFS FS to the local harddrives, chrooting
there and doing kudzu and then mkinitrd by including specific kernel
modules for the hardware on the machine, raid, etc, so I can boot it,
but that was on RHEL4. I would have to say nowadays I do that, but the
tools are very different between distros. RHEL and Fedora use dracut for
generating the initrd and partially probing hardware. I'm not really
familiar with the fine details of ubuntu, but I think mkinitrd (or the
appropriate analog) still allows you to include modules by hand. Then
you should setup your fstab file and essentially start the machine.

As for the exact creation of the image (I assume you'll be using images)
qemu-img would help you create the appropriate format, and eventully
mount it as a loop device. If you don't change hardware platforms (i.e.
x86_64 on i386 host, or PowerPC on x86(_64) instruction set host) you
mount the img. Copy the LXC container FS to it, mount
--bind /{proc,sys,dev} to the root of the loop device, chroot there and
then mkinitrd with proper modules from the appropriate kernel version.
Then you setup the fstab, put a boot loader on the image and edit it's
config and attempt to boot from that qemu image. It is almost like
copying the FS on real server, just with different kernel modules.

This is just a quick and dirty howto that assumes you are using
KVM/Qemu, but I think it will not be that much different for other
hypervisors.

Hope I was some help. Unfortunately I don't have the time lately to sit
down and write a detailed howto, because actually it would make a good
algorithm and I can write a small script for converting LXC machines to
KVM, and vice versa  as I'm almost certain I'll need such a thing at
some point.

cheers,
-- ilf
 
 Thanks,
 
 Ivan.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 .
 --
 All the data continuously generated in your IT infrastructure contains a
 definitive record of customers, application performance, security
 threats, fraudulent activity and more. Splunk takes this data and makes
 sense of it. Business sense. IT sense. Common sense.
 http://p.sf.net/sfu/splunk-d2d-oct
 ___
 Lxc-users mailing list
 Lxc-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/lxc-users



--
All the data continuously generated in your IT infrastructure contains a
definitive record of customers, application performance, security
threats, fraudulent activity and more. Splunk takes this data and makes
sense of it. Business sense. IT sense. Common sense.
http://p.sf.net/sfu/splunk-d2d-oct
___
Lxc-users mailing list
Lxc-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/lxc-users


Re: [Lxc-users] Fedora 15 on Fedora 15 LXC with Libvirt

2011-08-02 Thread Iliyan ILF Stoyanov
Hi,

I don't think this template will work as it references two files that do
not exist in F15 i.e.

${rootfs_path}/etc/rc.sysinit
and
${rootfs_path}/etc/rc.d/rc.sysinit

this is because of the fact that system.d doesn't use such scripts for
init.

I can always just use Scientific Linux for my setup, however we made the
decision a long time ago that all our dev servers will stick to Fedora,
so that we are better prepared for the quirks that might come up in
RHEL/CentOS/SL when some technology gets included in the TUV releases.
It is not a must to have LXC running on Fedora 15 with Fedora 15 guests,
but it would be nice to crack the hard nut that system.d is proving to
be. By the way, I see that your email is at canonical and it seems a
most of the people here are running LXC on Ubuntu, is LXC actually
sponsored by canonical or is primarily developed around Debian/Ubuntu,
because if that is the case, it might explain certain incompatibilities
with the way Red Hat/Fedora are set up.

BR,
ilf

On Tue, 2011-08-02 at 09:02 -0500, Serge E. Hallyn wrote:
 Quoting Iliyan ILF Stoyanov (i...@ilf.me):
  On the other side, would someone be so kind to point me in the right
  direction (either documentation, source or anything else available) that
  I can follow so that I set up lxc container just with the LXC tools. I
 
 Ramez Hanna has posted a new fedora template.  I think this was the
 latest:
 http://www.mail-archive.com/lxc-users@lists.sourceforge.net/msg01707.html
 
 It looks like it was for F13 and F14 containers, but it should be a
 starting point.  See the usage() section.  I've not used it myself,
 but the author should be on this list.
 
 -serge



--
BlackBerryreg; DevCon Americas, Oct. 18-20, San Francisco, CA
The must-attend event for mobile developers. Connect with experts. 
Get tools for creating Super Apps. See the latest technologies.
Sessions, hands-on labs, demos  much more. Register early  save!
http://p.sf.net/sfu/rim-blackberry-1
___
Lxc-users mailing list
Lxc-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/lxc-users


Re: [Lxc-users] Fedora 15 on Fedora 15 LXC with Libvirt

2011-08-01 Thread Iliyan ILF Stoyanov
Hi again,

Thanks, but no thanks on the libvirt mailing list. I found out that just
reading their -devel ml was enough for me and combined with the trial
and error method I was able to reach what I wanted a while ago,
concerning SANs over FC, IB and building private cloud infras with
libvirt and qemu, however I decline going that road again :).

On the other side, would someone be so kind to point me in the right
direction (either documentation, source or anything else available) that
I can follow so that I set up lxc container just with the LXC tools. I
probably decided to go the wrong way about this and use a framework I
already know and trying to skip learning the nuts and bolts of LXC
before going to libvirt.

I would like to know first of all, did someone get F15 or any other
distro (I'm also using Arch a lot) running systemd on both host and
container to run and if so, what were the steps followed. I searched
google with bunch of different criteria lxc fedora 15, lxc fedora
systemd, etc. but from what I've been able to find, it seems no one is
running lxc with systemd. I see people having success with upstart, but
Debian and Ubuntu are just not my cup of tea, so I would like to stick
to RedHat based distro for a bunch of company reasons.

From what I gathered from the howto it seems I should run a hand made
/sbin/init in the container, but with systemd I'm at a total loss, what
exactly should I do. In F15 /sbin/init is actually a symlink to
/bin/systemd. I would probably have better success with Arch in this
regard, as I still have a proper rc.sysinit and /sbin/init  that is not
a symlink to /bin/systemd.

Practically I'm lost here and without a hint of proper direction. I
would try reading the howto again and will setup an lxc config file,
but I still have the feeling it will be a fiasco, so any help would be
greatly appreciated.

Thank you for the time you are spending reading my messages that I
realize are half rants - half help requests

BR,
ilf

On Mon, 2011-08-01 at 16:18 -0500, Serge Hallyn wrote:
 Hi,
 
 This mailing list is intended for users of the lxc.sf.net toolsuite.
 While the libvirt lxc implementation is in many ways similar, there
 definately are differences.
 
 I point this out because your first step has to be to get more
 debugging information, and I don't know that anyone here can help
 you with that.  Can you get systemd to copy all of its console
 output to a file which you can read later?
 
 We certainly are interested in helping, since it certainly seems
 you are suffering from the same problem we are.  I'm just not sure
 how to have you get started.
 
 Perhaps you can hack src/lxc/lxc_container.clxcContainerSetStdio()
 to open a file '/debugoutput', and use that fd rather than ttyfd for
 the dup2()s?  That might give you some better debug info.
 
 You also might to ask on the libvir mailing list, or oftc#virt irc
 channel.
 
 -serge




--
BlackBerryreg; DevCon Americas, Oct. 18-20, San Francisco, CA
The must-attend event for mobile developers. Connect with experts. 
Get tools for creating Super Apps. See the latest technologies.
Sessions, hands-on labs, demos  much more. Register early  save!
http://p.sf.net/sfu/rim-blackberry-1
___
Lxc-users mailing list
Lxc-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/lxc-users