CentOS 7でOSvを動かすまで


git clone https://github.com/cloudius-systems/osv.git

して、README.mdを眺める。scripts/setup.pyで必要なパッケージをインストールするみたいだけど、CentOS用の記述がないので、Fedoraをベースにコードを追加。versionがexact matchなので、マイナーバージョンアップしたらダメだな、これ。まぁ、いいや。

diff --git a/scripts/setup.py b/scripts/setup.py
index 8487c2a..c73891b 100755
--- a/scripts/setup.py
+++ b/scripts/setup.py
@@ -51,6 +51,30 @@ class Fedora(object):
     versions = [Fedora_20, Fedora_21]
+class CentOS(object):
+    name = 'CentOS Linux'
+    install = 'yum -y install'
+    packages = ['gcc-c++', 'gcc-c++-aarch64-linux-gnu', 'git', 'gdb', 'qemu-img',
+                'qemu-system-x86', 'libvirt', 'maven', 'java-1.7.0-openjdk',
+                'ant', 'autoconf', 'automake', 'boost-static', 'genromfs', 'libtool',
+                'flex', 'bison', 'maven-shade-plugin', 'python-dpkt', 'tcpdump', 'gdb',
+                'gnutls-utils', 'openssl', 'python-requests', 'p11-kit', 'patch', 'wget',
+                'unzip', 'ncurses', 'ncurses-devel', 'libstdc++-static', 'openssl-libs',
+                'openssl-devel'
+                ]
+    ec2_packages = standard_ec2_packages
+    test_packages = ['openssl-devel']
+    ec2_post_install = standard_ec2_post_install
+    class CentOS_7(object):
+        packages = []
+        ec2_packages = []
+        test_packages = []
+        ec2_post_install = None
+        version = '7.0.1406'
+    versions = [CentOS_7]
 class Debian(object):
     name = 'debian'
     install = 'apt-get -y install'
@@ -105,6 +129,7 @@ class Ubuntu(object):
 distros = [
+           CentOS(),


$ sudo ln -s /usr/libexec/qemu-kvm /usr/bin/qemu-system-x86_64


$ sudo ./scripts/run.py -nv
OSv v0.13-53-ge31c3dd
DMI: error
/# help
api     execute arbitrary OSv API operations as defined by the schema
cat     concatenate files and print on the standard output
cd      change the shell working directory
date    print the system date and time
df      report file system disk space usage
dmesg   print operating system boot log
echo    display a line of text
exit    close shell and exit
free    display amount of free and used memory in system
hello   a command example
help    list console available commands and show help
ls      list directory contents
mkdir   make directories
rm      remove files or directories
top     display OSv threads
/# hello
Hello, OSv!


/# cat /cli/commands/hello.lua
Commands are expected to be Lua modules.
This file is an example of such a module.
For more on Lua modules, see: http://lua-users.org/wiki/ModulesTutorial

local cmd = {}

cmd.desc = [[a command example]]
cmd.hello = [[Usage: hello

A command example.]]

--- Called when the command is executed
-- @param args List of arguments from the command line
cmd.main = function(args)
	print("Hello, OSv!")

return cmd


/# dmesg
4 CPUs detected
Firmware vendor: Seabios
bsd: initializing - done
VFS: mounting ramfs at /
VFS: mounting devfs at /dev
RAM disk at 0x0xffff800002796040 (4096K bytes)
net: initializing - done
vga: Add VGA device instance
eth0: ethernet address: 52:54:00:12:34:56
virtio-blk: Add blk device instances 0 as vblk0, devsize=10842275840
random: virtio-rng registered as a source.
random: intel drng, rdrand registered as a source.
random: <Software, Yarrow> initialized
VFS: unmounting /dev
VFS: mounting zfs at /zfs
zfs: mounting osv/zfs from device /dev/vblk0.1
VFS: mounting devfs at /dev
VFS: mounting procfs at /proc
random: device unblocked.
program zpool.so returned 1
BSD shrinker: event handler list found: 0xffffa0000199e500
	BSD shrinker found: 1
BSD shrinker: unlocked, running
[I/43 dhcp]: Waiting for IP...
[I/246 dhcp]: Server acknowledged IP for interface eth0
[I/246 dhcp]: Configuring eth0: ip subnet mask gateway MTU 1500
Running from /init/30-auto-00: /libhttpserver.so &!

シェルだとできることは限られているのだけど、REST API経由でいろいろ弄れるのが今っぽい。ブラウザでhttp://を開く。あ、ブラウザ経由でリブートやシャットダウンもできちゃった。面白い。ちなみにコンソールからシャットダウンするときは、exit (or Ctrl-a x)でOK。