Skip to content

Commit 9eeef91

Browse files
author
David Scott
committed
Fix datapath example
Signed-off-by: David Scott <dave.scott@eu.citrix.com>
1 parent bc3647a commit 9eeef91

File tree

5 files changed

+42
-9
lines changed

5 files changed

+42
-9
lines changed

examples/datapath/block/Datapath.activate

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,5 +22,5 @@ if __name__ == "__main__":
2222

2323
dispatcher = d.Datapath_server_dispatcher(Implementation())
2424
request = json.loads(sys.stdin.readline(),)
25-
results = dispatcher.attach(request)
25+
results = dispatcher.activate(request)
2626
print json.dumps(results)

examples/datapath/block/Datapath.attach

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,14 @@ sys.path.append("/home/vagrant/djs55/dbus-test/python")
55

66
import xcp, d
77

8-
import argparse, json
9-
10-
class Blkback:
11-
def __init__(self, params):
12-
self.value = params
8+
import argparse, json, urlparse
139

1410
class Implementation(d.Datapath_skeleton):
1511
def attach(self, dbg, uri, domain):
12+
u = urlparse.urlparse(uri)
1613
return {
1714
'domain_uuid': '0',
18-
'implementation': Blkback('/some/path'),
15+
'implementation': [ 'Blkback', u.path ],
1916
}
2017

2118
if __name__ == "__main__":

examples/datapath/block/Datapath.deactivate

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,5 +22,5 @@ if __name__ == "__main__":
2222

2323
dispatcher = d.Datapath_server_dispatcher(Implementation())
2424
request = json.loads(sys.stdin.readline(),)
25-
results = dispatcher.attach(request)
25+
results = dispatcher.deactivate(request)
2626
print json.dumps(results)

examples/datapath/block/Datapath.detach

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,5 +22,5 @@ if __name__ == "__main__":
2222

2323
dispatcher = d.Datapath_server_dispatcher(Implementation())
2424
request = json.loads(sys.stdin.readline(),)
25-
results = dispatcher.attach(request)
25+
results = dispatcher.detach(request)
2626
print json.dumps(results)
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
#!/usr/bin/env ocamlscript
2+
Ocaml.sources := ["common.ml"; "lvm.ml"];
3+
Ocaml.packs := ["xapi-storage"; "cmdliner"; "re.str"; "oUnit"; "uri"];
4+
Ocaml.ocamlflags := ["-thread"]
5+
--
6+
(*
7+
* Copyright (C) Citrix Systems Inc.
8+
*
9+
* This program is free software; you can redistribute it and/or modify
10+
* it under the terms of the GNU Lesser General Public License as published
11+
* by the Free Software Foundation; version 2.1 only. with the special
12+
* exception on linking described in file LICENSE.
13+
*
14+
* This program is distributed in the hope that it will be useful,
15+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
16+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17+
* GNU Lesser General Public License for more details.
18+
*)
19+
open Common
20+
21+
module Command = struct
22+
open Storage.P.Types
23+
include Plugin.Diagnostics
24+
25+
let command common { Plugin.Diagnostics.In.dbg } =
26+
"Not yet implemented"
27+
end
28+
29+
module Test = struct
30+
open OUnit
31+
32+
let test common = ()
33+
end
34+
35+
module M = Make(Command)(Test)
36+
let _ = M.main ()

0 commit comments

Comments
 (0)