Skip to content
This repository has been archived by the owner on Nov 28, 2017. It is now read-only.

Commit

Permalink
Merge pull request #32 from MagnusS/master
Browse files Browse the repository at this point in the history
Support for optional vm backends
  • Loading branch information
MagnusS committed Nov 11, 2015
2 parents 3d048e0 + 11203f6 commit 7744325
Show file tree
Hide file tree
Showing 14 changed files with 981 additions and 794 deletions.
17 changes: 13 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,17 @@ script: bash -ex .travis-opam.sh
sudo: required
env:
global:
- ALCOTEST_SHOW_ERRORS=1
- PACKAGE=jitsu
- UBUNTU_TRUSTY=1
- ALCOTEST_SHOW_ERRORS=1
- PACKAGE=jitsu
- UBUNTU_TRUSTY=1
matrix:
- OCAML_VERSION=4.01
- OCAML_VERSION=4.02
- OCAML_VERSION=4.01
- OCAML_VERSION=4.01 DEPOPTS="xen-api-client xenctrl libvirt"
- OCAML_VERSION=4.02 DEPOPTS="xen-api-client xenctrl libvirt"
- OCAML_VERSION=4.01 DEPOPTS="libvirt"
- OCAML_VERSION=4.01 DEPOPTS="xenctrl"
- OCAML_VERSION=4.01 DEPOPTS="xen-api-client"
- OCAML_VERSION=4.02 DEPOPTS="libvirt"
- OCAML_VERSION=4.02 DEPOPTS="xenctrl"
- OCAML_VERSION=4.02 DEPOPTS="xen-api-client"
4 changes: 3 additions & 1 deletion CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
0.2.2 (2015-15-19)
0.3.0 (2015-11-09)

- Support modular backends. Only available backends are compiled in by default.
- Support xenctrl > 0.9.26
- Support xen-api-client > 0.9.8
- Add virtual packages for jitsu-libvirt, jitsu-libxl, jitsu-xapi

0.2.1 (2015-15-19)

Expand Down
73 changes: 53 additions & 20 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,35 +1,68 @@
PACKAGES=-package lwt.syntax,lwt,dns.lwt,libvirt,cmdliner,ezxmlm,ipaddr,str,conduit,conduit.lwt-unix,xen-api-client,xen-api-client.lwt,irmin.unix,xenstore,xenstore_transport,xenstore_transport.lwt,uuidm,xenlight,xentoollog
.PHONY=all detect_backends test install clean

INCLUDE=
OPT=-linkpkg -g
OCAMLOPT=ocamlopt -w A-4-44

SRC=$(PWD)/src
FILES=vm_stop_mode.ml vm_state.ml xenstore.ml backends.mli options.ml rumprun.ml libvirt_backend.ml xapi_backend.ml libxl_backend.ml dns_helpers.ml irmin_backend.ml synjitsu.mli synjitsu.ml jitsu.mli jitsu.ml
MAIN=main.ml

TEST_SRC=$(PWD)/lib_test
TEST_FILES=test_options.ml
TEST_MAIN=test.ml
TEST_PACKAGES=$(PACKAGES),alcotest
TEST_INCLUDE=-I $(SRC)

PWD=$(shell pwd)
SRC=$(PWD)/src
BIN=$(PWD)/bin
INSTALLDIR=/usr/local/bin
VERSION=$(shell cat VERSION)
VERSION_ML=$(SRC)/jitsu_version.ml

MAIN_FILE=main.ml
MAIN_FILE_PREFIX=$(addprefix $(SRC)/,$(MAIN_FILE))

# Available backends detected by configure
HAS_LIBVIRT=$(shell ocamlfind query libvirt > /dev/null && echo 1 || echo 0)
HAS_XAPI=$(shell ocamlfind query xen-api-client > /dev/null && echo 1 || echo 0)
HAS_XL=$(shell ocamlfind query xenctrl > /dev/null && echo 1 || echo 0)

# Configure backends
ifeq ($(HAS_LIBVIRT), 1)
BACKENDS+=libvirt:
BACKEND_FILES += libvirt_backend.ml
BACKEND_PKG := $(strip $(BACKEND_PKG),libvirt)
endif
ifeq ($(HAS_XAPI), 1)
BACKENDS+=xen-api-client:
BACKEND_FILES += xapi_backend.ml
BACKEND_PKG := $(strip $(BACKEND_PKG),xen-api-client,xen-api-client.lwt)
endif
ifeq ($(HAS_XL), 1)
BACKENDS+=xenctrl:
BACKEND_FILES += libxl_backend.ml
BACKEND_PKG := $(strip $(BACKEND_PKG),xenlight,xentoollog)
endif

BASE_FILES=vm_stop_mode.ml vm_state.ml xenstore.ml backends.mli vm_backends.ml options.ml rumprun.ml $(BACKEND_FILES) dns_helpers.ml irmin_backend.ml synjitsu.mli synjitsu.ml jitsu.mli jitsu.ml
BASE_PKG=-package lwt.syntax,lwt,dns.lwt,cmdliner,ezxmlm,ipaddr,str,conduit,conduit.lwt-unix,irmin.unix,xenstore,xenstore_transport,xenstore_transport.lwt,uuidm$(BACKEND_PKG)
BASE_FILES_PREFIX=$(addprefix $(SRC)/,$(BASE_FILES))

TEST_SRC=$(PWD)/lib_test
TEST_FILES=test_options.ml
TEST_FILES_PREFIX=$(addprefix $(TEST_SRC)/,$(TEST_FILES))
TEST_MAIN_FILE=test.ml
TEST_MAIN_FILE_PREFIX=$(addprefix $(TEST_SRC)/,$(TEST_MAIN_FILE))
TEST_PKG=$(BASE_PKG),alcotest
TEST_INCLUDE=-I $(SRC)

all: $(BIN)/jitsu

$(VERSION_ML): VERSION
echo 'let current="$(VERSION)"' > $(VERSION_ML)
@echo 'let current="$(VERSION)"' > $(VERSION_ML)
@echo 'Version $(VERSION)'

$(BIN)/jitsu: $(addprefix $(SRC)/, $(FILES)) $(addprefix $(SRC)/, $(MAIN)) $(VERSION_ML)
$(BIN)/jitsu: $(BASE_FILES_PREFIX) $(MAIN_FILE_PREFIX) $(VERSION_ML)
@[ "$(BACKENDS)" == "" ] && \
echo "Warning: No VM backends found. Install xenctrl, xen-api-client or libvirt with opam to add a backend." || \
echo 'Detected backends: $(subst :, ,$(BACKENDS))'
mkdir -p $(BIN)
cd $(SRC) ; ocamlfind $(OCAMLOPT) $(INCLUDE) $(PACKAGES) $(OPT) $(VERSION_ML) $(FILES) $(MAIN) -o $(BIN)/jitsu -syntax camlp4o
cd $(SRC) ; ocamlfind $(OCAMLOPT) $(INCLUDE) $(BASE_PKG) $(OPT) $(VERSION_ML) $(BASE_FILES) $(MAIN_FILE) -o $(BIN)/jitsu -syntax camlp4o

$(BIN)/test: $(BIN)/jitsu $(addprefix $(TEST_SRC)/, $(TEST_FILES)) $(addprefix $(TEST_SRC)/, $(TEST_MAIN))
cd $(TEST_SRC) ; ocamlfind $(OCAMLOPT) $(TEST_INCLUDE) $(TEST_PACKAGES) $(OPT) $(addprefix $(SRC)/, $(FILES)) $(TEST_FILES) $(TEST_MAIN) -o $(BIN)/test -syntax camlp4o
$(BIN)/test: $(BIN)/jitsu $(TEST_FILES_PREFIX) $(TEST_MAIN_FILE_PREFIX)
cd $(TEST_SRC) ; ocamlfind $(OCAMLOPT) $(TEST_INCLUDE) $(TEST_PKG) $(OPT) $(BASE_FILES_PREFIX) $(TEST_FILES) $(TEST_MAIN_FILE) -o $(BIN)/test -syntax camlp4o

test: $(BIN)/test
@echo "Running tests..."
Expand All @@ -40,11 +73,11 @@ install: $(BIN)/jitsu
install -s $(BIN)/jitsu $(INSTALLDIR)/jitsu

clean:
cd $(SRC) ; rm -f $(addsuffix .cmi,$(basename $(FILES))) $(addsuffix .cmx,$(basename $(FILES))) $(addsuffix .o,$(basename $(FILES)))
cd $(SRC) ; rm -f $(addsuffix .cmi,$(basename $(MAIN))) $(addsuffix .cmx,$(basename $(MAIN))) $(addsuffix .o,$(basename $(MAIN)))
cd $(SRC) ; rm -f $(addsuffix .cmi,$(basename $(BASE_FILES))) $(addsuffix .cmx,$(basename $(BASE_FILES))) $(addsuffix .o,$(basename $(BASE_FILES)))
cd $(SRC) ; rm -f $(addsuffix .cmi,$(basename $(MAIN_FILE))) $(addsuffix .cmx,$(basename $(MAIN_FILE))) $(addsuffix .o,$(basename $(MAIN_FILE)))
cd $(SRC) ; rm -f jitsu *~ tags
cd $(SRC) ; rm -f $(VERSION_ML)
cd $(SRC) ; rm -f $(addsuffix .cmi,$(basename $(VERSION_ML))) $(addsuffix .cmx,$(basename $(VERSION_ML))) $(addsuffix .o,$(basename $(VERSION_ML)))
cd $(BIN) ; rm -f jitsu test
cd $(TEST_SRC) ; rm -f $(addsuffix .cmi,$(basename $(TEST_FILES))) $(addsuffix .cmx,$(basename $(TEST_FILES))) $(addsuffix .o,$(basename $(TEST_FILES)))
cd $(TEST_SRC) ; rm -f $(addsuffix .cmi,$(basename $(TEST_MAIN))) $(addsuffix .cmx,$(basename $(TEST_MAIN))) $(addsuffix .o,$(basename $(TEST_MAIN)))
cd $(TEST_SRC) ; rm -f $(addsuffix .cmi,$(basename $(TEST_MAIN_FILE))) $(addsuffix .cmx,$(basename $(TEST_MAIN_FILE))) $(addsuffix .o,$(basename $(TEST_MAIN_FILE)))
rm -rf _tests
18 changes: 15 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,16 +35,28 @@ Jitsu supports several backends to manage the unikernel VMs. Currently [libvirt]

## Installing Jitsu ##

Jitsu needs the development libraries for Libvirt, Xapi and Xenlight to compile. This can be handled by [`opam`](https://opam.ocaml.org/) in most cases. To install the system dependencies, run
The latest release of Jitsu is available in [`opam`](https://opam.ocaml.org). To install Jitsu, run:

```
$ opam depext xenctrl libvirt xen-api-client
$ opam install jitsu
```

When Jitsu is installed it will look for available backends that can be used to start unikernels (or processes). The backends currently supported are `xenctrl` (libxl), `libvirt` and `xen-api-client` (xapi). If a new backend is installed `opam` will reinstall Jitsu to add support for it.

The virtual packages `jitsu-libvirt`, `jitsu-xapi` and `jitsu-libxl` can be used to force Jitsu to be installed with a specific backend.

To add a backend, either use the virtual package:

```
$ opam install jitsu-libxl
```

The latest release of Jitsu is available in `opam`. To install:
Or install the backend directly with `opam`:

```
$ opam install jitsu
$ opam depext xenctrl # install external dependencies, optional
$ opam install xenctrl
```

To install the latest development version of Jitsu, you can pin Jitsu to the current master branch on Github. This version is *unstable* and changes frequently.
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.2.2
0.3.0
10 changes: 10 additions & 0 deletions jitsu-libvirt.opam
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
opam-version: "1.2"
maintainer: "Magnus Skjegstad <[email protected]>"
authors: "Magnus Skjegstad <[email protected]>"
homepage: "https://github.com/mirage/jitsu"
bug-reports: "https://github.com/mirage/jitsu/issues/"
dev-repo: "https://github.com/mirage/jitsu.git"
license: "ISC"

depends: [ "jitsu"
"libvirt" ]
11 changes: 11 additions & 0 deletions jitsu-libxl.opam
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
opam-version: "1.2"
maintainer: "Magnus Skjegstad <[email protected]>"
authors: "Magnus Skjegstad <[email protected]>"
homepage: "https://github.com/mirage/jitsu"
bug-reports: "https://github.com/mirage/jitsu/issues/"
dev-repo: "https://github.com/mirage/jitsu.git"
license: "ISC"

depends: [ "jitsu"
"xenctrl" ]

11 changes: 11 additions & 0 deletions jitsu-xapi.opam
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
opam-version: "1.2"
maintainer: "Magnus Skjegstad <[email protected]>"
authors: "Magnus Skjegstad <[email protected]>"
homepage: "https://github.com/mirage/jitsu"
bug-reports: "https://github.com/mirage/jitsu/issues/"
dev-repo: "https://github.com/mirage/jitsu.git"
license: "ISC"

depends: [ "jitsu"
"xen-api-client" ]

25 changes: 16 additions & 9 deletions opam
Original file line number Diff line number Diff line change
@@ -1,23 +1,25 @@
opam-version: "1.2"
name: "jitsu"
maintainer: "Magnus Skjegstad <[email protected]>"
authors: "Magnus Skjegstad <[email protected]>"
homepage: "https://github.com/mirage/jitsu"
bug-reports: "https://github.com/mirage/jitsu/issues/"
dev-repo: "https://github.com/mirage/jitsu.git"
license: "ISC"

build: [
[make]
]

build-test: [
[make "test"]
]
depends: [ "lwt"

depends: [ "ocamlfind"
"lwt"
"dns" { >= "0.15.3" }
"xenstore"
"xenstore_transport"
"cmdliner"
"libvirt"
"ipaddr"
"ezxmlm"
"conduit"
Expand All @@ -26,11 +28,16 @@ depends: [ "lwt"
"irmin-unix"
"irmin" { >= "0.10.0" }
"git"
"xen-api-client" { >= "0.9.10" }
"xenctrl" { >= "0.9.29" }
"alcotest" ]
depexts: [
[["debian"] ["libvirt-bin" "libvirt-dev" "libxen-dev"]]
[["ubuntu"] ["libvirt-bin" "libvirt-dev" "libxen-dev"]]
[["osx" "homebrew"] ["libvirt"]]

depopts: [
"xenctrl"
"xen-api-client"
"libvirt"
]

conflicts: [
"xenctrl" { < "0.9.29" }
"xen-api-client" { < "0.9.10" }
]

Loading

0 comments on commit 7744325

Please sign in to comment.