From d7f18535623bad3aacfbeb92ce96e5583160d763 Mon Sep 17 00:00:00 2001 From: Danilo Del Busso Date: Tue, 11 Jan 2022 11:39:08 +0000 Subject: [PATCH] Bump C# SDK to modified version of `xapi 21.3.0/1.xs8` SDK update does not contain the removal of `evacuate` overloads Signed-off-by: Danilo Del Busso --- XenModel/XenAPI/FriendlyErrorNames.resx | 6 ++ XenModel/XenAPI/JsonRpcClient.cs | 57 +++++++++- XenModel/XenAPI/Message2.cs | 6 +- XenModel/XenAPI/Pool.cs | 134 ++++++++++++++++++++++-- XenModel/XenAPI/Proxy.cs | 35 ++++++- XenModel/XenAPI/Task.cs | 30 ++++++ 6 files changed, 251 insertions(+), 17 deletions(-) diff --git a/XenModel/XenAPI/FriendlyErrorNames.resx b/XenModel/XenAPI/FriendlyErrorNames.resx index 4621df889..f506878bc 100755 --- a/XenModel/XenAPI/FriendlyErrorNames.resx +++ b/XenModel/XenAPI/FriendlyErrorNames.resx @@ -651,6 +651,12 @@ The repomd.xml is invalid. + + The repository proxy username/password is invalid. + + + The repository proxy URL is invalid. + The uploaded update package is invalid. diff --git a/XenModel/XenAPI/JsonRpcClient.cs b/XenModel/XenAPI/JsonRpcClient.cs index 060f36707..039e243a1 100755 --- a/XenModel/XenAPI/JsonRpcClient.cs +++ b/XenModel/XenAPI/JsonRpcClient.cs @@ -207,6 +207,13 @@ namespace XenAPI return Rpc("session.get_originator", new JArray(session, _session ?? ""), serializer); } + public bool session_get_client_certificate(string session, string _session) + { + var converters = new List {}; + var serializer = CreateSerializer(converters); + return Rpc("session.get_client_certificate", new JArray(session, _session ?? ""), serializer); + } + public void session_set_other_config(string session, string _session, Dictionary _other_config) { var converters = new List {new StringStringMapConverter()}; @@ -753,6 +760,20 @@ namespace XenAPI Rpc("task.set_progress", new JArray(session, _task ?? "", _value), serializer); } + public void task_set_result(string session, string _task, string _value) + { + var converters = new List {}; + var serializer = CreateSerializer(converters); + Rpc("task.set_result", new JArray(session, _task ?? "", _value ?? ""), serializer); + } + + public void task_set_error_info(string session, string _task, string[] _value) + { + var converters = new List {}; + var serializer = CreateSerializer(converters); + Rpc("task.set_error_info", new JArray(session, _task ?? "", _value == null ? new JArray() : JArray.FromObject(_value)), serializer); + } + public List> task_get_all(string session) { var converters = new List {new XenRefListConverter()}; @@ -1075,6 +1096,20 @@ namespace XenAPI return Rpc("pool.get_client_certificate_auth_name", new JArray(session, _pool ?? ""), serializer); } + public string pool_get_repository_proxy_url(string session, string _pool) + { + var converters = new List {}; + var serializer = CreateSerializer(converters); + return Rpc("pool.get_repository_proxy_url", new JArray(session, _pool ?? ""), serializer); + } + + public string pool_get_repository_proxy_username(string session, string _pool) + { + var converters = new List {}; + var serializer = CreateSerializer(converters); + return Rpc("pool.get_repository_proxy_username", new JArray(session, _pool ?? ""), serializer); + } + public void pool_set_name_label(string session, string _pool, string _name_label) { var converters = new List {}; @@ -1971,18 +2006,18 @@ namespace XenAPI return Rpc>("Async.pool.remove_repository", new JArray(session, _pool ?? "", _value ?? ""), serializer); } - public string pool_sync_updates(string session, string _pool, bool _force) + public string pool_sync_updates(string session, string _pool, bool _force, string _token, string _token_id) { var converters = new List {}; var serializer = CreateSerializer(converters); - return Rpc("pool.sync_updates", new JArray(session, _pool ?? "", _force), serializer); + return Rpc("pool.sync_updates", new JArray(session, _pool ?? "", _force, _token ?? "", _token_id ?? ""), serializer); } - public XenRef async_pool_sync_updates(string session, string _pool, bool _force) + public XenRef async_pool_sync_updates(string session, string _pool, bool _force, string _token, string _token_id) { var converters = new List {new XenRefConverter()}; var serializer = CreateSerializer(converters); - return Rpc>("Async.pool.sync_updates", new JArray(session, _pool ?? "", _force), serializer); + return Rpc>("Async.pool.sync_updates", new JArray(session, _pool ?? "", _force, _token ?? "", _token_id ?? ""), serializer); } public string[] pool_check_update_readiness(string session, string _pool, bool _requires_reboot) @@ -2027,6 +2062,20 @@ namespace XenAPI return Rpc>("Async.pool.disable_client_certificate_auth", new JArray(session, _pool ?? ""), serializer); } + public void pool_configure_repository_proxy(string session, string _pool, string _url, string _username, string _password) + { + var converters = new List {}; + var serializer = CreateSerializer(converters); + Rpc("pool.configure_repository_proxy", new JArray(session, _pool ?? "", _url ?? "", _username ?? "", _password ?? ""), serializer); + } + + public XenRef async_pool_configure_repository_proxy(string session, string _pool, string _url, string _username, string _password) + { + var converters = new List {new XenRefConverter()}; + var serializer = CreateSerializer(converters); + return Rpc>("Async.pool.configure_repository_proxy", new JArray(session, _pool ?? "", _url ?? "", _username ?? "", _password ?? ""), serializer); + } + public List> pool_get_all(string session) { var converters = new List {new XenRefListConverter()}; diff --git a/XenModel/XenAPI/Message2.cs b/XenModel/XenAPI/Message2.cs index 69ec56535..5c03ce864 100644 --- a/XenModel/XenAPI/Message2.cs +++ b/XenModel/XenAPI/Message2.cs @@ -105,7 +105,7 @@ namespace XenAPI VM_SECURE_BOOT_FAILED, VM_CLONED, VM_CRASHED, - VM_UNPAUSE, + VM_UNPAUSED, VM_PAUSED, VM_RESUMED, VM_SUSPENDED, @@ -281,8 +281,8 @@ namespace XenAPI return MessageType.VM_CLONED; case "VM_CRASHED": return MessageType.VM_CRASHED; - case "VM_UNPAUSE": - return MessageType.VM_UNPAUSE; + case "VM_UNPAUSED": + return MessageType.VM_UNPAUSED; case "VM_PAUSED": return MessageType.VM_PAUSED; case "VM_RESUMED": diff --git a/XenModel/XenAPI/Pool.cs b/XenModel/XenAPI/Pool.cs index 7c44ad5e1..49eb755a8 100644 --- a/XenModel/XenAPI/Pool.cs +++ b/XenModel/XenAPI/Pool.cs @@ -93,7 +93,9 @@ namespace XenAPI bool tls_verification_enabled, List> repositories, bool client_certificate_auth_enabled, - string client_certificate_auth_name) + string client_certificate_auth_name, + string repository_proxy_url, + string repository_proxy_username) { this.uuid = uuid; this.name_label = name_label; @@ -137,6 +139,8 @@ namespace XenAPI this.repositories = repositories; this.client_certificate_auth_enabled = client_certificate_auth_enabled; this.client_certificate_auth_name = client_certificate_auth_name; + this.repository_proxy_url = repository_proxy_url; + this.repository_proxy_username = repository_proxy_username; } /// @@ -210,6 +214,8 @@ namespace XenAPI repositories = record.repositories; client_certificate_auth_enabled = record.client_certificate_auth_enabled; client_certificate_auth_name = record.client_certificate_auth_name; + repository_proxy_url = record.repository_proxy_url; + repository_proxy_username = record.repository_proxy_username; } internal void UpdateFrom(Proxy_Pool proxy) @@ -256,6 +262,8 @@ namespace XenAPI repositories = proxy.repositories == null ? null : XenRef.Create(proxy.repositories); client_certificate_auth_enabled = (bool)proxy.client_certificate_auth_enabled; client_certificate_auth_name = proxy.client_certificate_auth_name == null ? null : proxy.client_certificate_auth_name; + repository_proxy_url = proxy.repository_proxy_url == null ? null : proxy.repository_proxy_url; + repository_proxy_username = proxy.repository_proxy_username == null ? null : proxy.repository_proxy_username; } /// @@ -350,6 +358,10 @@ namespace XenAPI client_certificate_auth_enabled = Marshalling.ParseBool(table, "client_certificate_auth_enabled"); if (table.ContainsKey("client_certificate_auth_name")) client_certificate_auth_name = Marshalling.ParseString(table, "client_certificate_auth_name"); + if (table.ContainsKey("repository_proxy_url")) + repository_proxy_url = Marshalling.ParseString(table, "repository_proxy_url"); + if (table.ContainsKey("repository_proxy_username")) + repository_proxy_username = Marshalling.ParseString(table, "repository_proxy_username"); } public Proxy_Pool ToProxy() @@ -397,6 +409,8 @@ namespace XenAPI result_.repositories = repositories == null ? new string[] {} : Helper.RefListToStringArray(repositories); result_.client_certificate_auth_enabled = client_certificate_auth_enabled; result_.client_certificate_auth_name = client_certificate_auth_name ?? ""; + result_.repository_proxy_url = repository_proxy_url ?? ""; + result_.repository_proxy_username = repository_proxy_username ?? ""; return result_; } @@ -450,7 +464,9 @@ namespace XenAPI Helper.AreEqual2(this._tls_verification_enabled, other._tls_verification_enabled) && Helper.AreEqual2(this._repositories, other._repositories) && Helper.AreEqual2(this._client_certificate_auth_enabled, other._client_certificate_auth_enabled) && - Helper.AreEqual2(this._client_certificate_auth_name, other._client_certificate_auth_name); + Helper.AreEqual2(this._client_certificate_auth_name, other._client_certificate_auth_name) && + Helper.AreEqual2(this._repository_proxy_url, other._repository_proxy_url) && + Helper.AreEqual2(this._repository_proxy_username, other._repository_proxy_username); } public override string SaveChanges(Session session, string opaqueRef, Pool server) @@ -1151,6 +1167,34 @@ namespace XenAPI return session.XmlRpcProxy.pool_get_client_certificate_auth_name(session.opaque_ref, _pool ?? "").parse(); } + /// + /// Get the repository_proxy_url field of the given pool. + /// First published in Unreleased. + /// + /// The session + /// The opaque_ref of the given pool + public static string get_repository_proxy_url(Session session, string _pool) + { + if (session.JsonRpcClient != null) + return session.JsonRpcClient.pool_get_repository_proxy_url(session.opaque_ref, _pool); + else + return session.XmlRpcProxy.pool_get_repository_proxy_url(session.opaque_ref, _pool ?? "").parse(); + } + + /// + /// Get the repository_proxy_username field of the given pool. + /// First published in Unreleased. + /// + /// The session + /// The opaque_ref of the given pool + public static string get_repository_proxy_username(Session session, string _pool) + { + if (session.JsonRpcClient != null) + return session.JsonRpcClient.pool_get_repository_proxy_username(session.opaque_ref, _pool); + else + return session.XmlRpcProxy.pool_get_repository_proxy_username(session.opaque_ref, _pool ?? "").parse(); + } + /// /// Set the name_label field of the given pool. /// First published in XenServer 4.0. @@ -3046,12 +3090,14 @@ namespace XenAPI /// The session /// The opaque_ref of the given pool /// If true local mirroring repo will be removed before syncing - public static string sync_updates(Session session, string _pool, bool _force) + /// The token for repository client authentication + /// The ID of the token + public static string sync_updates(Session session, string _pool, bool _force, string _token, string _token_id) { if (session.JsonRpcClient != null) - return session.JsonRpcClient.pool_sync_updates(session.opaque_ref, _pool, _force); + return session.JsonRpcClient.pool_sync_updates(session.opaque_ref, _pool, _force, _token, _token_id); else - return session.XmlRpcProxy.pool_sync_updates(session.opaque_ref, _pool ?? "", _force).parse(); + return session.XmlRpcProxy.pool_sync_updates(session.opaque_ref, _pool ?? "", _force, _token ?? "", _token_id ?? "").parse(); } /// @@ -3061,12 +3107,14 @@ namespace XenAPI /// The session /// The opaque_ref of the given pool /// If true local mirroring repo will be removed before syncing - public static XenRef async_sync_updates(Session session, string _pool, bool _force) + /// The token for repository client authentication + /// The ID of the token + public static XenRef async_sync_updates(Session session, string _pool, bool _force, string _token, string _token_id) { if (session.JsonRpcClient != null) - return session.JsonRpcClient.async_pool_sync_updates(session.opaque_ref, _pool, _force); + return session.JsonRpcClient.async_pool_sync_updates(session.opaque_ref, _pool, _force, _token, _token_id); else - return XenRef.Create(session.XmlRpcProxy.async_pool_sync_updates(session.opaque_ref, _pool ?? "", _force).parse()); + return XenRef.Create(session.XmlRpcProxy.async_pool_sync_updates(session.opaque_ref, _pool ?? "", _force, _token ?? "", _token_id ?? "").parse()); } /// @@ -3157,6 +3205,40 @@ namespace XenAPI return XenRef.Create(session.XmlRpcProxy.async_pool_disable_client_certificate_auth(session.opaque_ref, _pool ?? "").parse()); } + /// + /// Configure the proxy used in syncing with the enabled repositories + /// First published in Unreleased. + /// + /// The session + /// The opaque_ref of the given pool + /// The URL of the proxy server + /// The username used to authenticate with the proxy server + /// The password used to authenticate with the proxy server + public static void configure_repository_proxy(Session session, string _pool, string _url, string _username, string _password) + { + if (session.JsonRpcClient != null) + session.JsonRpcClient.pool_configure_repository_proxy(session.opaque_ref, _pool, _url, _username, _password); + else + session.XmlRpcProxy.pool_configure_repository_proxy(session.opaque_ref, _pool ?? "", _url ?? "", _username ?? "", _password ?? "").parse(); + } + + /// + /// Configure the proxy used in syncing with the enabled repositories + /// First published in Unreleased. + /// + /// The session + /// The opaque_ref of the given pool + /// The URL of the proxy server + /// The username used to authenticate with the proxy server + /// The password used to authenticate with the proxy server + public static XenRef async_configure_repository_proxy(Session session, string _pool, string _url, string _username, string _password) + { + if (session.JsonRpcClient != null) + return session.JsonRpcClient.async_pool_configure_repository_proxy(session.opaque_ref, _pool, _url, _username, _password); + else + return XenRef.Create(session.XmlRpcProxy.async_pool_configure_repository_proxy(session.opaque_ref, _pool ?? "", _url ?? "", _username ?? "", _password ?? "").parse()); + } + /// /// Return a list of all the pools known to the system. /// First published in XenServer 4.0. @@ -3943,5 +4025,41 @@ namespace XenAPI } } private string _client_certificate_auth_name = ""; + + /// + /// Url of the proxy used in syncing with the enabled repositories + /// First published in Unreleased. + /// + public virtual string repository_proxy_url + { + get { return _repository_proxy_url; } + set + { + if (!Helper.AreEqual(value, _repository_proxy_url)) + { + _repository_proxy_url = value; + NotifyPropertyChanged("repository_proxy_url"); + } + } + } + private string _repository_proxy_url = ""; + + /// + /// Username for the authentication of the proxy used in syncing with the enabled repositories + /// First published in Unreleased. + /// + public virtual string repository_proxy_username + { + get { return _repository_proxy_username; } + set + { + if (!Helper.AreEqual(value, _repository_proxy_username)) + { + _repository_proxy_username = value; + NotifyPropertyChanged("repository_proxy_username"); + } + } + } + private string _repository_proxy_username = ""; } } diff --git a/XenModel/XenAPI/Proxy.cs b/XenModel/XenAPI/Proxy.cs index 2e8d62507..a033c7f47 100755 --- a/XenModel/XenAPI/Proxy.cs +++ b/XenModel/XenAPI/Proxy.cs @@ -138,6 +138,10 @@ namespace XenAPI Response session_get_originator(string session, string _session); + [XmlRpcMethod("session.get_client_certificate")] + Response + session_get_client_certificate(string session, string _session); + [XmlRpcMethod("session.set_other_config")] Response session_set_other_config(string session, string _session, Object _other_config); @@ -450,6 +454,14 @@ namespace XenAPI Response task_set_progress(string session, string _task, double _value); + [XmlRpcMethod("task.set_result")] + Response + task_set_result(string session, string _task, string _value); + + [XmlRpcMethod("task.set_error_info")] + Response + task_set_error_info(string session, string _task, string [] _value); + [XmlRpcMethod("task.get_all")] Response task_get_all(string session); @@ -634,6 +646,14 @@ namespace XenAPI Response pool_get_client_certificate_auth_name(string session, string _pool); + [XmlRpcMethod("pool.get_repository_proxy_url")] + Response + pool_get_repository_proxy_url(string session, string _pool); + + [XmlRpcMethod("pool.get_repository_proxy_username")] + Response + pool_get_repository_proxy_username(string session, string _pool); + [XmlRpcMethod("pool.set_name_label")] Response pool_set_name_label(string session, string _pool, string _name_label); @@ -1148,11 +1168,11 @@ namespace XenAPI [XmlRpcMethod("pool.sync_updates")] Response - pool_sync_updates(string session, string _pool, bool _force); + pool_sync_updates(string session, string _pool, bool _force, string _token, string _token_id); [XmlRpcMethod("Async.pool.sync_updates")] Response - async_pool_sync_updates(string session, string _pool, bool _force); + async_pool_sync_updates(string session, string _pool, bool _force, string _token, string _token_id); [XmlRpcMethod("pool.check_update_readiness")] Response @@ -1178,6 +1198,14 @@ namespace XenAPI Response async_pool_disable_client_certificate_auth(string session, string _pool); + [XmlRpcMethod("pool.configure_repository_proxy")] + Response + pool_configure_repository_proxy(string session, string _pool, string _url, string _username, string _password); + + [XmlRpcMethod("Async.pool.configure_repository_proxy")] + Response + async_pool_configure_repository_proxy(string session, string _pool, string _url, string _username, string _password); + [XmlRpcMethod("pool.get_all")] Response pool_get_all(string session); @@ -8660,6 +8688,7 @@ namespace XenAPI public string [] tasks; public string parent; public string originator; + public bool client_certificate; } [XmlRpcMissingMapping(MappingAction.Ignore)] @@ -8752,6 +8781,8 @@ namespace XenAPI public string [] repositories; public bool client_certificate_auth_enabled; public string client_certificate_auth_name; + public string repository_proxy_url; + public string repository_proxy_username; } [XmlRpcMissingMapping(MappingAction.Ignore)] diff --git a/XenModel/XenAPI/Task.cs b/XenModel/XenAPI/Task.cs index ec324c769..7b89ad74b 100644 --- a/XenModel/XenAPI/Task.cs +++ b/XenModel/XenAPI/Task.cs @@ -684,6 +684,36 @@ namespace XenAPI session.XmlRpcProxy.task_set_progress(session.opaque_ref, _task ?? "", _value).parse(); } + /// + /// Set the task result + /// First published in Unreleased. + /// + /// The session + /// The opaque_ref of the given task + /// Task result to be set + public static void set_result(Session session, string _task, string _value) + { + if (session.JsonRpcClient != null) + session.JsonRpcClient.task_set_result(session.opaque_ref, _task, _value); + else + session.XmlRpcProxy.task_set_result(session.opaque_ref, _task ?? "", _value ?? "").parse(); + } + + /// + /// Set the task error info + /// First published in Unreleased. + /// + /// The session + /// The opaque_ref of the given task + /// Task error info to be set + public static void set_error_info(Session session, string _task, string[] _value) + { + if (session.JsonRpcClient != null) + session.JsonRpcClient.task_set_error_info(session.opaque_ref, _task, _value); + else + session.XmlRpcProxy.task_set_error_info(session.opaque_ref, _task ?? "", _value).parse(); + } + /// /// Return a list of all the tasks known to the system. /// First published in XenServer 4.0.