Merge pull request #51 from kc284/xs64bit

CAR-107 bug fixes.
This commit is contained in:
Gabor Apati-Nagy 2014-04-29 11:39:40 +01:00
commit b5ede5124c
7 changed files with 61 additions and 31 deletions

View File

@ -68,12 +68,14 @@ namespace XenAdmin.Alerts
public void IncludeConnection(IXenConnection newConnection)
{
connections.Add(newConnection);
if (!connections.Contains(newConnection))
connections.Add(newConnection);
}
public void IncludeHosts(IEnumerable<Host> newHosts)
{
hosts.AddRange(newHosts);
var notContained = newHosts.Where(h => !hosts.Contains(h));
hosts.AddRange(notContained);
}
public void CopyConnectionsAndHosts(XenServerUpdateAlert alert)

View File

@ -433,7 +433,7 @@ namespace XenAdmin
if (action.Exception != null && !(action.Exception is CancelledException))
{
if (meddlingAction == null)
SetStatusBar(XenAdmin.Properties.Resources._000_error_h32bit_16, action.Exception.Message);
SetStatusBar(Properties.Resources._000_error_h32bit_16, action.Exception.Message);
IXenObject model =
(IXenObject)action.VM ??
@ -447,11 +447,13 @@ namespace XenAdmin
}
else if (meddlingAction == null)
{
SetStatusBar(null,
action.IsCompleted ? null :
!string.IsNullOrEmpty(action.Description) ? action.Description :
!string.IsNullOrEmpty(action.Title) ? action.Title :
null);
SetStatusBar(null, action.IsCompleted
? null
: !string.IsNullOrEmpty(action.Description)
? action.Description
: !string.IsNullOrEmpty(action.Title)
? action.Title
: null);
}
int errors = ConnectionsManager.History.Count(a => a.IsCompleted && !a.Succeeded);

View File

@ -105,6 +105,9 @@ namespace XenAdmin.TabPages
private void Rebuild()
{
if (!Visible)
return;
log.Debug("Rebuilding alertList");
Thread t = new Thread(_Rebuild);
t.Name = "Building alert list";

View File

@ -144,6 +144,9 @@ namespace XenAdmin.TabPages
private void BuildRowList()
{
if (!Visible)
return;
try
{
dataGridView.SuspendLayout();

View File

@ -182,6 +182,9 @@ namespace XenAdmin.TabPages
{
Program.AssertOnEventThread();
if (!Visible)
return;
if (checksQueue > 0)
return;

View File

@ -99,7 +99,9 @@ namespace XenAdmin.Actions
{
_pool = value;
SetAppliesTo(Pool);
if(Pool!=null&&Pool.Connection!=null&&Helpers.GetPool(Pool.Connection)==null&& Pool.Connection.Cache.Hosts.Length == 1)
if (Pool != null && Pool.Connection != null &&
Helpers.GetPool(Pool.Connection) == null &&
Pool.Connection.Cache.Hosts.Length == 1)
{
SetAppliesTo(Pool.Connection.Cache.Hosts[0]);
}
@ -291,7 +293,16 @@ namespace XenAdmin.Actions
public string Description
{
get { return _description; }
set { if (_description != value) { _description = value; if (LogDescriptionChanges) log.Debug(_description); OnChanged(); } }
set
{
if (_description != value)
{
_description = value;
if (LogDescriptionChanges)
log.Debug(_description);
OnChanged();
}
}
}
public bool IsCompleted

View File

@ -31,7 +31,6 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Globalization;
using System.Net;
using System.Reflection;
@ -39,7 +38,6 @@ using System.Threading;
using CookComputing.XmlRpc;
using XenAdmin.Actions;
using XenAdmin.Core;
using XenAdmin.ServerDBs;
using XenAPI;
using System.Diagnostics;
@ -996,10 +994,9 @@ namespace XenAdmin.Network
}
log.InfoFormat("Connected to {0} ({1}:{2})", FriendlyName, taskHostname, task_port);
string name =
string.IsNullOrEmpty(FriendlyName) || FriendlyName == taskHostname ?
taskHostname :
string.Format("{0} ({1})", FriendlyName, taskHostname);
string name = string.IsNullOrEmpty(FriendlyName) || FriendlyName == taskHostname
? taskHostname
: string.Format("{0} ({1})", FriendlyName, taskHostname);
string title = string.Format(Messages.CONNECTING_NOTICE_TITLE, name);
string msg = string.Format(Messages.CONNECTING_NOTICE_TEXT, name);
log.Info(msg);
@ -1481,11 +1478,10 @@ namespace XenAdmin.Network
ExpressRestriction e = (ExpressRestriction)error;
string msg = string.Format(Messages.CONNECTION_RESTRICTED_MESSAGE, e.HostName, e.ExistingHostName);
log.Info(msg);
// Add an informational log message saying why the connection attempt failed
ActionBase action = new ActionBase(
string.Format(Messages.CONNECTION_RESTRICTED_NOTICE_TITLE, e.HostName),
msg, false, true, Messages.CONNECTION_RESTRICTED_NOTICE_TITLE);
log.Info(msg);
string title = string.Format(Messages.CONNECTION_RESTRICTED_NOTICE_TITLE, e.HostName);
ActionBase action = new ActionBase(title, msg, false, true, msg);
SetPoolAndHostInAction(action, pool, PoolOpaqueRef);
OnConnectionResult(false, Messages.CONNECTION_RESTRICTED_MESSAGE, error);
@ -1511,14 +1507,25 @@ namespace XenAdmin.Network
{
// We never connected
string reason = GetReason(error);
log.WarnFormat("IXenConnection: failed to connect to {0}: {1}", this.HostnameWithPort, reason);
// Create a new log message to say the connection attempt failed
string title = string.Format(Messages.CONNECTION_FAILED_TITLE, HostnameWithPort);
ActionBase n = new ActionBase(title, reason, false, true, title);
SetPoolAndHostInAction(n, pool, PoolOpaqueRef);
log.WarnFormat("IXenConnection: failed to connect to {0}: {1}", HostnameWithPort, reason);
Failure f = error as Failure;
if (f != null && f.ErrorDescription[0] == Failure.HOST_IS_SLAVE)
{
//do not log an event in this case
}
else if (error is ConnectionExists)
{
//do not log an event in this case
}
else
{
// Create a new log message to say the connection attempt failed
string title = string.Format(Messages.CONNECTION_FAILED_TITLE, HostnameWithPort);
ActionBase n = new ActionBase(title, reason, false, true, reason);
SetPoolAndHostInAction(n, pool, PoolOpaqueRef);
}
// We only want to continue the master search in certain circumstances
if (FindingNewMaster && (error is WebException || (f != null && f.ErrorDescription[0] != Failure.RBAC_PERMISSION_DENIED)))
{
@ -1662,7 +1669,7 @@ namespace XenAdmin.Network
string title = string.Format(Messages.CONNECTION_LOST_NOTICE_TITLE,
LastConnectionFullName);
ActionBase n = new ActionBase(title, description, false, true, title);
ActionBase n = new ActionBase(title, description, false, true, description);
SetPoolAndHostInAction(n, pool, poolopaqueref);
OnConnectionLost();
}
@ -1814,10 +1821,9 @@ namespace XenAdmin.Network
private void ReconnectMaster()
{
// Add an informational entry to the log
ActionBase action = new ActionBase(
string.Format(Messages.CONNECTION_FINDING_MASTER_TITLE, LastConnectionFullName),
string.Format(Messages.CONNECTION_FINDING_MASTER_DESCRIPTION, LastConnectionFullName, Hostname),
false, true);
string title = string.Format(Messages.CONNECTION_FINDING_MASTER_TITLE, LastConnectionFullName);
string descr = string.Format(Messages.CONNECTION_FINDING_MASTER_DESCRIPTION, LastConnectionFullName, Hostname);
ActionBase action = new ActionBase(title, descr, false, true);
SetPoolAndHostInAction(action, null, PoolOpaqueRef);
log.DebugFormat("Looking for master for {0} on {1}...", LastConnectionFullName, Hostname);