Proposal to install on qemu

Hi there!

Just wanted you to know that you are a bunch of warriors to create such a revolutionary OS.

I battled the whole weekend to get it working, but I managed to build a working qemu image in a matter of seconds now, without even using the iso.
It’s also very simpler to apply a cloud-config and copy files in the OS in a declarative way.
I’d like to know what you guys think of this approach (it looks a bit like ./scripts/run from rancher/os ).

Here is the script:

#!bin/sh

set -x -e

function clean_up {

    sudo umount mount || true
    sudo kpartx -d rancheros.img || true
    sudo losetup -d /dev/loop0 || true
}

trap "clean_up; exit" SIGHUP SIGINT SIGTERM
clean_up

qemu-img create rancheros.img 1G
sudo losetup /dev/loop0 rancheros.img

echo "n
p
1


w" | sudo fdisk /dev/loop0 || true

sudo kpartx -a rancheros.img

docker run --privileged -it \
    -v /dev/mapper:/dev/mapper \
    -v $(pwd):/cluster \
    rancher/os:v0.4.2-rc2 \
        -c /cluster/cloud-config.yml \
        -t generic \
        -d /cluster/rancheros.img \
        -p /dev/mapper/loop1p1 \
        #-f /cluster/images.tar.xz:var/lib/system-docker/preload/images.tar.xz

sync

qemu-system-x86_64 -enable-kvm \
    -m 1024 \
    -net nic,model=virtio \
    -net user,hostfwd=tcp::2222-:22 \
    -drive if=virtio,file=rancheros.img,format=raw


oh man, that’s just brilliant.

I broke this in the re-write of the installer in 0.8 (as seen in https://github.com/rancher/os/issues/1667 )

but lets see if i can fix it quickly. (and then add it to our tests…)

I’ve started work on this in https://github.com/rancher/os/pull/1724 , and its a nice example of what you can do

but for the sake of completness, https://github.com/rancher/os/tree/master/scripts/images/openstack is the way we’ve been doing it for releases

The slightly modified version can now be found in the repository as https://github.com/rancher/os/blob/master/scripts/run-install