mirror of
https://github.com/xcp-ng/xenadmin.git
synced 2025-01-20 07:19:18 +01:00
Fixed wrong images in the following cases:
- the image for resume suspended VM on non-home server should be connected-server, not vm-being-migrated. - the image for a server where a running VM cannot be migrated to should be connected-server, not disconnected-server (it is disabled anyway). Also, simplified the logic to obtain the cannot-execute-reasons. Signed-off-by: Konstantina Chremmou <konstantina.chremmou@citrix.com>
This commit is contained in:
parent
6833722992
commit
55f1a03224
@ -68,7 +68,10 @@ namespace XenAdmin.Commands
|
||||
|
||||
public override string ContextMenuText { get { return Messages.HOST_MENU_CPM_TEXT; } }
|
||||
|
||||
public override Image MenuImage { get { return Resources._000_MigrateVM_h32bit_16; } }
|
||||
public override Image MenuImage
|
||||
{
|
||||
get { return preSelectedHost == null ? Resources._000_MigrateVM_h32bit_16 : Resources._000_TreeConnected_h32bit_16; }
|
||||
}
|
||||
|
||||
protected override void ExecuteCore(SelectedItemCollection selection)
|
||||
{
|
||||
|
@ -32,6 +32,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using XenAdmin.Core;
|
||||
using XenAdmin.Properties;
|
||||
using XenAPI;
|
||||
@ -67,10 +68,11 @@ namespace XenAdmin.Commands
|
||||
VM vm = (VM)item.XenObject;
|
||||
|
||||
string reason = GetVmCannotBootOnHostReason(vm, GetHost(vm), session, operation);
|
||||
_cantBootReasons[vm] = reason;
|
||||
|
||||
if (reason == null)
|
||||
_noneCanBoot = false;
|
||||
else
|
||||
_cantBootReasons[vm] = reason;
|
||||
}
|
||||
}
|
||||
|
||||
@ -83,24 +85,14 @@ namespace XenAdmin.Commands
|
||||
{
|
||||
get
|
||||
{
|
||||
List<string> uniqueReasons = new List<string>();
|
||||
if (_noneCanBoot)
|
||||
{
|
||||
var uniqueReasons = _cantBootReasons.Values.Distinct().ToList();
|
||||
|
||||
foreach (VM vm in _cantBootReasons.Keys)
|
||||
{
|
||||
if (!uniqueReasons.Contains(_cantBootReasons[vm]))
|
||||
{
|
||||
uniqueReasons.Add(_cantBootReasons[vm]);
|
||||
}
|
||||
}
|
||||
|
||||
if (_noneCanBoot && uniqueReasons.Count == 1)
|
||||
{
|
||||
return string.Format(Messages.MAINWINDOW_CONTEXT_REASON, _text, uniqueReasons[0]);
|
||||
}
|
||||
else
|
||||
{
|
||||
return _text;
|
||||
if (uniqueReasons.Count == 1)
|
||||
return string.Format(Messages.MAINWINDOW_CONTEXT_REASON, _text, uniqueReasons[0]);
|
||||
}
|
||||
return _text;
|
||||
}
|
||||
}
|
||||
|
||||
@ -108,13 +100,13 @@ namespace XenAdmin.Commands
|
||||
{
|
||||
get
|
||||
{
|
||||
return _noneCanBoot ? Resources._000_ServerDisconnected_h32bit_16 : Resources._000_TreeConnected_h32bit_16;
|
||||
return Resources._000_TreeConnected_h32bit_16;
|
||||
}
|
||||
}
|
||||
|
||||
protected override bool CanExecute(VM vm)
|
||||
{
|
||||
return vm != null && _cantBootReasons.ContainsKey(vm) && _cantBootReasons[vm] == null;
|
||||
return vm != null && !_cantBootReasons.ContainsKey(vm);
|
||||
}
|
||||
|
||||
private static string GetVmCannotBootOnHostReason(VM vm, Host host, Session session, vm_operations operation)
|
||||
@ -172,13 +164,8 @@ namespace XenAdmin.Commands
|
||||
protected override string GetCantExecuteReasonCore(SelectedItem item)
|
||||
{
|
||||
VM vm = item.XenObject as VM;
|
||||
if (vm == null)
|
||||
base.GetCantExecuteReasonCore(item);
|
||||
|
||||
if (_cantBootReasons.ContainsKey(vm))
|
||||
{
|
||||
if (vm != null && _cantBootReasons.ContainsKey(vm))
|
||||
return _cantBootReasons[vm];
|
||||
}
|
||||
|
||||
return base.GetCantExecuteReasonCore(item);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user