CA-286574: Fixed issue where the DR metadata were not loaded from the VDI because

the action was failing to create a metadata session; the latter was due to accessing
directly properties of the xmlrpc proxy which is null since we use the jsonrpc backend.
Also fixed some more areas where the same might occur.

Signed-off-by: Konstantina Chremmou <konstantina.chremmou@citrix.com>
This commit is contained in:
Konstantina Chremmou 2018-04-07 00:31:17 +01:00 committed by Mihaela Stoica
parent 82dc176c44
commit a8efbbfba2
4 changed files with 15 additions and 9 deletions

View File

@ -155,7 +155,7 @@ namespace XenAdmin.Network
{
if (session == null)
log.Debug("Heartbeat has failed due to null session; closing the main connection");
else if (session.proxy.Proxy.Credentials == null)
else if (session.Credentials == null)
log.DebugFormat("Heartbeat for {0} has failed due to missing credentials; closing the main connection", session.Url);
else
log.DebugFormat("Heartbeat for {0} has failed due to incorrect credentials; closing the main connection", session.Url);

View File

@ -164,11 +164,6 @@ namespace XenAPI
return max;
}
public static Dictionary<string, string> retrieve_wlb_default_configuration(Session session)
{
return Maps.convert_from_proxy_string_string(session.proxy.pool_retrieve_wlb_configuration("default").parse());
}
public string GetXCPluginSecret(string plugin_name, IXenObject obj)
{
return Get(gui_config, XCPluginSecretName(plugin_name, obj));

View File

@ -157,7 +157,7 @@ namespace XenAPI
try
{
// Try and logout the old session using the new session
newSession.proxy.session_logout(session.opaque_ref);
newSession.logout(session.opaque_ref);
}
catch
{

View File

@ -132,8 +132,7 @@ namespace XenAPI
// Used after VDI.open_database
public static Session get_record(Session session, string _session)
{
Session newSession = new Session(session.proxy.Url);
newSession.opaque_ref = _session;
Session newSession = new Session(session.Url) {opaque_ref = _session};
newSession.SetAPIVersion();
if (newSession.XmlRpcToJsonRpcInvoker != null)
newSession.XmlRpcToJsonRpcInvoker(newSession);
@ -249,6 +248,18 @@ namespace XenAPI
}
}
public ICredentials Credentials
{
get
{
if (JsonRpcClient != null && JsonRpcClient.WebProxy != null)
return JsonRpcClient.WebProxy.Credentials;
if (proxy.Proxy != null)
return proxy.Proxy.Credentials;
return null;
}
}
/// <summary>
/// Always true before API version 1.6.
/// </summary>