WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-api

[Xen-API] [PATCH 1 of 2] Make use of the new make_uuid_* functions:

To: xen-api@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-API] [PATCH 1 of 2] Make use of the new make_uuid_* functions:
From: <magnus.therning@xxxxxxxxxxxxx>
Date: Thu, 9 Sep 2010 14:16:01 +0100
Delivery-date: Thu, 09 Sep 2010 06:20:17 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <patchbomb.1284038160@xxxxxxxxxxxxxxxxxxxxxx>
List-help: <mailto:xen-api-request@lists.xensource.com?subject=help>
List-id: Discussion of API issues surrounding Xen <xen-api.lists.xensource.com>
List-post: <mailto:xen-api@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-api>, <mailto:xen-api-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-api>, <mailto:xen-api-request@lists.xensource.com?subject=unsubscribe>
References: <patchbomb.1284038160@xxxxxxxxxxxxxxxxxxxxxx>
Sender: xen-api-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Mercurial-patchbomb/1.6.3
 ocaml/lvhdrt/lvhdrt-trash-vdi |  4 ++--
 ocaml/ptoken/genptoken.ml     |  2 +-
 ocaml/xapi/xapi.ml            |  2 +-
 ocaml/xapi/xapi_session.ml    |  2 +-
 4 files changed, 5 insertions(+), 5 deletions(-)


# HG changeset patch
# User Magnus Therning <magnus.therning@xxxxxxxxxx>
# Date 1284037702 -3600
# Node ID 27492274f55c542306d562e3e74abf8b78f4e055
# Parent  705838f352ea6882ffedcb2be652b250bdd8b4cf
Make use of the new make_uuid_* functions:
 - make_uuid_rnd - used for pool secret
 - make_uuid_urnd - used for sessions

All others continue to use make_uuid for the moment.

Signed-off-by: Magnus Therning <magnus.therning@xxxxxxxxxx>

diff -r 705838f352ea -r 27492274f55c ocaml/lvhdrt/lvhdrt-trash-vdi
--- a/ocaml/lvhdrt/lvhdrt-trash-vdi
+++ b/ocaml/lvhdrt/lvhdrt-trash-vdi
@@ -2,7 +2,7 @@
 
 # This plugin takes a VDI uuid as a parameter and executes the following steps:
 # 1. Copies the data contents to /tmp/*trash-vdi
-# 2. Copies random data over the VDI
+# 2. Writes zeros over the VDI
 # 3. Waits for 1s
 # 4. Copies the original data contents back
 #
@@ -33,7 +33,7 @@
     try:
         dd(path, tmp_path)
         try:
-            dd("/dev/urandom", path)
+            dd("/dev/zero", path)
         finally:
             # 4. Copy the original data back
             dd(tmp_path, path)
diff -r 705838f352ea -r 27492274f55c ocaml/ptoken/genptoken.ml
--- a/ocaml/ptoken/genptoken.ml
+++ b/ocaml/ptoken/genptoken.ml
@@ -17,7 +17,7 @@
                then if !options.force
                        then Sys.remove !options.tgtfile
                        else begin print_endline "File exists, use -f to 
replace it."; exit 1 end;
-       let uuid _ = Uuid.to_string (Uuid.make_uuid ()) in
+       let uuid _ = Uuid.to_string (Uuid.make_uuid_rnd ()) in
        let uuids = String.concat "/" [uuid (); uuid (); uuid ()] in
        let f = open_out_gen [Open_wronly; Open_creat; Open_excl; Open_binary] 
0o640 !options.tgtfile in
        output_string f uuids
diff -r 705838f352ea -r 27492274f55c ocaml/xapi/xapi.ml
--- a/ocaml/xapi/xapi.ml
+++ b/ocaml/xapi/xapi.ml
@@ -191,7 +191,7 @@
   let n = 8 in
   let s = String.create n in
 
-  let chan = open_in "/dev/urandom" in
+  let chan = open_in "/dev/random" in
   Pervasiveext.finally (fun () -> really_input chan s 0 n)
     (fun () -> close_in chan);
   Random.full_init (Array.init n (fun i -> Char.code s.[i]))
diff -r 705838f352ea -r 27492274f55c ocaml/xapi/xapi_session.ml
--- a/ocaml/xapi/xapi_session.ml
+++ b/ocaml/xapi/xapi_session.ml
@@ -269,7 +269,7 @@
    Needs to be protected by a proper access control system *)
 let login_no_password ~__context ~uname ~host ~pool ~is_local_superuser 
~subject ~auth_user_sid ~auth_user_name ~rbac_permissions =
        let session_id = Ref.make () in
-       let uuid = Uuid.to_string (Uuid.make_uuid ()) in
+       let uuid = Uuid.to_string (Uuid.make_uuid_urnd ()) in
        let user = Ref.null in (* always return a null reference to the 
deprecated user object *)
        let parent = try Context.get_session_id __context with _ -> Ref.null in
          (*match uname with   (* the user object is deprecated in favor of 
subject *)
_______________________________________________
xen-api mailing list
xen-api@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/mailman/listinfo/xen-api
<Prev in Thread] Current Thread [Next in Thread>