Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 0 additions & 35 deletions .travis-opam-coverage.sh

This file was deleted.

19 changes: 0 additions & 19 deletions .travis-xenserver-build-env.sh

This file was deleted.

23 changes: 14 additions & 9 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,17 +1,22 @@
language: c
sudo: required
services: docker
script: bash ./.travis-$BUILD_METHOD.sh
install:
- wget https://raw.githubusercontent.com/xenserver/xenserver-build-env/master/utils/travis-build-repo.sh
script: bash travis-build-repo.sh
after_success:
- test $TRAVIS_PULL_REQUEST == "false" && test $TRAVIS_BRANCH == "master" && bash deploy.sh
sudo: true
env:
global:
# for BUILD_METHOD=xenserver-build-env
- CONTAINER_NAME=build-env
- OCAMLRUNPARAM=b
- REPO_PACKAGE_NAME=xapi
- REPO_CONFIGURE_CMD=./configure
- REPO_BUILD_CMD=make
- REPO_TEST_CMD='make test'
- REPO_DOC_CMD='make doc-json'
- secure: tokxJl2litqu/T6UUwzkLRZzlbxnbYqVG2QRKKQz3tkIXyZHQWTS2NAyH7mwDgdBq2dDVSxAUxS1jWq/vGraX7MmbVz37Pz8wjykoIfIRtQuEx+REDAvAzWSw+1LTpUf7ZcI+F2SpgJrnH87uN5AAc220UqIx8TvAtGrita+2+o=
matrix:
- BUILD_METHOD=xenserver-build-env
- BUILD_METHOD=opam-coverage
- OCAML_VERSION=4.02
notifications:
slack: citrix:BHYQZbI8m036ELU21gZil75Y
matrix:
fast_finish: true
allow_failures:
- env: BUILD_METHOD=opam-coverage
13 changes: 7 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@ build: setup.data

doc: setup.data build
$(SETUP) -doc $(DOCFLAGS)
./jsapi.native -destdir _build/ocaml/doc -templdir ocaml/doc/templates
./jsapi.native -destdir _build/ocaml/doc

test: setup.data build
$(SETUP) -test $(TESTFLAGS)

all: setup.ml
all:
$(SETUP) -all $(ALLFLAGS)

uninstall: setup.data
Expand All @@ -26,10 +26,10 @@ uninstall: setup.data
reinstall: setup.data
$(SETUP) -reinstall $(REINSTALLFLAGS)

clean: setup.ml
clean:
$(SETUP) -clean $(CLEANFLAGS)

distclean: setup.ml
distclean:
$(SETUP) -distclean $(DISTCLEANFLAGS)

setup.data: setup.ml
Expand All @@ -38,7 +38,7 @@ setup.data: setup.ml
setup.ml: _oasis
oasis setup -setup-update dynamic

configure: setup.ml
configure:
$(SETUP) -configure $(CONFIGUREFLAGS)

.PHONY: build doc test all install uninstall reinstall clean distclean configure
Expand Down Expand Up @@ -95,4 +95,5 @@ install: setup.data rbac_static.csv
mkdir -p $(DESTDIR)$(DOCDIR)/html/xenserver
cp -r -L _build/ocaml/doc/api $(DESTDIR)$(DOCDIR)/html/xenserver
cd ocaml/doc && cp *.js *.html *.css *.png $(DESTDIR)$(DOCDIR)/html/xenserver
cp _build/ocaml/doc/branding.js $(DESTDIR)$(DOCDIR)/html/xenserver/branding.js
cp ocaml/doc/xenserver/* $(DESTDIR)$(DOCDIR)/html/xenserver

4 changes: 0 additions & 4 deletions README.markdown
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
Xapi Project's XenAPI Management Toolstack
==========================================

[![Build Status](https://travis-ci.org/xapi-project/xen-api.svg?branch=master)](https://travis-ci.org/xapi-project/xen-api)
[![Coverage Status](https://coveralls.io/repos/github/xapi-project/xen-api/badge.svg?branch=master)](https://coveralls.io/github/xapi-project/xen-api?branch=master)
[![Lines of Code](https://tokei.rs/b1/github/xapi-project/xen-api)](https://github.com/xapi-project/xen-api)

Xen API (or xapi) is a management stack that configures and controls
Xen-enabled hosts and resource pools, and co-ordinates resources
within the pool. Xapi exposes the Xen API interface for many
Expand Down
3 changes: 1 addition & 2 deletions _oasis
Original file line number Diff line number Diff line change
Expand Up @@ -424,8 +424,7 @@ Executable jsapi
xapi-consts,
stdext,
uuid,
gzip,
mustache
gzip


############################################################################
Expand Down
3 changes: 0 additions & 3 deletions _tags

This file was deleted.

14 changes: 2 additions & 12 deletions ocaml/database/db_cache_impl.ml
Original file line number Diff line number Diff line change
Expand Up @@ -254,24 +254,14 @@ let process_structured_field_locked t (key,value) tblname fld objref proc_fn_sel
let newval = match proc_fn_selector with
| AddSet -> add_to_set key existing_str
| RemoveSet -> remove_from_set key existing_str
| AddMap | AddMapLegacy ->
| AddMap ->
begin
try
(* We use the idempotent map add if we're using the non-legacy
process function, or if the global field 'idempotent_map' has
been set. By default, the Db calls on the master use the
legacy functions, but those on the slave use the new one.
This means xapi code should always assume idempotent_map is
true *)
let idempotent =
(proc_fn_selector = AddMap) || !Db_globs.idempotent_map
in
add_to_map ~idempotent key value existing_str
add_to_map key value existing_str
with Duplicate ->
error "Duplicate key in set or map: table %s; field %s; ref %s; key %s" tblname fld objref key;
raise (Duplicate_key (tblname,fld,objref,key));
end

| RemoveMap -> remove_from_map key existing_str in
write_field_locked t tblname objref fld newval
with Not_found ->
Expand Down
7 changes: 3 additions & 4 deletions ocaml/database/db_cache_types.ml
Original file line number Diff line number Diff line change
Expand Up @@ -350,10 +350,10 @@ let remove_from_set key t =
Schema.Value.Set (List.filter (fun x -> x <> key) t)

exception Duplicate
let add_to_map ~idempotent key value t =
let add_to_map key value t =
let t = Schema.Value.Unsafe_cast.pairs t in
if List.mem_assoc key t && (not idempotent || List.assoc key t <> value) then raise Duplicate;
Schema.Value.Pairs ((key, value) :: List.filter (fun (k, _) -> k <> key) t)
if List.mem key (List.map fst t) then raise Duplicate;
Schema.Value.Pairs ((key, value) :: t)

let remove_from_map key t =
let t = Schema.Value.Unsafe_cast.pairs t in
Expand Down Expand Up @@ -500,5 +500,4 @@ type structured_op_t =
| RemoveSet
| AddMap
| RemoveMap
| AddMapLegacy
[@@deriving rpc]
3 changes: 1 addition & 2 deletions ocaml/database/db_cache_types.mli
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ end
exception Duplicate
val add_to_set : string -> Schema.Value.t -> Schema.Value.t
val remove_from_set : string -> Schema.Value.t -> Schema.Value.t
val add_to_map : idempotent:bool -> string -> string -> Schema.Value.t -> Schema.Value.t
val add_to_map : string -> string -> Schema.Value.t -> Schema.Value.t
val remove_from_map : string -> Schema.Value.t -> Schema.Value.t

val set_field : string -> string -> string -> Schema.Value.t -> Database.t -> Database.t
Expand All @@ -169,6 +169,5 @@ type structured_op_t =
| RemoveSet
| AddMap
| RemoveMap
| AddMapLegacy
val structured_op_t_of_rpc: Rpc.t -> structured_op_t
val rpc_of_structured_op_t: structured_op_t -> Rpc.t
3 changes: 0 additions & 3 deletions ocaml/database/db_globs.ml
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,6 @@ let static_vdis_dir = ref "/etc/xensource/static-vdis"
(* Note the following has an equivalent in the xapi layer *)
let http_limit_max_rpc_size = 300 * 1024 (* 300K *)

(* add_to_map is idempotent *)
let idempotent_map = ref false

(** Dynamic configurations to be read whenever xapi (re)start *)

let permanent_master_failure_retry_interval = ref 60.
Expand Down
5 changes: 2 additions & 3 deletions ocaml/database/db_rpc_common_v1.ml
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,7 @@ let marshall_structured_op x =
AddSet -> "addset"
| RemoveSet -> "removeset"
| AddMap -> "addmap"
| RemoveMap -> "removemap"
| AddMapLegacy -> "addmap" (* Nb, we always use 'non-legacy' mode for remote access *)
in
| RemoveMap -> "removemap" in
XMLRPC.To.string str
let unmarshall_structured_op xml =
match (XMLRPC.From.string xml) with
Expand Down Expand Up @@ -313,3 +311,4 @@ let unmarshall_read_records_where_response xml =
[ref_xml; rec_xml] -> (XMLRPC.From.string ref_xml, unmarshall_read_record_response rec_xml)
| _ -> raise DB_remote_marshall_error)
xml_refs_and_recs_list

10 changes: 0 additions & 10 deletions ocaml/database/db_rpc_common_v2.ml
Original file line number Diff line number Diff line change
Expand Up @@ -34,16 +34,6 @@ module Request = struct
| Read_records_where of string * Db_filter_types.expr
| Process_structured_field of (string * string) * string * string * string * Db_cache_types.structured_op_t
[@@deriving rpc]

(* Make sure the slave only ever uses the idempotent version *)
let rpc_of_t t =
let t' =
match t with
| Process_structured_field (a,b,c,d,Db_cache_types.AddMapLegacy) ->
Process_structured_field (a,b,c,d,Db_cache_types.AddMap)
| x -> x
in
rpc_of_t t'
end

module Response = struct
Expand Down
72 changes: 72 additions & 0 deletions ocaml/doc/branding.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
/*
* Copyright (C) 2006-2009 Citrix Systems Inc.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published
* by the Free Software Foundation; version 2.1 only. with the special
* exception on linking described in file LICENSE.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*/

function make_title() {
document.write('<title>Xapi Documentation</title>');
}

function make_header(t) {
if (t == 'apidoc')
title = 'Xapi &ndash; XenAPI Documentation';
else if (t == 'codedoc')
title = 'Xapi &ndash; OCaml Code Documentation';
else
title = 'Xapi &ndash; Documentation';

html = '<h1 style="float:left; font-size: 24px;"><a href="index.html">XenServer Management API</a></h1>'
document.getElementById('header').innerHTML = html;
}

first_release = 'midnight-ride';

function get_release_name(s)
{
switch (s) {
case 'rio':
case 'miami':
case 'symc':
case 'orlando':
case 'orlando-update-1':
case 'george':
case 'midnight-ride':
return 'XCP 0.5';
case 'cowley':
return 'XCP 1.0';
case 'boston':
return 'XCP 1.5';
case 'tampa':
return 'XCP 1.6';
case 'clearwater':
return 'XenServer 6.2';
case 'vgpu-tech-preview':
return 'XenServer 6.2 vGPU preview';
case 'vgpu-productisation':
return 'XenServer 6.2 SP1';
case 'clearwater-felton':
return 'XenServer 6.2 SP1 Hotfix 4';
case 'clearwater-whetstone':
return 'XenServer 6.2 SP1 Hotfix 11';
case 'creedence':
return 'XenServer 6.5';
case 'cream':
return 'XenServer 6.5 SP1';
case 'dundee':
return 'XenServer 7.0';
case 'ely':
return 'XenServer 7.1';
default:
return (s + ' (unreleased)');
}
}

Loading