Skip to content

Commit

Permalink
Merge pull request #915 from jonludlam/more-debian-patches
Browse files Browse the repository at this point in the history
  • Loading branch information
xen-git committed Nov 10, 2012
2 parents 8cddb3a + 2214a40 commit f0f8d51
Show file tree
Hide file tree
Showing 19 changed files with 46 additions and 24 deletions.
12 changes: 10 additions & 2 deletions Makefile
Expand Up @@ -43,8 +43,12 @@ XHADIR=/opt/xensource/xha
BINDIR=/usr/lib/xcp/bin
SBINDIR=/usr/sbin
UDEVDIR=/lib/udev

OCAMLPATH=/usr/lib/xen-4.1/lib/ocaml:/usr/lib/ocaml/xcp
EXTRA_INSTALL_PATH=/xcp

else
VARDIR=/var/xapi
VARDIR=/var/lib/xcp
VARPATCHDIR=/var/patch
ETCDIR=/etc/xensource
OPTDIR=/opt/xensource
Expand All @@ -61,10 +65,14 @@ XHADIR=/opt/xensource/xha
BINDIR=/opt/xensource/bin
SBINDIR=/opt/xensource/bin
UDEVDIR=/etc/udev

OCAMLPATH=
EXTRA_INSTALL_PATH=

endif


export VARDIR ETCDIR OPTDIR PLUGINDIR HOOKSDIR INVENTORY VARPATCHDIR LIBEXECDIR XAPICONF RRDDCONF SCRIPTSDIR SHAREDIR WEBDIR XHADIR BINDIR SBINDIR UDEVDIR
export VARDIR ETCDIR OPTDIR PLUGINDIR HOOKSDIR INVENTORY VARPATCHDIR LIBEXECDIR XAPICONF RRDDCONF SCRIPTSDIR SHAREDIR WEBDIR XHADIR BINDIR SBINDIR UDEVDIR OCAMLPATH EXTRA_INSTALL_PATH

.PHONY: all
all: version ocaml/fhs.ml
Expand Down
2 changes: 1 addition & 1 deletion OMakefile
Expand Up @@ -47,7 +47,7 @@ if $(not $(defined-env DESTDIR))


if $(not $(defined-env VARDIR))
VARDIR=/var/xapi
VARDIR=/var/lib/xcp
export
if $(not $(defined-env VARPATCHDIR))
VARPATCHDIR=/var/patch
Expand Down
2 changes: 1 addition & 1 deletion ocaml/idl/OMakefile
Expand Up @@ -103,7 +103,7 @@ META: META.in
sed 's/@VERSION@/$(PRODUCT_VERSION)/g' < $< > $@

if $(defined-env DESTDIR)
INSTALL_PATH = $(DESTDIR)/$(shell ocamlc -where)
INSTALL_PATH = $(DESTDIR)/$(shell ocamlc -where)$(EXTRA_INSTALL_PATH)
export
else
INSTALL_PATH = $(shell ocamlfind printconf destdir)
Expand Down
2 changes: 1 addition & 1 deletion ocaml/idl/ocaml_backend/OMakefile
Expand Up @@ -155,7 +155,7 @@ META: META.in
sed 's/@VERSION@/$(PRODUCT_VERSION)/g' < $< > $@

if $(defined-env DESTDIR)
INSTALL_PATH = $(DESTDIR)/$(shell ocamlc -where)
INSTALL_PATH = $(DESTDIR)/$(shell ocamlc -where)$(EXTRA_INSTALL_PATH)
export
else
INSTALL_PATH = $(shell ocamlfind printconf destdir)
Expand Down
15 changes: 13 additions & 2 deletions ocaml/rrdd/rrdd_stats.ml
Expand Up @@ -139,11 +139,20 @@ let print_system_stats () =
let current_offset = Unix.gettimeofday () -. (Int64.to_float (Oclock.gettime Oclock.monotonic) /. 1e9) in
debug "Clock drift: %.0f" (current_offset -. initial_offset)

let pidof_path =
try
let path = List.hd (List.filter (fun x -> try ignore (Unix.stat x); true with _ -> false) ["/sbin/pidof";"/bin/pidof"]) in
debug "Located pidof: %s" path;
Some path
with _ ->
None


(* Obtains process IDs for the specified program.
* This should probably be moved into xen-api-libs. *)
let pidof ~(program : string) : int list =
try
let pidof_path = "/sbin/pidof" in
let pidof_path = Opt.unbox pidof_path in
let out, _ = Forkhelpers.execute_command_get_output pidof_path [program] in
let lines = String.split '\n' out in
let get_pids_from_line acc line =
Expand All @@ -154,7 +163,9 @@ let pidof ~(program : string) : int list =
acc @ pids
in
List.fold_left get_pids_from_line [] lines
with Forkhelpers.Spawn_internal_error (_, _, _) -> []
with
| Forkhelpers.Spawn_internal_error (_, _, _) -> []
| Not_found -> []

let print_stats_for ~program =
let pids = pidof ~program in
Expand Down
2 changes: 1 addition & 1 deletion ocaml/xapi/storage_impl.ml
Expand Up @@ -831,7 +831,7 @@ module Local_domain_socket = struct
end

open Xmlrpc_client
let local_url = Http.Url.(File { path = "/var/xapi/storage" }, { uri = "/"; query_params = [] })
let local_url = Http.Url.(File { path = Filename.concat Fhs.vardir "storage" }, { uri = "/"; query_params = [] })

let rpc ~srcstr ~dststr url call =
XMLRPC_protocol.rpc ~transport:(transport_of_url url)
Expand Down
2 changes: 1 addition & 1 deletion ocaml/xapi/storage_migrate.ml
Expand Up @@ -24,7 +24,7 @@ open Pervasiveext
open Xmlrpc_client
open Threadext

let local_url = Http.Url.(File { path = "/var/xapi/storage" }, { uri = "/"; query_params = [] })
let local_url = Http.Url.(File { path = Filename.concat Fhs.vardir "storage" }, { uri = "/"; query_params = [] })
let remote_url ip = Http.Url.(Http { host=ip; auth=None; port=None; ssl=true }, { uri = "/services/SM"; query_params=["pool_secret",!Xapi_globs.pool_secret] } )

open Storage_interface
Expand Down
6 changes: 3 additions & 3 deletions ocaml/xapi/xapi_services.ml
Expand Up @@ -113,7 +113,7 @@ let post_handler (req: Http.Request.t) s _ =
(fun __context ->
match String.split '/' req.Http.Request.uri with
| "" :: services :: "xenops" :: _ when services = _services ->
ignore (hand_over_connection req s "/var/xapi/xenopsd.forwarded")
ignore (hand_over_connection req s (Filename.concat Fhs.vardir "xenopsd.forwarded"))
| "" :: services :: "plugin" :: name :: _ when services = _services ->
http_proxy_to_plugin req s name
| "" :: services :: "driver" :: uuid :: ty :: instance :: rest when services = _services ->
Expand All @@ -127,7 +127,7 @@ let post_handler (req: Http.Request.t) s _ =


let rpc ~srcstr ~dststr call =
let url = Http.Url.(File { path = "/var/xapi/storage" }, { uri = "/"; query_params = [] }) in
let url = Http.Url.(File { path = Filename.concat Fhs.vardir "storage" }, { uri = "/"; query_params = [] }) in
let open Xmlrpc_client in
XMLRPC_protocol.rpc ~transport:(transport_of_url url) ~srcstr ~dststr
~http:(xmlrpc ~version:"1.0" ?auth:(Http.Url.auth_of url) ~query:(Http.Url.get_query_params url) (Http.Url.get_uri url)) call
Expand All @@ -139,7 +139,7 @@ let put_handler (req: Http.Request.t) s _ =
(fun __context ->
match String.split '/' req.Http.Request.uri with
| "" :: services :: "xenops" :: _ when services = _services ->
ignore (hand_over_connection req s "/var/xapi/xenopsd.forwarded")
ignore (hand_over_connection req s (Filename.concat Fhs.vardir "xenopsd.forwarded"))
| "" :: services :: "plugin" :: name :: _ when services = _services ->
http_proxy_to_plugin req s name
| "" :: services :: "driver" :: uuid :: ty :: instance :: rest when services = _services ->
Expand Down
2 changes: 1 addition & 1 deletion ocaml/xapi/xapi_vm_migrate.ml
Expand Up @@ -668,7 +668,7 @@ let handler req fd _ =
let memory_limit = free_memory_required_kib |> Memory.bytes_of_kib |> Int64.to_string in
let req = Http.Request.make ~cookie:["dbg", dbg; "instance_id", "upgrade"; "memory_limit", memory_limit]
~user_agent:"xapi" Http.Put uri in
let path = "/var/xapi/xenopsd.forwarded" in
let path = Filename.concat Fhs.vardir "xenopsd.forwarded" in
let response = Xapi_services.hand_over_connection req fd path in
begin match response with
| Some task ->
Expand Down
4 changes: 2 additions & 2 deletions ocaml/xenops-cli/OMakefile
@@ -1,5 +1,5 @@
OCAML_LIBS = ../xenops/xenops_client
OCAMLINCLUDES = ../xenops ../util
OCAML_LIBS = ../xenops/xenops_client ../fhs
OCAMLINCLUDES = ../xenops ../util ..
OCAMLPACKS = xml-light2 stdext stunnel log http-svr oUnit

UseCamlp4(rpc-light.syntax, xn_cfg_types)
Expand Down
2 changes: 1 addition & 1 deletion ocaml/xenops-cli/test.ml
Expand Up @@ -25,7 +25,7 @@ open Fun
open Xmlrpc_client


let default_path = "/var/xapi/xenopsd"
let default_path = Filename.concat Fhs.vardir "xenopsd"
let transport = ref (Unix default_path)

open Xenops_interface
Expand Down
2 changes: 1 addition & 1 deletion ocaml/xenops/memory_interface.ml
Expand Up @@ -16,7 +16,7 @@
*)

let service_name = "memory"
let json_path = "/var/xapi/memory.json"
let json_path = Filename.concat Fhs.vardir "memory.json"

type reservation_id = string

Expand Down
2 changes: 1 addition & 1 deletion ocaml/xenops/xenops_client.ml
Expand Up @@ -20,7 +20,7 @@ module D = Debug.Debugger(struct let name = "xenops_client" end)
open D
module E = Debug.Debugger(struct let name = "mscgen" end)

let default_path = "/var/xapi/xenopsd"
let default_path = "/var/lib/xcp/xenopsd"
let forwarded_path = default_path ^ ".forwarded"

let default_uri = "file:" ^ default_path
Expand Down
2 changes: 1 addition & 1 deletion ocaml/xenops/xenops_migrate.ml
Expand Up @@ -23,7 +23,7 @@ open D
(*
let local_rpc call =
let open Xmlrpc_client in
XMLRPC_protocol.rpc ~transport:(Unix "/var/xapi/xenopsd") ~http:(xmlrpc ~version:"1.0" "/") call
XMLRPC_protocol.rpc ~transport:(Unix "/var/lib/xcp/xenopsd") ~http:(xmlrpc ~version:"1.0" "/") call
let _metadata = "VM.import_metadata"
let _failure = "VM.client_migrate_failed"
Expand Down
2 changes: 1 addition & 1 deletion ocaml/xenops/xenops_server_xen.ml
Expand Up @@ -255,7 +255,7 @@ module Storage = struct
let open Xmlrpc_client in
retry_econnrefused 10
(fun () ->
XMLRPC_protocol.rpc ~srcstr:"xenops" ~dststr:"smapiv2" ~transport:(Unix "/var/xapi/storage") ~http:(xmlrpc ~version:"1.0" "/") call
XMLRPC_protocol.rpc ~srcstr:"xenops" ~dststr:"smapiv2" ~transport:(Unix (Filename.concat Fhs.vardir "storage")) ~http:(xmlrpc ~version:"1.0" "/") call
)
end)

Expand Down
2 changes: 1 addition & 1 deletion ocaml/xenops/xenopsd.ml
Expand Up @@ -77,7 +77,7 @@ let dump_config_file () : unit =
let socket : Http_svr.socket option ref = ref None
let server = Http_svr.Server.empty (Xenops_server.make_context ())

let path = "/var/xapi/xenopsd"
let path = Filename.concat Fhs.vardir "xenopsd"
let forwarded_path = path ^ ".forwarded" (* receive an authenticated fd from xapi *)
let json_path = path ^ ".json"

Expand Down
2 changes: 1 addition & 1 deletion scripts/OMakefile
Expand Up @@ -49,7 +49,7 @@ install:
$(IPROG) xapi-logrotate $(DESTDIR)/etc/logrotate.d/xapi
$(IPROG) xapi-wait-init-complete $(DESTDIR)$(BINDIR)
$(IPROG) xapi-autostart-vms $(DESTDIR)$(BINDIR)
$(IPROG) udhcpd.skel $(DESTDIR)/var/xapi/udhcpd.skel #### FHS_FIXME
$(IPROG) udhcpd.skel $(DESTDIR)$(VARDIR)/udhcpd.skel
$(IDATA) xapi.conf $(DESTDIR)$(XAPICONF)
$(IDATA) sparse_dd.conf $(DESTDIR)/etc/sparse_dd.conf
$(IDATA) xcp-rrdd.conf $(DESTDIR)/etc/xcp-rrdd.conf
Expand Down
2 changes: 1 addition & 1 deletion scripts/examples/python/XenAPI.py
Expand Up @@ -199,7 +199,7 @@ def __getattr__(self, name):
return xmlrpclib.ServerProxy.__getattr__(self, name)

def xapi_local():
return Session("http://_var_xapi_xapi/", transport=UDSTransport())
return Session("http://_var_lib_xcp_xapi/", transport=UDSTransport())

def _parse_result(result):
if type(result) != dict or 'Status' not in result:
Expand Down
5 changes: 4 additions & 1 deletion xapi.spec.in
Expand Up @@ -132,6 +132,8 @@ for e in py pyc pyo; do
echo $SITEDIR/rrdd.$e
done > rrdd-files

ln -s /var/lib/xcp $RPM_BUILD_ROOT/var/xapi

%clean
rm -rf $RPM_BUILD_ROOT

Expand Down Expand Up @@ -281,9 +283,10 @@ rm -rf $RPM_BUILD_ROOT
@OPTDIR@/libexec/pci-info
@OPTDIR@/packages/post-install-scripts/debian-etch
@OPTDIR@/packages/post-install-scripts/debug
/var/xapi/udhcpd.skel
/var/lib/xcp/udhcpd.skel
@OPTDIR@/debug/rbac_static.csv
/etc/xapi.d/host-post-declare-dead/10resetvdis
/var/xapi

%files xe
%defattr(-,root,root,-)
Expand Down

0 comments on commit f0f8d51

Please sign in to comment.