mirror of
https://github.com/xcp-ng/xenadmin.git
synced 2024-11-25 14:27:26 +01:00
Merge pull request #758 from GaborApatiNagy/CA-148491
CA-148491: XenServer breaks if any XenAPI client leaks sessions
This commit is contained in:
commit
5d5e242018
@ -68,7 +68,7 @@ namespace XenServerHealthCheck
|
|||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
session.login_with_password(connection.Username, connection.Password);
|
session.login_with_password(connection.Username, connection.Password, Helper.APIVersionString(API_Version.LATEST), Session.UserAgent);
|
||||||
connection.LoadCache(session);
|
connection.LoadCache(session);
|
||||||
var pool = Helpers.GetPoolOfOne(connection);
|
var pool = Helpers.GetPoolOfOne(connection);
|
||||||
if (pool != null)
|
if (pool != null)
|
||||||
@ -187,7 +187,7 @@ namespace XenServerHealthCheck
|
|||||||
public void updateHealthCheckSettings(bool success, DateTime time, string uploadUuid = "")
|
public void updateHealthCheckSettings(bool success, DateTime time, string uploadUuid = "")
|
||||||
{
|
{
|
||||||
Session session = new Session(connection.Hostname, 80);
|
Session session = new Session(connection.Hostname, 80);
|
||||||
session.login_with_password(connection.Username, connection.Password);
|
session.login_with_password(connection.Username, connection.Password, Helper.APIVersionString(API_Version.LATEST), Session.UserAgent);
|
||||||
connection.LoadCache(session);
|
connection.LoadCache(session);
|
||||||
|
|
||||||
// Round-trip format time
|
// Round-trip format time
|
||||||
|
@ -48,6 +48,9 @@ namespace XenServerHealthCheck
|
|||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
AutoLog = false;
|
AutoLog = false;
|
||||||
|
|
||||||
|
XenAPI.Session.UserAgent = string.Format("XenServerHealthCheck/API-{0}", API_Version.LATEST);
|
||||||
|
|
||||||
if (!System.Diagnostics.EventLog.SourceExists("XenServerHealthCheck"))
|
if (!System.Diagnostics.EventLog.SourceExists("XenServerHealthCheck"))
|
||||||
{
|
{
|
||||||
System.Diagnostics.EventLog.CreateEventSource(
|
System.Diagnostics.EventLog.CreateEventSource(
|
||||||
@ -131,7 +134,7 @@ namespace XenServerHealthCheck
|
|||||||
session.APIVersion = API_Version.LATEST;
|
session.APIVersion = API_Version.LATEST;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
session.login_with_password(server.UserName, server.Password);
|
session.login_with_password(server.UserName, server.Password, Helper.APIVersionString(API_Version.LATEST), Session.UserAgent);
|
||||||
}
|
}
|
||||||
catch (Exception exn)
|
catch (Exception exn)
|
||||||
{
|
{
|
||||||
@ -171,7 +174,7 @@ namespace XenServerHealthCheck
|
|||||||
log.InfoFormat("Reconnect to master {0}", server.HostName);
|
log.InfoFormat("Reconnect to master {0}", server.HostName);
|
||||||
session = new Session(server.HostName, 80);
|
session = new Session(server.HostName, 80);
|
||||||
session.APIVersion = API_Version.LATEST;
|
session.APIVersion = API_Version.LATEST;
|
||||||
session.login_with_password(server.UserName, server.Password);
|
session.login_with_password(server.UserName, server.Password, Helper.APIVersionString(API_Version.LATEST), Session.UserAgent);
|
||||||
}
|
}
|
||||||
XenConnection connectionInfo = new XenConnection();
|
XenConnection connectionInfo = new XenConnection();
|
||||||
connectionInfo.Hostname = server.HostName;
|
connectionInfo.Hostname = server.HostName;
|
||||||
|
Loading…
Reference in New Issue
Block a user