From: Marcus Granado Date: Wed, 26 Jan 2011 17:39:05 +0000 (+0000) Subject: PR-1126: add support for secret.other_config X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=cb4b49f60a859088ab549a229082efda8d020618;p=xcp%2Fxen-api.git PR-1126: add support for secret.other_config as requested by storage backend. Signed-off-by: Marcus Granado --- diff --git a/ocaml/database/db_hiupgrade.ml b/ocaml/database/db_hiupgrade.ml index 3a20b086..95e1ba65 100644 --- a/ocaml/database/db_hiupgrade.ml +++ b/ocaml/database/db_hiupgrade.ml @@ -39,7 +39,7 @@ let upgrade_wlb_configuration ~__context () = 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 --git a/ocaml/idl/datamodel.ml b/ocaml/idl/datamodel.ml index a1d2b504..401ad04e 100644 --- a/ocaml/idl/datamodel.ml +++ b/ocaml/idl/datamodel.ml @@ -6515,7 +6515,7 @@ let secret = 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 @@ -6540,6 +6540,7 @@ let secret = ~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 --git a/ocaml/xapi/cli_operations.ml b/ocaml/xapi/cli_operations.ml index 25c9ef87..4acb7b28 100644 --- a/ocaml/xapi/cli_operations.ml +++ b/ocaml/xapi/cli_operations.ml @@ -3949,7 +3949,8 @@ let session_subject_identifier_logout_all printer rpc session_id params = 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 --git a/ocaml/xapi/workload_balancing.ml b/ocaml/xapi/workload_balancing.ml index 9b2f3fed..2bd0fcbe 100755 --- a/ocaml/xapi/workload_balancing.ml +++ b/ocaml/xapi/workload_balancing.ml @@ -443,7 +443,7 @@ let init_wlb ~__context ~wlb_url ~wlb_username ~wlb_password ~xenserver_username 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 --git a/ocaml/xapi/xapi_pool.ml b/ocaml/xapi/xapi_pool.ml index b36e8dd5..ab0051f5 100644 --- a/ocaml/xapi/xapi_pool.ml +++ b/ocaml/xapi/xapi_pool.ml @@ -470,7 +470,7 @@ let create_or_get_secret_on_master __context rpc session_id (secret_ref, secret) 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 --git a/ocaml/xapi/xapi_secret.ml b/ocaml/xapi/xapi_secret.ml index 7718bdcb..daf6a82c 100644 --- a/ocaml/xapi/xapi_secret.ml +++ b/ocaml/xapi/xapi_secret.ml @@ -20,14 +20,14 @@ open Stringext 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 @@ let duplicate_passwds ~__context strmap = 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 --git a/ocaml/xapi/xapi_vmpp.ml b/ocaml/xapi/xapi_vmpp.ml index 9ce99dde..e13684b9 100644 --- a/ocaml/xapi/xapi_vmpp.ml +++ b/ocaml/xapi/xapi_vmpp.ml @@ -377,7 +377,7 @@ let map_password_to_secret ~__context ~new_password ~db = 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 )