[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-API] [PATCH] PR-1126: add support for secret.other_config



 ocaml/database/db_hiupgrade.ml   |   2 +-
 ocaml/idl/datamodel.ml           |   3 ++-
 ocaml/xapi/cli_operations.ml     |   3 ++-
 ocaml/xapi/workload_balancing.ml |   2 +-
 ocaml/xapi/xapi_pool.ml          |   2 +-
 ocaml/xapi/xapi_secret.ml        |  10 +++++-----
 ocaml/xapi/xapi_vmpp.ml          |   2 +-
 7 files changed, 13 insertions(+), 11 deletions(-)


# HG changeset patch
# User Marcus Granado <marcus.granado@xxxxxxxxxx>
# Date 1290191399 0
# Node ID d72ab004e7ce31aa27e2b76c096b41bc32c81d04
# Parent  bdf8414071ff96b4b14aee2378ae66c91e64d043
PR-1126: add support for secret.other_config

as requested by storage backend.

Signed-off-by: Marcus Granado <marcus.granado@xxxxxxxxxxxxx>

diff -r bdf8414071ff -r d72ab004e7ce ocaml/database/db_hiupgrade.ml
--- a/ocaml/database/db_hiupgrade.ml
+++ b/ocaml/database/db_hiupgrade.ml
@@ -39,7 +39,7 @@
                        then Ref.null
                        else if String.startswith "OpaqueRef:" old_wlb_pwd
                                then Db.Pool.get_wlb_password ~__context 
~self:pool
-                               else Xapi_secret.create ~__context 
~value:old_wlb_pwd
+                               else Xapi_secret.create ~__context 
~value:old_wlb_pwd ~other_config:[]
        in
        Db.Pool.set_wlb_password ~__context ~self:pool ~value:wlb_passwd_ref
 
diff -r bdf8414071ff -r d72ab004e7ce ocaml/idl/datamodel.ml
--- a/ocaml/idl/datamodel.ml
+++ b/ocaml/idl/datamodel.ml
@@ -6513,7 +6513,7 @@
        let introduce = call
                ~name:"introduce"
                ~in_product_since:rel_midnight_ride
-               ~params:[String, "uuid", ""; String, "value", ""]
+               ~params:[String, "uuid", ""; String, "value", ""; (Map 
(String,String)), "other_config", ""]
                ~flags:[`Session]
                ~result:(Ref _secret, "")
                ~secret:true
@@ -6538,6 +6538,7 @@
                ~contents:
                        [ uid ~reader_roles:_R_POOL_OP _secret
                        ; field ~reader_roles:_R_POOL_OP ~qualifier:RW 
~ty:String "value" "the secret"
+                        ; field ~qualifier:RW ~ty:(Map (String,String)) 
"other_config" "other_config" ~default_value:(Some (VMap []));
                        ]
                ()
 
diff -r bdf8414071ff -r d72ab004e7ce ocaml/xapi/cli_operations.ml
--- a/ocaml/xapi/cli_operations.ml
+++ b/ocaml/xapi/cli_operations.ml
@@ -3928,7 +3928,8 @@
 
 let secret_create printer rpc session_id params =
        let value = List.assoc "value" params in
-       let ref = Client.Secret.create ~rpc ~session_id ~value in
+        let other_config = read_map_params "other-config" params in
+       let ref = Client.Secret.create ~rpc ~session_id ~value ~other_config in
        let uuid = Client.Secret.get_uuid ~rpc ~session_id ~self:ref in
        printer (Cli_printer.PList [uuid])
 
diff -r bdf8414071ff -r d72ab004e7ce ocaml/xapi/workload_balancing.ml
--- a/ocaml/xapi/workload_balancing.ml
+++ b/ocaml/xapi/workload_balancing.ml
@@ -443,7 +443,7 @@
                match (data_from_leaf (descend_and_match["Id"] inner_xml)) with 
                | _ ->
                        let old_secret_ref = Db.Pool.get_wlb_password 
~__context ~self:pool in
-                       let wlb_secret_ref = Xapi_secret.create ~__context 
~value:wlb_password in
+                       let wlb_secret_ref = Xapi_secret.create ~__context 
~value:wlb_password ~other_config:[] in
                        Db.Pool.set_wlb_username ~__context ~self:pool 
~value:wlb_username;
                        Db.Pool.set_wlb_password ~__context ~self:pool 
~value:wlb_secret_ref;
                        Db.Pool.set_wlb_url ~__context ~self:pool 
~value:wlb_url;
diff -r bdf8414071ff -r d72ab004e7ce ocaml/xapi/xapi_pool.ml
--- a/ocaml/xapi/xapi_pool.ml
+++ b/ocaml/xapi/xapi_pool.ml
@@ -462,7 +462,7 @@
                try Client.Secret.get_by_uuid ~rpc ~session_id ~uuid:my_uuid
                with _ ->
                        debug "Found no secret with uuid = '%s' on master, so 
creating one." my_uuid;
-                       Client.Secret.introduce ~rpc ~session_id ~uuid:my_uuid 
~value:my_value
+                       Client.Secret.introduce ~rpc ~session_id ~uuid:my_uuid 
~value:my_value ~other_config:[]
        in
        new_secret_ref
 
diff -r bdf8414071ff -r d72ab004e7ce ocaml/xapi/xapi_secret.ml
--- a/ocaml/xapi/xapi_secret.ml
+++ b/ocaml/xapi/xapi_secret.ml
@@ -20,14 +20,14 @@
 module D = Debug.Debugger(struct let name = "xapi_secret" end)
 open D
 
-let introduce ~__context ~uuid ~value =
+let introduce ~__context ~uuid ~value ~other_config =
        let ref = Ref.make () in
-       Db.Secret.create ~__context ~ref ~uuid ~value;
+       Db.Secret.create ~__context ~ref ~uuid ~value ~other_config;
        ref
 
-let create ~__context ~value =
+let create ~__context ~value ~other_config=
        let uuid = Uuid.to_string(Uuid.make_uuid()) in
-       let ref = introduce ~__context ~uuid ~value in
+       let ref = introduce ~__context ~uuid ~value ~other_config in
        ref
 
 let destroy ~__context ~self =
@@ -53,7 +53,7 @@
                then 
                        let sr = Db.Secret.get_by_uuid ~__context ~uuid:v in
                        let v = Db.Secret.get_value ~__context ~self:sr in
-                       let new_sr = create ~__context ~value:v in
+                       let new_sr = create ~__context ~value:v 
~other_config:[] in
                        let new_uuid = Db.Secret.get_uuid ~__context 
~self:new_sr in
                        (k, new_uuid)
                else (k, v)
diff -r bdf8414071ff -r d72ab004e7ce ocaml/xapi/xapi_vmpp.ml
--- a/ocaml/xapi/xapi_vmpp.ml
+++ b/ocaml/xapi/xapi_vmpp.ml
@@ -371,7 +371,7 @@
     ignore (ExnHelper.string_of_exn e);
     let new_secret_ref = Ref.make() in
     let new_secret_uuid = Uuid.to_string(Uuid.make_uuid()) in
-    Db.Secret.create ~__context ~ref:new_secret_ref ~uuid:new_secret_uuid 
~value:new_password;
+    Db.Secret.create ~__context ~ref:new_secret_ref ~uuid:new_secret_uuid 
~value:new_password ~other_config:[];
     new_secret_uuid
   )
 

Attachment: xen-api.hg.patch
Description: Text Data

_______________________________________________
xen-api mailing list
xen-api@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/mailman/listinfo/xen-api

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.